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
@kyon0304
xproc1
那个是删多了,其实前面ps=1
,那么if ps==0:upass = xproc1(passwd)
这句永远不会执行,之前好像考虑过ps
有两种值,现在忘了怎么回事了