微信跳一跳攻略

抓小程序的https包(Android使用packet capture,url包含wxagame)获得session_id,替换下面脚本中的session_id,修改action_data score字段(分数)。

依赖库:

  • requests
  • pycrypto
  • python3

注:截至发稿,对于score超过1k分,微信返回error 108,暂无解。

使用方法:python3 xxx.py

import requests
import json
import time
from Crypto.Cipher import AES
import base64

action_data = {
    "score": your scores,
    "times": 666,
    "game_data": "{}"
}

session_id = "your session id"

aes_key = session_id[0:16]
aes_iv  = aes_key

cryptor = AES.new(aes_key, AES.MODE_CBC, aes_iv)

str_action_data = json.dumps(action_data).encode("utf-8")
print("json_str_action_data ", str_action_data)

#Pkcs7
length = 16 - (len(str_action_data) % 16)
str_action_data += bytes([length])*length

cipher_action_data = base64.b64encode(cryptor.encrypt(str_action_data)).decode("utf-8")
print("action_data ", cipher_action_data)

post_data = {
  "base_req": {
    "session_id": session_id,
    "fast": 1,
  },
  "action_data": cipher_action_data
}

headers = {
    "charset": "utf-8",
    "Accept-Encoding": "gzip",
    "referer": "https://servicewechat.com/wx7c8d593b2c3a7703/3/page-frame.html",
    "content-type": "application/json",
    "User-Agent": "MicroMessenger/6.6.1.1200(0x26060130) NetType/WIFI Language/zh_CN",
    "Content-Length": "0",
    "Host": "mp.weixin.qq.com",
    "Connection": "Keep-Alive"
}

url = "https://mp.weixin.qq.com/wxagame/wxagame_settlement"


response = requests.post(url, json=post_data, headers=headers)
print(json.loads(response.text))

原作者:商雅森爱萝莉
原文链接:https://zhuanlan.zhihu.com/p/32473340

分享