336 字
2 分钟
马蜂窝 sn参数
网址: 北京景点介绍,北京旅游景点,北京景点推荐 - 马蜂窝
景点接口: https://www.mafengwo.cn/ajax/router.php
目标参数: _sn
控制台无限debugger
这个应该是使用了 eval(‘debugger’) 或 setInterval(‘debugger’, sec) 进行的无限debugger, hook这两个方法即可
或者使用油猴插件: user-script/remove-limits/user-script.js at main · HL-Bo/user-script
使用永不在此停留 会导致浏览器特别卡
// 尝试禁用 debugger // 仅在 eval('debugger') 或 setInterval('debugger', sec) 构造前执行才能阻止 try { Function.prototype.$rl_constructor = Function.prototype.constructor; Function.prototype.constructor = function () { if (arguments && typeof arguments[0] === 'string') { if ('debugger' === arguments[0]) { console.debug('Disable an function which may execute debugger'); return; } } return Function.prototype.$rl_constructor.apply(this, arguments); }; } catch (error) { console.warn(error); } finally { }定位
翻页时会调用 router.php 接口, 其中包含_sn参数对接口做了签名


跟栈找调用, 找到这个cA函数, 发现第二次执行标记行时生成的_sn参数


混淆js: js.mafengwo.net/js/hotel/sign/index.js?1631273413
反混淆工具: JS : JavaScript 反混淆 / 反编译 / 解密在线工具 — 吾要是知

插庄记录日志点, 分析逻辑


所以接下来把这个hash函数还原即可, 本来想使用python算法还原的, 但是后面有个方法调用太大一坨js了, 还是把js扣下来执行js更快一点

还原测试与debug一致, 且接口测试可用即通过
