自動外鏈工具 在線排版工具 搜索引擎提交入口 wordpress主題推薦 批量打開網址工具 【老域名購買】 思享SEO導航 【網站合作】

N久之前的刷數字幣羊毛腳本

689

18年初的刷數字幣羊毛的腳本,備份下;

具體流程是:

1、從IP池中抽取新IP

2、訪問目標網站

3、從卡商獲取手機號

4、在目標網站輸入手機號,并提交

5、從卡商處獲取短信驗證碼

6、在目標網站填入短信驗證碼

7、定位圖形驗證碼的元素位置

8、提取圖形驗證碼圖片,并調用ORC接口識別圖片驗證碼中的文字內容

9、輸入驗證碼

10、提交郵箱

11、獲取telegram驗證碼

 

#coding:utf-8
import?requests,re,time,sys,json,datetime,urllib,os,random,linecache,base64
reload(sys)
sys.setdefaultencoding('utf-8')
from?ShowapiRequest?import?ShowapiRequest
import?multiprocessing
from?selenium?import?webdriver
from?selenium.webdriver.common.keys?import?Keys
from?selenium.webdriver.common.proxy?import?*
from?selenium.webdriver.firefox.firefox_binary?import?FirefoxBinary
from?PIL?import?Image
def?get_yima(url):
????headers?=?{
????????"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
????????"Accept-Encoding":"gzip,?deflate",
????????"Accept-Language":"zh-CN,zh;q=0.9,en;q=0.8",
????????"Cache-Control":"max-age=0",
????????"Connection":"keep-alive",
????????"Cookie":"__cfduid=d122450b84d9e008a1337aac8df9b97811511877258",
????????"Host":"api.51ym.me",
????????"Upgrade-Insecure-Requests":"1",
????????"User-Agent":"Mozilla/5.0?(Macintosh;?Intel?Mac?OS?X?10_11_4)?AppleWebKit/537.36?(KHTML,?like?Gecko)?Chrome/62.0.3202.94?Safari/537.36",
????}
????html?=?requests.get(url,headers=headers,timeout=30)
????code?=?html.encoding
????return?html.content
def?get_tianma(url):
????headers?=?{
????????"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
????????"Accept-Encoding":"gzip,?deflate",
????????"Accept-Language":"zh-CN,zh;q=0.9,en;q=0.8",
????????"Cache-Control":"max-age=0",
????????"Connection":"keep-alive",
????????"Cookie":"__cfduid=dc7085e092fe2b17bb572f8f694e12d051512015018",
????????"Host":"api.tianma168.com",
????????"Upgrade-Insecure-Requests":"1",
????????"User-Agent":"Mozilla/5.0?(Macintosh;?Intel?Mac?OS?X?10_11_4)?AppleWebKit/537.36?(KHTML,?like?Gecko)?Chrome/62.0.3202.94?Safari/537.36",
????}
????html?=?requests.get(url,headers=headers,timeout=30)
????code?=?html.encoding
????return?html.content
def?get_zhima_ip():
????url?=?"http://webapi.http.zhimacangku.com/getip?num=1&type=1&pro=&city=0&yys=0&port=2&time=1&ts=0&ys=0&cs=0&lb=1&sb=0&pb=45&mr=1&regions="
????html?=?requests.get(url,timeout=30)
????ip?=?html.content.strip()
????return?ip
def?search(req,html):
????text?=?re.search(req,html)
????if?text:
????????data?=?text.group(1)
????else:
????????data?=?'no'
????return?data
def?gain_mobile():
????url?=?'http://api.51ym.me/UserInterface.aspx?action=getmobile&itemid=12503&token=xxx'
????a?=?get_yima(url)
????mobile?=?search('(\d{11})',a)
????return?mobile
def?gain_sms(input_mobile):
????url?=?'http://api.51ym.me/UserInterface.aspx?action=getsms&mobile=%s&itemid=12503&token=xxx'?%?input_mobile
????a?=?get_yima(url)
????return?a
def?gain_black(input_mobile):
????url?=?'http://api.51ym.me/UserInterface.aspx?action=addignore&mobile=%s&itemid=12503&token=xxx'?%?input_mobile
????a?=?get_yima(url)
????return?a
def?tm_login():
????url?=?'http://api.tianma168.com/tm/Login?uName=a631381702&pWord=ab24562660&Developer=mzpK3SBKBcA%%3d'
????a?=?get_tianma(url)
????token?=?search('([^&].*?)&',a)
????return?token
def?tm_gain_mobile(token):
????url?=?"http://api.tianma168.com/tm/getPhone?ItemId=64802&token=%s"?%?token
????a?=?get_tianma(url)
????mobile?=?search('(\d+)',a)
????return?mobile
def?tm_gain_sms(token,mobile):
????url?=?"http://api.tianma168.com/tm/getMessage?token=%s&itemId=64802&phone=%s"?%?(token,mobile)
????a?=?get_tianma(url)
????code?=?search(r'?(\d{4})?',a)
????return?code
def?tm_black(token,mobile):
????url?=?'http://api.tianma168.com/tm/addBlack?token=%s&phoneList=%s'?%?(token,mobile)
????a?=?get_tianma(url)
????return?a
def?get_ip():
????a?=?os.popen('curl?-x?"http://http-cla.abuyun.com:9030"?--proxy-basic?--proxy-user?H3Q0N268PZ1375FC:C63714C012917AFD?http://proxy.abuyun.com/switch-ip')
????return?a
def?authcode_showapi(base64_data):
????#?typeID說明
????#?識別4位數字:14
????#?識別4位英文:24
????#?識別4位英數混合:34
????#?識別4位漢字:44
????#?是被4位英文數字漢字混合:54
????#?other:https://www.showapi.com/api/view/184/6
????r?=?ShowapiRequest("http://route.showapi.com/184-5",?"67544",?"5e1e3d13b7ed477bb0fb0d1986eddad8")
????r.addBodyPara("img_base64",?base64_data)
????r.addBodyPara("typeId",?"34")
????r.addBodyPara("convert_to_jpg",?"0")
????r.addBodyPara("needMorePrecise",?"1")
????#?r.addFilePara("img",r"/Users/sunjian/Desktop/wool/chain/img/code.jpg")?#文件上傳時設置
????res?=?r.post()
????res_text?=??res.text??#?返回信息
????a?=?res_text.encode('utf-8')
????code?=?search(r'"Result":"(.*?)"',a)
????return?code
bac?=?open('coinclub_bac','a')
def?coinclub(n,mail,eth):
????try:
????????#?newip?=?get_ip()
????????newip?=?get_zhima_ip()
????????host?=?search('(\d+\.\d+\.\d+\.\d+):',newip)
????????port?=?int(search(':(\d+)$',newip))
????????profile?=?webdriver.FirefoxProfile()
????????profile.set_preference("network.proxy.type",?1);
????????profile.set_preference("network.proxy.socks_version",?5);
????????profile.set_preference("network.proxy.socks",?host);
????????profile.set_preference("network.proxy.socks_port",?port);
????????profile.update_preferences()
????????browser?=?webdriver.Firefox(firefox_profile=profile)
????except:
????????profile?=?webdriver.FirefoxProfile()
????????browser?=?webdriver.Firefox()
????profile?=?webdriver.FirefoxProfile()
????browser?=?webdriver.Firefox()
????#?try:
????print?'@@@@@@@@@@@@?第%s次執行[email protected]@@@@@@@@@@@'?%?n
????#?輸入coinclub邀請網址
????print?'>>>?打開coinclub?url'
????browser.implicitly_wait(20)
????browser.get(get_url())
????time.sleep(3)
????#?輸入eth地址
????print?'>>>?輸入ETH錢包地址'
????browser.find_element_by_xpath("/html/body/div/form/div[4]/div[2]/input[1]").send_keys(eth)
????time.sleep(3)
????#?對當前屏幕截圖
????print?'>>>?截屏'
????browser.get_screenshot_as_file('./img/1.jpg')
????time.sleep(3)
????#?定位驗證碼坐標&截圖獲取驗證碼圖片
????print?'>>>?裁剪驗證碼圖片'
????location?=?browser.find_element_by_id('myCanvas').location
????size?=?browser.find_element_by_id('myCanvas').size
????left?=?int(location['x'])
????top?=?int(location['y'])
????right?=?int(location['x'])?+?int(size['width'])
????bottom?=?int(location['y'])?+?int(size['height'])
????a?=?Image.open("./img/1.jpg")
????im?=?a.crop((left,?top,?right,?bottom))
????im.save('./img/code.jpg')
????#?識別驗證碼
????print?'>>>?識別驗證碼'
????#?驗證碼圖片轉為base64編碼
????with?open("./img/code.jpg",?"rb")?as?f:
????????#?b64encode是編碼,b64decode是解碼
????????base64_data?=?base64.b64encode(f.read())
????authcode?=?authcode_showapi(base64_data)
????time.sleep(3)
????#?輸入驗證碼
????print?'>>>?輸入驗證碼'
????browser.find_element_by_xpath("/html/body/div/form/div[4]/div[2]/input[2]").send_keys(authcode)
????time.sleep(2)
????#?點擊提交
????print?'>>>?點擊提交'
????browser.find_element_by_xpath("/html/body/div/form/div[4]/div[2]/button").click()
????time.sleep(6)
????#?提交郵箱
????print?'>>>?提交郵箱'
????browser.find_element_by_xpath("/html/body/div/div/div[4]/div[2]/div/input[3]").send_keys(mail)
????time.sleep(1)
????browser.find_element_by_xpath("/html/body/div/div/div[4]/div[2]/div/a").click()
????time.sleep(2)
????#?獲取手機號
????print?'>>>?獲取手機號&提交'
????mobile?=?gain_mobile()
????time.sleep(1)
????browser.find_element_by_xpath("/html/body/div/div/div[4]/div[3]/div/input[3]").send_keys(mobile)
????time.sleep(1)
????browser.find_element_by_xpath("/html/body/div/div/div[4]/div[3]/div/a").click()
????time.sleep(2)
????#?提取電報驗證碼
????print?'>>>?提取telegram驗證碼'
????html?=?browser.page_source
????print?html
????time.sleep(600)
????'''關閉瀏覽器'''
????browser.delete_all_cookies()
????browser.quit()
????#?except?Exception,e:
????#?????print?repr(e)
????????#?browser.delete_all_cookies()????
????????#?browser.quit()
def?get_name():
????a?=?random.randrange(1,?50000)?#1-9中生成隨機數??
????theline?=?linecache.getline(r'people_name',?a).strip()
????return?theline.decode("utf-8")
def?get_url():
????url_list?=?[
????????"https://www.coinclub.global/airdrop/PTc1v5mdDPZIhxXt1rio",
????]
????slice?=?random.sample(url_list,1)[0]
????return?slice
mails?=?open("mail_163").readlines()
eths?=?open("eth_adress").readlines()
for?i?in?range(1,501):
????email?=?mails[i].split('&')[0]
????eth?=?eths[i]
????print?email,eth
#?coinclub(1,email,eth)

 

ShowapiRequest.py

import?requests,sys
import?urllib
#from?urllib?import?parse
from?urlparse?import?urlparse
files?=?{}
headers?=?{}
body?=?{}
timeouts?=?{}
resHeader?=?{}
class?ShowapiRequest:
????def?__init__(self,?url,?my_appId,?my_appSecret):
????????self.url?=?url
????????self.my_appId?=?my_appId
????????self.my_appSecret?=?my_appSecret
????????body["showapi_appid"]?=?my_appId
????????body["showapi_sign"]?=?my_appSecret
????????headers["User-Agent"]?=?"Mozilla/5.0?(Windows?NT?6.1;?WOW64)?AppleWebKit/537.36?(KHTML,?like?Gecko)?Chrome/45.0.2427.7?Safari/537.36"
????def?addFilePara(self,?key,?value_url):
????????files[key]?=?open(r"%s"?%?(value_url),?'rb')
????????return?self
????def?addHeadPara(self,?key,?value):
????????headers[key]?=?value
????????return?self
????def?addBodyPara(self,?key,?value):
????????body[key]?=?value
????????return?self
????def?setTimeout(self,?connecttimout,?readtimeout):
????????timeouts["connecttimout"]?=?connecttimout
????????timeouts["readtimeout"]?=?readtimeout
????????return?self
????def?get(self):
????????get_url?=?self.url?+?"?"?+?urllib.urlencode(body)
????????if?not?timeouts:
????????????res?=?requests.get(get_url,?headers=headers)
????????else:
????????????timeout?=?(timeouts["connecttimout"],?timeouts["readtimeout"])
????????????res?=?requests.get(get_url,?headers=headers,?timeout=timeouts)
????????return?res
????def?post(self):
????????if?not?timeouts:
????????????res?=?requests.post(self.url,?files=files,?data=body,?headers=headers)
????????else:
????????????timeout?=?(timeouts["connecttimout"],?timeouts["readtimeout"])
????????????res?=?requests.post(self.url,?files=files,?data=body,?headers=headers,?timeout=timeout)
????????return?res

 

來源:本文由思享SEO博客原創撰寫,歡迎分享本文,轉載請保留出處和鏈接!
seo培訓評論廣告

搶沙發

昵稱*

郵箱*

網址

七乐彩选号技巧