通过源码可以得到以下MatchPlayInfo序列的生成代码

const protobuf = require("protobufjs");
var i = protobuf.Reader, a = protobuf.Writer, r = protobuf.util;
MatchStepInfo = function () {function t(t) {if (t)for (var e = Object.keys(t), o = 0; o < e.length; ++o) null != t[e[o]] &&(this[e[o]] = t[e[o]])}return t.prototype.chessIndex = 0, t.prototype.timeTag = 0, t.create = function (e) {return new t(e)}, t.encode = function (t, e) {return e || (e = a.create()), null != t.chessIndex && Object.hasOwnProperty.call(t, "chessIndex") && e.uint32(8).int32(t.chessIndex), null !=t.timeTag && Object.hasOwnProperty.call(t, "timeTag") && e.uint32(16).int32(t.timeTag), e}, t.decode = function (t, e) {t instanceof i || (t = i.create(t));for (var o = void 0 === e ? t.len : t.pos + e, n = new MatchStepInfo; t.pos < o;) {var a = t.uint32();switch (a >>> 3) {case 1:n.chessIndex = t.int32();break;case 2:n.timeTag = t.int32();break;default:t.skipType(7 & a)}}return n}, t
}(), MatchPlayInfo = function () {function t(t) {if (this.stepInfoList = [], t)for (var e = Object.keys(t), o = 0; o < e.length; ++o) null != t[e[o]] &&(this[e[o]] = t[e[o]])}return t.prototype.gameType = 0, t.prototype.mapId = 0, t.prototype.mapSeed = 0,t.prototype.stepInfoList = r.emptyArray, t.create = function (e) {return new t(e)}, t.encode = function (t, e) {if (e || (e = a.create()), null != t.gameType && Object.hasOwnProperty.call(t, "gameType") && e.uint32(8).int32(t.gameType), null != t.mapId &&Object.hasOwnProperty.call(t, "mapId") && e.uint32(16).int32(t.mapId),null != t.mapSeed && Object.hasOwnProperty.call(t, "mapSeed") && e.uint32(24).int32(t.mapSeed), null != t.stepInfoList && t.stepInfoList.length)for (var o = 0; o < t.stepInfoList.length; ++o) MatchStepInfo.encode(t.stepInfoList[o], e.uint32(34).fork()).ldelim();return e}, t.decode = function (t, e) {t instanceof i || (t = i.create(t));for (var o = void 0 === e ? t.len : t.pos + e, n = new MatchPlayInfo; t.pos < o;) {var a = t.uint32();switch (a >>> 3) {case 1:n.gameType = t.int32();break;case 2:n.mapId = t.int32();break;case 3:n.mapSeed = t.int32();break;case 4:n.stepInfoList && n.stepInfoList.length || (n.stepInfoList = []),n.stepInfoList.push(MatchStepInfo.decode(t,t.uint32()));break;default:t.skipType(7 & a)}}return n}, t
}()
var operationList = []
function addOp(t, e) { //增加操作void 0 === e && (e = -100);var o = {id: t, // 操作卡片的id,从levelData第一层开始按顺序编号time: Date.now() // 操作时间};operationList.push(o)
}
function sleep(delay) {for (var t = Date.now(); Date.now() - t <= delay;);
}
let range = n => [...Array(n).keys()]
for (let i of range(50)) { // 生成了50次操作addOp(i);sleep(Math.random() * 10); // 模拟操作过程中的等待
}
console.log(operationList)
for (var u = operationList, p = [], d = 0, h = 0; h < u.length; h++) // 把时间戳转换为两次操作的间隔p.push({ chessIndex: u[h].id, timeTag: 0 == d ? 0 : u[h].time - d }), d = u[h].time;
console.log(p)
GAMEDAILY = 3
GAMETOPIC = 4
for (var f = { gameType: GAMEDAILY, stepInfoList: p }, y = MatchPlayInfo.create(f), v = MatchPlayInfo.encode(y).finish(), b = "", _ = 0; _ < v.length; _++)b += String.fromCharCode(v[_]); // 序列化
var data = Buffer.from(b).toString('base64');
console.log(data);
data = Buffer.from(data, 'base64');
console.log(data);
console.log(MatchPlayInfo.decode(data));

分析一下MatchPlayInfo的生成操作
首先可以得知MatchPlayInfo是由stepInfoList和gameType组成的,stepInfoList里有两个参数分别是chessIndex和timeTag,分别记录点击卡片id和两次操作间隔
观察MatchPlayInfo.encode可以看到

e = a.create()

会创建一个protobuf.Writer对象

e.uint32(8).int32(t.gameType)

会创建序列"\x08\x03",虽然写着是32但是经过调试发现是1字节的,不知道是为什么

MatchStepInfo.encode(t.stepInfoList[o], e.uint32(34).fork()).ldelim()

这里首先插入1字节34变成"\x08\x03\x22",接着fork函数会生成一个分叉,类似于git等待处理完这个分支后调用ldelim就会把当前分支上内容的长度和内容合并回主分支,分析MatchStepInfo.encode后可以得知会插入4个字节,分别是[8,chessIndex,16,timeTag],此时序列就是"\x08\x03\x22"+“\x04”+“\x08\x00\x10\x00”=“\x08\x03\x22\x04\x08\x00\x10\x00”,
重复这个过程把stepInfoList里的chessIndex和timeTag循环增加到序列,可以得知生成过程是MatchPlayInfo=“\x08\x03“+(”\x04\x08\x??\x10\x??"*卡牌个数)


然而生成的序列无法增加通关次数,研究了一下发现stepInfoList里的值大于127的数值是错误的,不知道是什么原因,于是过滤掉大于127的数可以成功增加通关次数!!!

下面代码,替换’t’值,放python直接跑,就能增加通关次数

import struct
import base64
import requests
# 安装依赖 pip install requests
# 苹果手机抓包,商城下载Stream,证书配置参考(https://blog.csdn.net/weixin_44504146/article/details/121946958),Stream点击开始抓包,打开微信小程序-羊了个羊,开始游戏,打开Stream,停止抓包。
# Stream查看抓包历史,打开最新记录,找到"cat-match.easygame2021.com/sheep/v1/",点击进入详情,再点击请求选项。
# 't'值就是t:后面的那一段。到conntent-type之前结束。headers = {'t':'','User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.27(0x18001b37) NetType/4G Language/zh_CN','Referer': 'https://servicewechat.com/wx141bfb9b73c970a9/23/page-frame.html'
}
url = 'https://cat-match.easygame2021.com/sheep/v1/game/personal_info?'
r = requests.get(url, headers=headers)
print(r.json())
url = 'https://cat-match.easygame2021.com/sheep/v1/game/map_info_ex?matchType=3'
r = requests.get(url, headers=headers)
map_md5 = r.json()['data']['map_md5'][1]
url = f'https://cat-match-static.easygame2021.com/maps/{map_md5}.txt'  # 由于每天获取的地图不一样,需要计算地图大小
r = requests.get(url)
levelData = r.json()['levelData']
p = []
for h in range(len(sum(levelData.values(), []))):  # 生成操作序列p.append({'chessIndex': 127 if h > 127 else h, 'timeTag': 127 if h > 127 else h})
GAME_DAILY = 3
GAME_TOPIC = 4
data = struct.pack('BB', 8, GAME_DAILY)
for i in p:c, t = i.values()data += struct.pack('BBBBBB', 34, 4, 8, c, 16, t)
MatchPlayInfo = base64.b64encode(data).decode('utf-8')
print(MatchPlayInfo)
# 每日通关
url = 'https://cat-match.easygame2021.com/sheep/v1/game/game_over_ex?'
r = requests.post(url, headers=headers,json={'rank_score': 1, 'rank_state': 1, 'rank_time': 1663723, 'rank_role': 1, 'skin': 7,'MatchPlayInfo': MatchPlayInfo})
print(r.json())
url = 'https://cat-match.easygame2021.com/sheep/v1/game/personal_info?'
r = requests.get(url, headers=headers)
print(r.json())

[python] ylgy攻略 用魔法打败魔法相关推荐

  1. python自学攻略-Python自学攻略

    原标题:Python自学攻略 在过去的十年里,随着自动化技术的出现,科技最终成为杰出的金融机构,银行,保险和投资公司,股票交易公司,对冲基金,券商等公司的一部分.根据2013年的Crosman 报告, ...

  2. 超全python自学攻略,人工智能的首选语言

    Python 被称为是最接近 AI(人工智能) 的语言,也被称为是最简洁的语言.在程序员的世界中,有句话广为流传:"人生苦短,我用 Python ".这句话非常形象地说出了 Pyt ...

  3. Python爬虫攻略(1)使用Requests获取LOL游戏攻略

    申明:本文对爬取的数据仅做学习使用,不涉及任何商业活动,侵删 Python爬虫教程>1 使用Requests获取LOL游戏攻略 前戏 如果你想先了解一下什么是爬虫, 建议看一下这篇文章:学习爬虫 ...

  4. 用魔法打败魔法!这件毛衣让摄像头看不到你;两款酷炫的AI写作软件;基于深度学习扩散模型的蛋白质设计;Codon开源Python编译器;基于AI生成连贯的剧本 | ShowMeAI资讯日报

  5. [Python] Codecombat攻略 远边的森林 Forest (1-40关)

    首页:https://cn.codecombat.com/play 语言:Python 第二界面:远边的森林Forest(40关) 时间:2-6小时 内容:if/else.关系操作符.对象属性.处理输 ...

  6. [Python] Codecombat 攻略 Sarven 沙漠 (1-43关)截止至36关

    首页:https://cn.codecombat.com/play 语言:Python 第二界面:Sarven沙漠(43关) 时间:4-11小时 内容:算术运算,计数器,while循环,break(跳 ...

  7. Python数据攻略-Pandas数据分组GroupBy

    大家好,我是Mr数据杨.今天我们将一同走进充满数字的Python世界,我想拿<三国演义>的例子来阐述一下学习笔记中的主题. 首先得有数据.试想一下,如果三国的谋士们如诸葛亮,郭嘉,周瑜,手 ...

  8. Python数据攻略-Pandas数据重塑及透视表

    大家好,我是Mr数据杨.让我们一起走进Python的世界,揭开它在数据处理中的神秘面纱.让我带你走进<三国演义>,看看Python在三国演义中的应用.想象一下,假如诸葛亮在草船借箭这个计划 ...

  9. Python数据攻略-Pandas数据处理加速技巧

    大家好,我是Mr数据杨.想象一下三国时代,郭嘉如何制定天下大计,周瑜如何破敌一击,他们都不是一步步走来的,而是精心准备.周全考虑的.同样,在Python中,数据准备也是至关重要的第一步,就像筹备一场战 ...

  10. [Python] Codecombat 攻略 地牢 Kithgard (1-22关)

    首页:https://cn.codecombat.com/play 语言:Python 第一界面:地牢 Kithgard(22关) 时间:1-3小时 内容:语法.方法.参数.字符串.循环.变量等 网页 ...

最新文章

  1. 快速人群密度估计--Multi-scale Convolutional Neural Networks for Crowd Counting
  2. 将ubuntu光盘作为安装源_[转载]Ubuntu 以光盘做为软件源
  3. 在用虚拟机做Windows Server 2008 R2实验时应注意的问题
  4. hadoop 9000端口的服务未启动_IDEA 微服务单项目多端口启动
  5. 自动校验控件演示[含源码]
  6. 为什么你闻不到自己胳肢窝的味道?
  7. Android dependency 'com.android.support:support-v4' has different version for the compile (26.1.0...
  8. 诺贝尔得主没钱付医药费 凄凉离世
  9. Navicat for Mysql 新建查询提示文件找不到
  10. cisco 2960 VLAN MAC_Mac翻译系列软件推荐一:欧路词典 for Mac
  11. 共建公安标准体系 | 七牛云与锐安科技达成深度战略合作
  12. 在 SharePoint 2010 中访问数据
  13. SQL开发技巧(二) 【转】感觉他写的很好
  14. eclipse可视化插件
  15. 【Java算法】Java抽奖算法,适用于各种抽奖
  16. SnowNLP简易教程:分词、词性标注、情感分析、繁体转换、关键字抽取、相似度计算
  17. 爱五笔iWuBi for mac(好用的五笔学习软件)
  18. 量子计算机宋超,蒿杰团队实感计算架构助力20超导量子比特薛定谔猫态制备-资讯-知识分子...
  19. Requested setting DATABASES, but settings are not configured. You must either define the environment
  20. Ubuntu 解压 zip、z01、z02等文件方法

热门文章

  1. Google浏览器调试页面时设置分辨率
  2. 微型计算机控制第三版,清华大学出版社-图书详情-《微型计算机控制技术(第3版)》...
  3. NSCTF-Reverse02 超级详细且简单的办法搞定
  4. 【sketchup 2021】草图大师的高级工具使用3【复杂贴图制作实例(山体和球面贴图、全景天空绘制、吊顶添加光带)、图层(标记)工具使用、视图与样式工具的常规使用与高级使用说明】
  5. mysql安装教程 2018_sql server 2018下载
  6. 荷兰国旗问题+快速排序
  7. HTML5期末大作业:家乡网站设计——石家庄(10页) HTML+CSS+JavaScrip 旅游网页html 家乡介绍html网页设计 dw旅游景点网页设计 web课程设计网页规划与设计
  8. 从实战进阶系列之DNF脚本实战
  9. 代码不止|想制胜海外市场?Google 来帮你!
  10. 计算机毕业设计ssm高校选课系统uu27m系统+程序+源码+lw+远程部署