Created
May 28, 2023 03:42
-
-
Save deyixtan/c217af06515904bb49eeea72e909675c to your computer and use it in GitHub Desktop.
Reconnect to Kith cafe Wireless AP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import time | |
from urllib.parse import urlparse | |
PASSWORD = "tiramisu" | |
s = requests.Session() | |
def get_parsed_login_url(test_url="http://1.1.1.1"): | |
''' test_url is a random url used to redirect to the login page ''' | |
res = s.get(test_url) | |
parsed_url = urlparse(res.url) | |
return parsed_url | |
def resolve_connection(parsed_url): | |
parsed_scheme = parsed_url.scheme | |
parsed_netloc = parsed_url.netloc | |
parsed_path = parsed_url.path | |
login_time = int(time.time() * (10**3)) | |
login_url = f"{parsed_scheme}://{parsed_netloc}{parsed_path}login?t={login_time}" | |
s.post(login_url, json={ "password": PASSWORD }) | |
if __name__ == "__main__": | |
parsed_url = get_parsed_login_url() | |
resolve_connection(parsed_url) | |
print("Done") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment