破解东航的seriesid
- 2020 年 7 月 30 日
- 筆記
在查询东航航班的时候,请求数据中有个seriesid
调试js分析代码的过程就略过了,下面是整合的生成seriesid 的js代码
<script> function get_n(e, t) { for (var n = [], r = 0; r < 256; ++r) n[r] = (r + 256).toString(16).substr(1); return n } /////////////////////////////////////////////////////////////////////// function a(e, t) { var r = t || 0, o = get_n(); return [o[e[r++]], o[e[r++]], o[e[r++]], o[e[r++]], "-", o[e[r++]], o[e[r++]], "-", o[e[r++]], o[e[r++]], "-", o[e[r++]], o[e[r++]], "-", o[e[r++]], o[e[r++]], o[e[r++]], o[e[r++]], o[e[r++]], o[e[r++]]].join("") } /////////////////////////////////////////////////////////////////// var n = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto); var r = new Uint8Array(16); function i() { return n(r), r } ///////////////////////////////////////////////////////////////// var o; var s = 0, u = 0; function rrr(e, t, n) { var l = t && n || 0, c = t || [], f = (e = e || {}).node || r, d = void 0 !== e.clockseq ? e.clockseq : o; if (null == f || null == d) { var p = i(); null == f && (f = r = [1 | p[0], p[1], p[2], p[3], p[4], p[5]]), null == d && (d = o = 16383 & (p[6] << 8 | p[7])) } var h = void 0 !== e.msecs ? e.msecs : (new Date).getTime(), m = void 0 !== e.nsecs ? e.nsecs : u + 1, y = h - s + (m - u) / 1e4; if (y < 0 && void 0 === e.clockseq && (d = d + 1 & 16383), (y < 0 || h > s) && void 0 === e.nsecs && (m = 0), m >= 1e4) throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); s = h, u = m, o = d; var v = (1e4 * (268435455 & (h += 122192928e5)) + m) % 4294967296; c[l++] = v >>> 24 & 255, c[l++] = v >>> 16 & 255, c[l++] = v >>> 8 & 255, c[l++] = 255 & v; var g = h / 4294967296 * 1e4 & 268435455; c[l++] = g >>> 8 & 255, c[l++] = 255 & g, c[l++] = g >>> 24 & 15 | 16, c[l++] = g >>> 16 & 255, c[l++] = d >>> 8 | 128, c[l++] = 255 & d; for (var b = 0; b < 6; ++b) c[l + b] = f[b]; return t || a(c) } //////////////////////////////////////////////// function test() { return rrr().replace(/-/g, "") } res = test() console.log(res) </script>
但是有个坑,我在使用鬼鬼js调试工具的时候,一直报’Uint8Array’ 未定义,但是我在浏览器console面板上定义 new Uint8Array(16) 的时候,是不报错的
于是我使用vscode和js在线调试工具试了一下,正常运行,搞不清楚是什么原因,但是最终确实是拿到seriesid的值了