Last active
August 29, 2015 14:04
-
-
Save jaseg/26f770d9e8c309e8f5ae to your computer and use it in GitHub Desktop.
Automatically log in to the shittiest of all shitty hotel wifis
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
#!/usr/bin/env python | |
import time | |
import bs4 | |
import requests | |
def log(*args): | |
print(time.strftime('\x1B[93m[%m-%d %H:%M:%S]\x1B[0m'), *args+('\x1B[0m',)) | |
def logon(res): | |
soup = bs4.BeautifulSoup(res.text) | |
d = {'ta_id': soup.find('input', {'name': 'ta_id'}).attrs['value'], | |
'hnum': '1', # hotel number, likely insignificant. | |
'roomnumber': 'INSERT ROOM NUMBER HERE', | |
'name': 'INSERT NAME HERE', | |
'departureday': '1', | |
'day': 'INSERT', | |
'month': 'DEPARTURE DATE', | |
'year': 'HERE', | |
'pms_remember_me': '', | |
'pms_logon_btn': '++Logon++'} | |
requests.post('https://hotspot.internet-for-guests.com/logon/cgi/index.cgi', data=d) | |
while True: | |
try: | |
res = requests.get('http://en.wikipedia.org/wiki/Main_Page') # Sorry, wikipedia. I'll try to remember to donate a bit for servers some time. | |
if res.history: | |
logon(res) | |
log('Logged in.') | |
except requests.exceptions.ConnectionError: | |
pass | |
time.sleep(60) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment