Skip to content

Instantly share code, notes, and snippets.

@borgle
Created November 25, 2015 07:55
Show Gist options
  • Save borgle/e05f7d8b3fbbf1d94173 to your computer and use it in GitHub Desktop.
Save borgle/e05f7d8b3fbbf1d94173 to your computer and use it in GitHub Desktop.
利用cloudsightapi破解电信积分手机版本图形验证码测试代码
#!/usr/bin/env python
#coding: utf-8
import requests
import json,time,os
REQURL = 'https://api.cloudsightapi.com/image_requests'
RESPURL = 'https://api.cloudsightapi.com/image_responses'
headers = {"Authorization":"CloudSight 39OOYyT553WHpEPlo2Ehcw00",
"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36"}
datadic = {"image_request[locale]":"en-US",
"image_request[remote_image_url]":"http://club.taoyer.cn/skLife/servlet/validateCodeServlet?re=0.3"}
result,tmp = {}, {}
for i in range(0, 10):
try:
r = requests.post(REQURL, data=datadic, headers=headers)
j = r.json()
print i, j['url']
result[j['token']] = j['url']
except Exception, e:
print i, e
time.sleep(0.05)
while len(result)!=len(tmp):
for k in result:
if tmp.contains(k):
continue
try:
r = requests.get(RESPURL +'/'+ k, headers=headers)
j = r.json()
if j['status'] == 'not completed':
pass
elif j['status'] == 'completed':
f.write(j['name'] + '\t\t' + result[k] + '\r\n')
tmp[k] = j['name'].replace('captcha code').strip()
#save img with crack code
filext = os.path.splitext(result[k])[1]
img = requests.get('http:' + result[k], headers=headers)
f = open('f:/Development/a/%s%s' % (tmp[k], filext), 'wb')
f.write(r.content)
f.close()
else:
tmp[k] = j['status']
print k, j['status']
except Exception, e:
print k, e
time.sleep(0.2)
time.sleep(0.6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment