破解東航的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的值了