Created
December 23, 2013 08:22
-
-
Save yanunon/8093424 to your computer and use it in GitHub Desktop.
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 | |
#-*- coding: utf-8 -*- | |
import urllib | |
import urllib2 | |
import md5 | |
#ps=1;pid='1';calg='12345678'; | |
def mkparams(uid, passwd): | |
ps = 1 | |
pid = '1' | |
calg='12345678' | |
upass = '' | |
R2 = 0 | |
if ps == 0: | |
upass = xproc1(passwd) | |
else: | |
tmpchar = pid + passwd + calg | |
m = md5.new(tmpchar) | |
upass = m.hexdigest() + calg + pid | |
R2 =1 | |
params = { | |
'DDDDD': uid, | |
'upass': upass, | |
'R1': 0, | |
'R2': R2, | |
'para': '00', | |
'0MKKey': '123456' | |
} | |
return params | |
def do_login(uid, passwd): | |
params = mkparams(uid, passwd) | |
url = 'http://10.3.8.211' | |
data = urllib.urlencode(params) | |
req = urllib2.Request(url, data) | |
resp = urllib2.urlopen(req) | |
page = resp.read() | |
if page.find('You have successfully logged into our system.') > -1: | |
print 'successed' | |
else: | |
print 'failed' | |
if __name__ == '__main__': | |
do_login('ID', 'PASSWORD') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
好眼力!