Skip to content

Instantly share code, notes, and snippets.

@yanunon
Created December 23, 2013 08:22
Show Gist options
  • Save yanunon/8093424 to your computer and use it in GitHub Desktop.
Save yanunon/8093424 to your computer and use it in GitHub Desktop.
#!/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')
@kyon0304
Copy link

  • xproc1(passwd)这是什么?
  • 你是怎么确定tmpchar = pid + passwd + calgupass = m.hexdigest() + calg + pid这两个的式子的?

@yanunon
Copy link
Author

yanunon commented Dec 23, 2013

@kyon0304

  1. xproc1那个是删多了,其实前面ps=1,那么if ps==0:upass = xproc1(passwd)这句永远不会执行,之前好像考虑过ps有两种值,现在忘了怎么回事了
  2. 看原网页js代码看出来的呗

@kyon0304
Copy link

好眼力!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment