failproof online check (fixes vpns and dns tunnels)

This commit is contained in:
thecookingsenpai 2024-01-31 18:25:20 +01:00
parent c153247918
commit bc51150e47

View File

@ -1,12 +1,14 @@
import socket as Socket
def has_connection(host="8.8.8.8", port=53, timeout=3):
def has_connection(host="google.it", port=80, timeout=3):
"""
# REVIEW Was:
Host: 8.8.8.8 (google-public-dns-a.google.com)
OpenPort: 53/tcp
Service: domain (DNS/TCP)
"""
try:
Socket.setdefaulttimeout(timeout)
Socket.socket(Socket.AF_INET, Socket.SOCK_STREAM).connect((host, port))