目标:达人主页笔记翻页接口
打上xhr断点
断住后回溯堆栈,会发现直到异步堆栈为止参数都是已经生成的,那么进入异步堆栈打上断点
刷新页面发现参数已经生成,那么继续往下找堆栈
进入第二个异步。发现此时参数并未生成
异步调试技巧:看到.then,并且此时加密参数还未生成,可以点进.then第一个参数(函数),打上断点看运行情况。
进入p(d.fulfilled),在return处打上断点,跳过来,然后就一直按F8去跳,跳个几次吧(没数),会发现参数竟然加上了
那就在这个位置开始单步调试看看
方法:先F8,每次断在return位置的时候单步(F11)进去,进去后逐行执行(F10),看是否有可疑地方。这个过程中要注意堆栈参数e.headers是否有所需加密参数出现。重复几次操作你会发现,在进入下面这个代码之后参数就生成了
名字也很可疑,打上断点跳过来看看
仿佛勒住了命运的咽喉~
进入xsXt函数,单步执行
这不就来了吗家人们
javascript">l = (a && void 0 !== window._webmsxyw ? window._webmsxyw : encrypt_sign)(c, i) || {}
l就是我们所需要的x-s所在的对象
参数c:
参数i是undefined(post请求才有)
控制台跑一下看看
两个函数都可以生成xs,但是看长度明显window._webmsxyw才是我们需要的,点进去就是加密主要文件
看不懂?没关系,既然可以通过window调用,说明加密函数最终赋值给了全局window,那么我们只需要依葫芦画瓢,把整个js文件代码拷出,补上所需环境,再试着执行window._webmsxyw看是否有被赋值即可。
补环境过程不是本文重点就不阐述了,不然太长了文章,直接提供我补好的环境,脱敏部分自行去完善
javascript">window = globalThis
window.screen = {"availHeight": 1040,"availLeft": -1920,"availTop": -216,"availWidth": 1920,"colorDepth": 24,"height": 1080,"isExtended": true,"onchange": null,"pixelDepth": 24,"width": 1920,"orientation": {angle: 0, type: 'landscape-primary', onchange: null,}
}
window.indexedDB = {}
window.sdt_source_init = true
window.localStorage = {"b1b1": "1","XHS_STRATEGY_BOX": {"firstVisit-": false,"oneDayTriggerCount-noteDetailLogin": {"2024-07-11": "1"},"oneDayTriggerCount-activityPopup-web端开屏": {"2023-11-15": "1"},"totalTriggerCount-activityPopup-web端开屏": 1},"HOME_FEED_CURSOR_SCORE": 1.7258607409610028E9,"p1": 508,getItem: function getItem(x) {return null},removeItem: function removeItem(x) {},
};
window.WebGLRenderingContext = {getExtension: function () {},getParameter: function () {}
}
window.navigator = {plugins: {},webdriver: false,userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36',languages: ["zh-CN", "zh", "en"],appCodeName: "Mozilla",appName: "Netscape",appVersion: '5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36',platform: "Win32",vendorSub: "",productSub: '20030107',vendor: 'Google Inc.',maxTouchPoints: 0,hardwareConcurrency: 24,product: 'Gecko',language: 'zh-CN',pdfViewerEnabled: true,cookieEnabled: true,onLine: true,geolocation: {},webkitTemporaryStorage: {},webkitPersistentStorage: {},mimeTypes: {},connection: {},scheduling: function scheduling() {},getGamepads: function getGamepads() {},javaEnabled: function javaEnabled() {},sendBeacon: function sendBeacon() {},vibrate: function vibrate() {},managed: function managed() {},bluetooth: {},storage: {},ink: {},locks: {},hid: {onconnect: null, ondisconnect: null},deviceMemory: 8,serviceWorker: {},virtualKeyboard: {boundingRect: {}, overlaysContent: false, ongeometrychange: null},clipboard: {},wakeLock: {},credentials: {},keyboard: {},userActivation: {hasBeenActive: true, isActive: true}
};
window.sessionStorage = {sc: "56",length: 2,'__SPA_REFER__': 脱敏处理,自己去补全getItem: function (args) {return sessionStorage[args]},setItem: function (key, value) {sessionStorage[key] = value}
}
window.location = {脱敏处理,自己去补全
};
window.document = {createEvent: function createEvent() {},location: location,cookie: 脱敏处理,自己去补全,vlinkColor: "",referrer: '',fgColor: "",dir: "",addEventListener: function addEventListener(x) {},createElement: function createElement(x) {return canvas},documentElement: function documentElement(x) {},querySelectorAll: function () {}
};
timeStamp = new Date().getTime()
var canvas = {toDataURL: function toDataURL() {},getContext: function getContext(x) {},getAttribute: function getAttribute() {return null},
};
localStorage = {getItem: function getItem(x) {return null},removeItem: function removeItem(x) {}
};
先尝试打印一下
没问题,函数存在。然后尝试调用
这不就成了吗家人们
篇幅太长了,本着能水则水的原则,今天就到这里,x-s-common的逆向过程以及验证有效性咱放到下一篇