本文主要是介绍Python 获取手机营业厅token信息,自动参加“天天夺宝“活动,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
此次教程是以python作为脚本运行的,需要以下软件/网页:
1.抓包工具《Charles》(电脑安装),
2.编写python的软件,Notepad(电脑安装),有条件pycharm就更好了
3.pydroid3 (手机) https://blog.csdn.net/qq_38282706/article/details/107739675
4.网页请求转化为Python requests的网站https://curl.trillworks.com/
准备步骤:
1.你得会抓包,就是能运用Charles 抓取自己手机浏览的网页信息,可参考https://www.cnblogs.com/broszhu/p/11569571.html
2.手机或者电脑能运行python文件,pydroid3是可以直接在手机运行的,而电脑上,你得安装python
3.手机或电脑里的python需要安装requests模块
======================================================================================================
假设上面你都搞明白了,那么下面可以正式进入正题了。
第一步,Charles抓包:
进入”天天夺宝“页面,
对应的可以看到charles:
一堆网址,不知哪个,这是按ctrl+F,搜索https://st.gd10010.cn/gatherpage/login/gatherpage/h5login 这时就能找到我上图的网页了
然后选中网页,右击
把复制的文本,粘贴到这个网页中
注意这3个参数 headers,params,cookies
接下来就是我自己写的py文件了:
import requests,timedef get_yunlaisibao():import datetime# 取当前时间now_time=time.strftime('%Y%m%d%H%M%S', time.localtime(time.time()))cookies = {'yunlaisibao': 'jx105964314764725125','ofLgBpU4kROxO': '5rAa6sRy2.JsVlltqc7VG2p7vfaPP5tiHwu7VhlzE5ni7p7mOSMtj7eNL4EvxiTwcs6e2QEelMTjE0SpL4rwcga','ofLgBpU4kROxP': '5UeNl_YdFpKVqqqmCMx0uyaG2jXsczkNlAjse9mHBMhOYRmJaxmSOuYmw5t.qpvXu2bzDGliJCVaoBx_tBio9XSi5R.fxY7UN37Ho3TUnvhOojCcSGkaBhNmGBjcWdKnwGfM4uML2PGh60qWDdP0Fvt2dWuRmEDMqXN_jggyF6TWWmXFRoJw92gFa85GHasJyeB5qDIkOVTIbhqWEcZzfYEkf1wo.t1FmyBa2zfGnplkqKog4IyRJ90vw_KIaX9MaWGwcF.xbfLfYqhGqnbwoLF',}headers = {'Host': 'st.gd10010.cn','Pragma': 'no-cache','Cache-Control': 'no-cache',#User-Agent替换为你抓到的'User-Agent': 'Mozilla/5.0 (Linux; Android 8.1.0; ONEPLUS A6000 Build/OPM1.171019.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/62.0.3202.84 Mobile Safari/537.36; unicom{version:android@8.0002,desmobile:18888888888};devicetype{deviceBrand:OnePlus,deviceModel:ONEPLUS A6000};{yw_code:}','Upgrade-Insecure-Requests': '1','Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8','Accept-Language': 'zh-CN,en-US;q=0.9','X-Requested-With': 'com.sinovatech.unicom.ui',}params = (#token替换为你抓到的('token', 'eyJkYXRhIjoiMDFkMGQ4YmE1NTM3MDcwNDlkYTY2NTZkZGU4NzdkZjljNzg1M2Q3MGE2ZDRmNzEyYmNlNGY5NTM0MWU2NjkxZmFkMTAyNGZhMzg5NzBmOTFlMzgwOTUzNTAwMjQ4ZTg3MGZhMTY3MDBhOWMzNmZhYTM4YmE4YmQ1ZWFmMWVhNWFlMDY4NTllNmU5ZjQ1ZDQ1ZjNhMjBjODBjYzQ0NzQ1NzJmZmI1OTA0N2JhZjJmODdjZWUzOTkwMWEwZjRhMjBkZDdkMjE5NDAwNGM4NWJiMWRmODNmNmE1MDkzZmQ0ZTEiLCJ2ZXJzaW9uIjoiMDAifQ=='),('type', '999'),('version', 'android@8.0002'),('timestamp', now_time),##替换为你的手机号码('desmobile', '18888888888'),('duanlianjieabc', 'dbsj'),)response = requests.get('https://st.gd10010.cn/gatherpage/login/gatherpage/h5login', allow_redirects=False,headers=headers, params=params, cookies=cookies)Set_Cookie=response.headers['Set-Cookie']cookies = {i.split("=")[0]: i.split("=")[1] for i in Set_Cookie.split(";")}yunlaisibao=cookies['yunlaisibao']print(yunlaisibao)return yunlaisibaoyunlaisibao=get_yunlaisibao()cookies = {'yunlaisibao': 'jx367275367227533652','ofLgBpU4kROxO': '5rAa6sRy2.JsVlltqc7VG2p7vfaPP5tiHwu7VhlzE5ni7p7mOSMtj7eNL4EvxiTwcs6e2QEelMTjE0SpL4rwcga','ofLgBpU4kROxP': '5UeLadYdFWUGqqqmCMleIOGTM4ueXaiAn0Q5aBuTFZMWE9QipOHVaWr8WO_OxatdOjPjI5EAkD3.eQ1lc.nkGDgs24PExstJJn_4SfPWEGAdMq2SJfihsYJtQzM0NeKpuZ_EKikufwz5iycrog2Uc8ztUFzeDm_SnvCFh3aeElDxYrgPh2QB3EXJheRoHxFMpaLnGh.I_eeeouEDGAvisX.Q60BoYQw4fbWhgqJcY3DctYVK5LR4lRP4lE2cnVYOBjBa1ZzyhOrhaJ0oyF9uGgq',
}headers = {'Host': 'st.gd10010.cn','Pragma': 'no-cache','Cache-Control': 'no-cache','Accept': 'application/json, text/plain, */*','Origin': 'https://st.gd10010.cn',#User-Agent替换为你抓到的'User-Agent': 'Mozilla/5.0 (Linux; Android 8.1.0; ONEPLUS A6000 Build/OPM1.171019.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/62.0.3202.84 Mobile Safari/537.36; unicom{version:android@8.0002,desmobile:18888888888};devicetype{deviceBrand:OnePlus,deviceModel:ONEPLUS A6000};{yw_code:}','Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
# 'Referer': 'https://st.gd10010.cn/activity-pages/gatherpage/pages/?cookie=jx367275367227533652&channelId=ST','Accept-Language': 'zh-CN,en-US;q=0.9','X-Requested-With': 'com.sinovatech.unicom.ui',
}params = (('KRkK3VGa', '5ya2AWiTliwCax0tslS68bKkCieWV5qSZNZhlniL6yxjt0Uf3fJNoz3nxMcqH.dPVHnXb6eISx2JotB9EpWKFNxBNNQV7gXems_fHQm4KUVctvk2gbhDu8xshq37sMbCkbs7x7nmelTmb7uquPrWJd1R9Bk3WfrMkS2FoQWL1qeGRQt0CetytJj_TuP22C0UCr5Byri0uWTm14cIwvaBLVm0FfiywBMgVfZCksuDGmyhA_QcK3XuihXTBnh3.jImF91PN_j5e6JDoPBlstatQBTBkdZvAdnwdm7ehjKJ_EUsMZGsynp8jwfjEYWJKCCaD'),
)
gift_ids=[]
response = requests.post('https://st.gd10010.cn/gatherpage/gatherPageShow/awardHomeShow', headers=headers, params=params, cookies=cookies)
gift=response.json()['flexData']['awardListOne']
for one in gift:name=one['awardName']betActivityId=one['betActivityId']gift_ids.append(betActivityId)print(name,betActivityId)def touzhu(betActivityId):global yunlaisibaocookies = {'yunlaisibao': yunlaisibao,'ofLgBpU4kROxO': '5rAa6sRy2.JsVlltqc7VG2p7vfaPP5tiHwu7VhlzE5ni7p7mOSMtj7eNL4EvxiTwcs6e2QEelMTjE0SpL4rwcga','ofLgBpU4kROxP': '5UeLSwYdFWIqqqqmCMmDj1GafvSuBQnh3maB_e694Vm9o0UG4fk8elmL45QSzOOeX6QIcYGbj_rBgrIFNnJooziqE.71BYODAMNtA08MqsF_fNokiSXQT_NnZoh5F4WIVEz00v6dB9wwh3IVIYuipT.vwVXyC8.Crd30txNGEtef.ZYCF6HN5h7p28DJjlAEr7wY_hthLVlFnPvEXM6gTH3x76cShx0FFrvzZe3NF_aIG9wdrUyj.T3QysIOUR_s5lVaNGnNf4oiLyLALFDBYgSIbCjPCexBvQjHewjo3.1yUPNdTIw_Qwjbx7dxMKfQ0bzSusRU32ZQzjs.kXT5iZU',}headers = {'Host': 'st.gd10010.cn','Pragma': 'no-cache','Cache-Control': 'no-cache','Accept': 'application/json, text/plain, */*','Origin': 'https://st.gd10010.cn',# User-Agent替换为你抓到的'User-Agent': 'Mozilla/5.0 (Linux; Android 8.1.0; ONEPLUS A6000 Build/OPM1.171019.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/62.0.3202.84 Mobile Safari/537.36; unicom{version:android@8.0002,desmobile:18888888888};devicetype{deviceBrand:OnePlus,deviceModel:ONEPLUS A6000};{yw_code:}','Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',# 'Referer': 'https://st.gd10010.cn/activity-pages/betactivitytwo/pages/?cookie=jx368240828149565648&awardId=DBXFXB20200924001','Accept-Language': 'zh-CN,en-US;q=0.9','X-Requested-With': 'com.sinovatech.unicom.ui',}params = (('KRkK3VGa', '5cAS3kERLH.C8a.b5edemzqVZMdTyZ2cbUvipybDFL03zaRw4QsmAN9h4L5e5IbrxqXkMRBX.a5zKoT4vgYVILjBbbK6bE49t2UQtQzF1.YdIvmYD4yYRXDfGj4mFmCcSQUWbMRpJBwj0OZ3lN3qmx8Ye8nxR3wzPgtWsQJVEncFNK0efy6to0kbNr1sT7xs8wQ6YSFCCMUO9D_ThN_n9k01yysDB.aILR.X.zX.f.MPWEF5BTrRAIlesNQWN.PuqGM1DBEbP.S_KeiUuRi8ErbAFk1CUoKtbPGHf3NHN8B5i1r1hrsPA_GmB3ZLuKefRtOtM5t8cUG.kB_dRU7ffkJ.n4lsdXGuqcYS_mfbNNm9zWo41FKdfcotkBKMoU5Vc'),)data = {#替换为你的手机号码'userPhone':'1888888888',#手机号码'userRole':'0','betType':'1','activityId':betActivityId,# token替换为你抓到的'token':'eyJkYXRhyjoiMDFkMhQ4YmE1NTM3MDcwNDlkYTY2NTZkZGU4NzdkZjljNzg1M2Q3MGE2ZDRmNzEyYmNlNGY5NTM0MWU2NjkxZmFkMTAyNGZhMzg5NzBmOTFlMzgwOTUzNTAwMjQ4ZTg3MGZhMTY3MDBhOWMzNmZhYTM4YmE4YmQ1ZWFmMWVhNWFlMDY4NTllNmU5ZjQ1ZDQ1ZjNhMjBjODBjYzQ0NzQ1NzJmZmI1OTA0N2JhZjJmODdjZWUzOTkwMWEwZjRhMjBkZDdkMjE5NDAwNGM4NWJiMWRmODNmNmE1MDkzZmQ0ZTEiLCJ2ZXJzaW9uIjoiMDAifQ==%3D%3D'}response = requests.post('https://st.gd10010.cn/betactivity/betlucky/betLuckyStart',headers=headers, params=params, cookies=cookies, data=data,timeout=7)#print(response.json())if response.json()['code']==100001:#print('登录失败!!')print(response.json())result='登录失败!!'else:msg = response.json()['flexData']['msg']result=msgreturn resulttouzhu_list=[
{'name':'饼票','id':gift_ids[0],'times':2},
{'name':'华为','id':gift_ids[1],'times':5},
{'name':'游戏机','id':gift_ids[2],'times':100},
{'name':'话费','id':gift_ids[3],'times':0},
]
def tou_one(touzhu_dict):ok_num=0while ok_num<touzhu_dict['times']:try:result=touzhu(touzhu_dict['id'])except:result='投注失败!!'print('投注失败!!')if result=='登录失败!!':print('cookies失效,登录失败!!')breakelif result=='投注池已满,敬请等待开奖!':print('投注池已满')breakelif result=='投注成功,继续投注可提高中奖概率哦!':ok_num+=1print('投注成功')print('设定投注<%s>成功率: %s/%s'%(touzhu_dict['name'],ok_num,touzhu_dict['times']))for one in touzhu_list:tou_one(one)
##大家注意那些需要替换的,你找到,然后替换就行了!!(如果能看懂,最好把那些乱七八糟的参数都替换为你抓到的)
。
。
。
。
接着运行就行了!!!
这篇关于Python 获取手机营业厅token信息,自动参加“天天夺宝“活动的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!