Skip to content

Instantly share code, notes, and snippets.

@feisuzhu
Created December 14, 2011 13:17
Show Gist options
  • Save feisuzhu/1476532 to your computer and use it in GitHub Desktop.
Save feisuzhu/1476532 to your computer and use it in GitHub Desktop.
CMCC-EDU keep online. Y U ALWAYS DROP OUT!!!
import urllib2 as ul
import time
import re
pattern = re.compile(r'<input type="hidden" name="(.*?)" id="\1" value="(.*?)"/>')
pwdstr = "&bpssUSERNAME=18354210483&bpssBUSPWD=891227"
flagstr = "&flag=true"
loginurl = "https://211.137.185.106:8443//mobilelogin.do"
tried = False
while True:
try:
content = ul.urlopen('http://www.baidu.com/', timeout=2).read()
if len(content) > 12000:
print "Fuck, link dropped! Fuck CMCC-EDU! Re-login!%s" % (' Kick off!' if tried else '')
postdata = '&'.join("%s=%s" % i for i in pattern.findall(content))
postdata += (flagstr + pwdstr) if tried else pwdstr
content = ul.urlopen(loginurl, data=postdata).read()
tried = True
continue
else:
tried = False
except Exception as e:
print 'Something wrong, perhaps timed-out, restarting'
time.sleep(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment