最近辞职在家,闲来无事注册了某袋鼠众包,租了个某租的电瓶
因为剩余电量还要打开app才能看到导致好几次中途路上没电。所以闲来无事抓包一下app做一个剩余电量提醒
先上成品图
准备工具:
- Rqable(抓包工具)
- pycharm
- BARK(推送工具)
- 环境:IOS
- 一颗灵活的大脑
抓包阶段就让我大吃一斤,死活抓不到剩余电量页面的包,尝试FD,再尝试查尔斯。就是抓不到。
尝试无果后突然想起来会不会是这个页面也不是刷新一次他就请求一次,而是隔几分钟请求一次。
于是更换安卓模拟器后成功抓到剩余电量的接口
经过多次测试后确定接口只验证token,那就非常好办了。
在ios设备上面登陆后点击我的-每日签到-就可以抓到token。直接上代码
最后直接在宝塔里面设置个定时任务,即可实现定时提醒
# -*- coding: UTF-8 -*-
import requests
import time
time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
headers = {
"User-Agent": "android/9/3.12.0",
"Connection": "Keep-Alive",
"Accept-Encoding": "gzip",
"Accept-Language": "zh-CN,zh;q=0.8",
"cid": "131",
"token": "只用替换这里",
"moduleType": "1",
"m_no": "48060d8458afe09e503471deef454546",
"d_id": "a6cafa9caf5510cbd99eb83e5ae3884aac6a56",
"platform": "android",
"model": "OPPO R9s",
"brand": "OPPO",
"appVersion": "3.12.0",
"deviceId": "a6cafa9caf5510cbd99eb83e5ae3884aac6a56",
"nonce": "282003891110431576494080a6cafa9caf5510c63872433",
"timestamp": "1695657282",
"timedifference": "0",
"sign": "66200ff421172aa616b1ccfd56e3ad7f"
}
cookies = {
"m_no": "48060d8458afe09e503471deef454546",
"nonce": "282003891110431576494080a6cafa9caf5510c63872433",
"d_id": "a6cafa9caf5510cbd99eb83e5ae3884aac6a56",
"token": "只用替换这里"
}
url = "https://appserver.zhizukj.com/ydb/app/server/v2/user/myEquipmentDetail.json"
response = requests.post(url, headers=headers, cookies=cookies).json()
a = response["data"]["volume"]
a1 = "剩余电量:" + str(a) + "%\n"
d1 = "更新时间:" + time
# d = f"剩余电量:{a}%\n{b}\n续航里程{c}\n更新时间:{time}"
d = a1 + d1
curl = "这里是推送地址" + str(d)
res = requests.get(curl)
|