crac

导航

万能英数脚本

#coding:utf8
import requests
import Image
import cStringIO
import imghdr
import urllib2
import ssl
import urllib
import sys
import json
import time
reload(sys)
sys.setdefaultencoding( "utf-8" )
ssl._create_default_https_context = ssl._create_unverified_context
requests.packages.urllib3.disable_warnings()  
headers={
'User-Agent': 'Mozilla/5.0 (Linux; Android 4.4.4; HM NOTE 1LTEW Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36 MicroMessenger/6.0.0.54_r849063.501 NetType/WIFI',
'Accept':' */*',
'Accept-Language': 'zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3',
'Accept-Encoding': 'gzip, deflate',
'Cache-Control': 'max-age=0',
#'Referer': 'https://etrade.8888888.com.cn/etrading/account/modifyinfo/modifyhandset?menuId=60001&SECURE_TOKEN=EypoBhZJX8p9zTim3SQMy6DKm7qqpq6GmUY1FIzUHY',
'Cookie': 'Hm_lvt_5511d0adc0eef76f139de9e942b4a0f3=1528380789,1528814976,1528983294; Hm_lpvt_5511d0adc0eef76f139de9e942b4a0f3=1528983896; language=zh_CN; TWFID=2de0092afc6d81fe; sms_timeout=0; ENABLE_RANDCODE=1'

}


url='http://127.0.0.1:7775/api'
imgurl='http://www*******n:8082/ecdomain/portal/verifycode/newimg.jsp?asktime=%27Thu%20Jun%2014%202018%2023:30:54%20GMT+0800%27&id=yzmimgNode'
req = urllib2.Request(imgurl,headers=headers)
imgtxt = cStringIO.StringIO(urllib2.urlopen(req).read())

postdata2=urllib2.urlopen(req).read()
postdata=imgtxt
#print postdata
html=requests.post(url,data=postdata2,timeout=5)
mynum=html.text
print mynum

imgtype = imghdr.what('', h=postdata2)
with open('Pic\\{}.{}'.format('test','jpg'), 'wb') as f:
	f.write(postdata2)


print 'over'

  

posted on 2018-07-19 23:07  crac  阅读(318)  评论(0编辑  收藏  举报