1 Star 0 Fork 0

gsls200808 / 99shou

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
99shou.py 2.89 KB
一键复制 编辑 原始数据 按行查看 历史
gsls200808 提交于 2019-03-17 14:02 . 初始提交
#!/usr/bin/python
# -*-coding:utf-8-*-
# 免责声明:以下脚本内容仅做为技术研究之用,请勿用于非法用途,造成后果与作者无任何关系!
# 脚本参考:赚客吧用户q409195961的帖子 http://www.zuanke8.com/thread-5852512-1-1.html
import http.client as httplib
import urllib, json, time, hashlib
# 在前面填写账号密码还有99开发者中心的私钥,然后用Python3跑即可
# 抢到单会自动暂停,但不会任何通知,请记得留意Log输出
# 用户名
username = ''
# 密码
password = ''
# 私钥
securitykey = ''
# 金额 (可选面值:10、20、30、50、100、200、300、500)
money = '50'
# token两小时失效,建议1小时刷新或者通过错误码被动刷新
# 开发者文档地址:https://www.showdoc.cc/146389018622665?page_id=832606251548511
# 常见关于token的错误码 899994 认证失败,token为空! 899993 认证失败,token已过期!
def getToken():
# 登录
conn = httplib.HTTPConnection(host='99shou.cn')
conn.request(method='POST', url='http://99shou.cn/api/user-server/user/login',
body=json.dumps({'username': username, 'password': password}),
headers={'Content-Type': 'application/json; charset=utf-8'})
response = conn.getresponse()
if response.status != 200:
# 登录失败
fail(-1)
res = response.read().decode('utf8')
data = json.loads(res)
conn.close()
if data['rtnCode'] != '000000':
print(data['rtnMsg'])
print(data)
fail(data['rtnCode'])
token = data['rtnData']['token']
return token
def main():
# 登录获取token
token = getToken()
while 1:
txntime = str(int(round(time.time() * 1000)))
# 参数
params = json.dumps({'faceValue': money})
md5 = hashlib.md5()
upwd = (params + securitykey + txntime).encode('utf8')
md5.update(upwd)
sign = md5.hexdigest()
conn = httplib.HTTPConnection(host='99shou.cn')
conn.request(method='POST', url='http://99shou.cn/api/phonecharge-server/phonecharge/phone/receive',
body=params,
headers={'Content-Type': 'application/json; charset=utf-8', 'channelid': 'OP0001', 'token': token,
'txntime': txntime, 'sign': sign})
response = conn.getresponse()
if response.status == 200:
res2 = response.read().decode('utf8')
data = json.loads(res2)
print(data)
print(data['rtnMsg'])
if data['rtnCode'] == '899993':
token = getToken()
if data['rtnCode'] == '000000':
print(data)
exit()
time.sleep(1)
conn.close()
def fail(code):
print('Fail: ' + code)
exit()
if __name__ == '__main__':
main()
Python
1
https://gitee.com/gsls200808/99shou.git
git@gitee.com:gsls200808/99shou.git
gsls200808
99shou
99shou
master

搜索帮助