觅幂小程序全自动刷跑步

发布时间 2023-04-09 22:26:32作者: MouseBaby678

觅幂小程序全自动刷跑步

抓包工具:Quantumult X(IOS端),安卓可以用小黄鸟

1.使用Quantumult X抓包

通过抓包日志发现以下接口:

# 获取路线
https://admin.report.mestallion.com/api/mini/sport/getline
# 获取今日打卡信息
https://admin.report.mestallion.com/api/mini/sport/today
# 打卡操作
https://admin.report.mestallion.com/api/mini/sport/daka

请求头:

POST /api/mini/sport/getline HTTP/1.1
Host: admin.report.mestallion.com
Connection: keep-alive
Content-Length: 44
token: 5da629axxxxxxxxxxxxxxxxxd1b03b9
content-type: application/x-www-form-urlencoded
Accept-Encoding: gzip,compress,br,deflate
User-Agent: Mozilla/5.0 (iPad; CPU OS 16_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.34(0x18002230) NetType/WIFI Language/zh_CN
Referer: https://servicewechat.com/wx5069fcccc8151ce3/41/page-frame.html

可以发现该小程序通过token验证用户身份

getline接口:

请求体:
lat=36.56098415798611&lng=116.81043077256945
响应体:
{"data":null,"user":null,"code":200,"msg":""}

请求体包含用户的经纬度信息。

today接口:

响应体:
{
  "code" : 200,
  "data" : {
    "max1km" : 10,
    "min1km" : 4,
    "cronstate" : 0,
    "center_lat" : 36.55882785,
    "center_lng" : 116.81375269999999,
    "msg" : "",
    "zoom" : 15,
    "crontime" : 5,
    "line" : {
      "id" : 6794163,
      "state" : 1,
      "member" : 13305,
      "starttime" : "2023-04-08 16:49:14",
      "endtime" : null,
      "clock_in_total" : 3,
      "lines" : [
        {
          "id" : 41184922,
          "total_distence" : 0,
          "clock_in_time" : "2023-04-08 16:49:14",
          "point_id" : 38,
          "ble" : 0,
          "gps" : 1,
          "distence" : 0,
          "line_id" : 6794163,
          "bs_name" : "",
          "bs_id" : "",
          "lat" : 36.561094560000001,
          "point_name" : "三餐西南角",
          "lng" : 116.81054009,
          "create_time" : "2023-04-08 16:49:11"
        },
        {
          "id" : 41184923,
          "total_distence" : 956,
          "clock_in_time" : null,
          "point_id" : 42,
          "ble" : 0,
          "gps" : 1,
          "distence" : 956,
          "line_id" : 6794163,
          "bs_name" : "",
          "bs_id" : "",
          "lat" : 36.553384059999999,
          "point_name" : "学校南门",
          "lng" : 116.8113829,
          "create_time" : "2023-04-08 16:49:11"
        },
        {
          "id" : 41184924,
          "total_distence" : 2024,
          "clock_in_time" : null,
          "point_id" : 45,
          "ble" : 0,
          "gps" : 1,
          "distence" : 1068,
          "line_id" : 6794163,
          "bs_name" : "",
          "bs_id" : "",
          "lat" : 36.561674529999998,
          "point_name" : "1号公寓楼西侧",
          "lng" : 116.81370800000001,
          "create_time" : "2023-04-08 16:49:11"
        }
      ],
      "distence" : 15.685399727338453,
      "total" : 2024,
      "lat" : 36.560984157986113,
      "max_end_time" : "2023-04-08 17:09:28",
      "lng" : 116.81043077256945,
      "create_time" : "2023-04-08 16:49:11",
      "clock_in" : 1,
      "complete" : 0
    },
    "user" : {
      "id" : 13305,
      "clazz" : 446,
      "phone" : "",
      "head_img" : "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGx4ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132",
      "sport_count" : 19.789999999999999,
      "sex" : 1,
      "sport_num" : 11,
      "open_id" : "omyem4rslJxxxLrBKDI4DrsM",
      "sport_days" : 219,
      "xuehao" : "2021xxxxx010",
      "unionId" : "ofwq66WxTfzTbxxxW4tnBeR7PdU",
      "idcard" : "37xxxxxxxxxxx",
      "last_time" : "2023-04-08 16:49:14",
      "create_time" : "2022-09-01 10:19:59",
      "nickname" : "微信用户",
      "name" : "xxxxxx",
      "station" : 3
    }
  },
  "msg" : "",
  "user" : null
}

today的响应体中包含了路线信息(经纬度,id),和daka接口的请求体一致。

daka接口:

请求体:
ble=false&gps=false&lat=36.56098415798611&lng=116.81043077256945&bs_id=&bs_name=&id=41184922
响应体:
{
  "code" : 200,
  "data" : null,
  "msg" : "打卡成功!",
  "user" : null
}

请求体包含用户的经纬度和打卡点id。

简单分析一下抓包的信息,可以有一个简单的思路:

getline获取路线 --> today读取路线信息 --> daka接口请求经纬度进行打卡

2.编写代码

通过python的requests模块直接向服务端发起请求:

以geline为例,

headers = {
    "Accept-Encoding": "gzip,compress,br,deflate",
    "content-type": "application/x-www-form-urlencoded",
    "Connection": "keep-alive",
    "Referer": "https://servicewechat.com/wx5069fcccc8151ce3/41/page-frame.html",
    "Host": "admin.report.mestallion.com",
    "User-Agent": "Mozilla/5.0 (iPad; CPU OS 16_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.34(0x1800222f) NetType/WIFI Language/zh_CN",
    "token": token
}


def get_line():
    body = 'lat=' + str(lat + random.random() * 0.0001) + '&lng=' + str(lng + random.random() * 0.0001)
    x = requests.post(headers=headers, url="https://admin.report.mestallion.com/api/mini/sport/getline", data=body)
    time.sleep(1)
    print('状态码:{}'.format(x.status_code))
    print(x.json()['msg'])

详细代码见https://github.com/MouseBaby678/mimi_sport。