Skip to content

Instantly share code, notes, and snippets.

@deyixtan
Created May 28, 2023 03:42
Show Gist options
  • Save deyixtan/c217af06515904bb49eeea72e909675c to your computer and use it in GitHub Desktop.
Save deyixtan/c217af06515904bb49eeea72e909675c to your computer and use it in GitHub Desktop.
Reconnect to Kith cafe Wireless AP
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