mirror of
https://github.com/Stone-Red-Code/HotspotAutoLogin.git
synced 2026-11-01 23:05:40 +01:00
v1.90fix4
This commit is contained in:
+12
-20
@@ -625,30 +625,22 @@ def send_request():
|
|||||||
# Function to check if internet is available
|
# Function to check if internet is available
|
||||||
def is_internet_available():
|
def is_internet_available():
|
||||||
try:
|
try:
|
||||||
internet_check_url_clean = internet_check_url.replace("http://", "").replace("https://", "")
|
parsed = urlparse(internet_check_url)
|
||||||
socket.setdefaulttimeout(3)
|
if not parsed.scheme:
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
test_urls = [f"https://{internet_check_url}", f"http://{internet_check_url}"]
|
||||||
if internet_check_url_clean.replace('.', '').isdigit():
|
|
||||||
address = internet_check_url_clean
|
|
||||||
else:
|
else:
|
||||||
|
test_urls = [internet_check_url]
|
||||||
|
for url in test_urls:
|
||||||
try:
|
try:
|
||||||
address = socket.gethostbyname(internet_check_url_clean)
|
response = requests.get(url, timeout=5)
|
||||||
except socket.gaierror:
|
if response.status_code == 200:
|
||||||
|
return True
|
||||||
|
except requests.RequestException as e:
|
||||||
return False
|
return False
|
||||||
if internet_check_url.startswith("https://"):
|
|
||||||
port = 443
|
|
||||||
elif internet_check_url.startswith("http://"):
|
|
||||||
port = 80
|
|
||||||
else:
|
|
||||||
port = 53
|
|
||||||
server_address = (address, port)
|
|
||||||
s.connect(server_address)
|
|
||||||
except OSError as error:
|
|
||||||
return False
|
return False
|
||||||
finally:
|
except Exception as e:
|
||||||
s.close()
|
return False
|
||||||
return True
|
|
||||||
|
|
||||||
# Function to get the currently connected SSID using system commands (for Windows)
|
# Function to get the currently connected SSID using system commands (for Windows)
|
||||||
def get_connected_network():
|
def get_connected_network():
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user