Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1060

find key in player.min.js to decode string

$
0
0

i am doing reverse engineering on a website which stream videos and found out that website is sending ajax request to fetch source of video and subtitles it is like this

{"sources": "U2FsdGVkX1+Wae4N+dwxRxDedq3oFyagvPXfgU03WU5zvCnngdfMGsc9xXpCQfbuJlnTKXz6Ls20h2wNCCp7DcgJXjaglKKZZuuSId3k+Y5t2VyQ5OhPnZV7Goh1ftiwuEYIIfTPbpLdfon1+LIDRhoiA2FqVJBXgGJ3ocDMxuOuTO7mHr2Zi1ExHTyxta6PIXCLRBLYqzkNSS+CNUKmywB54TBcjyscBXOdaAyDaTjJoF0B4g1b7dTcg8hdSNQn40f2SJMheVI151vLrRi7TE1OCE+2+jr1Sx51px6dRbgn38sK4RJxWvQVZV+f803mMCSpB8XY89LyH6b9aBAwyJgmKSt+oAkhBdcAmXtPH5m5pHrYKlgEGg9Z7T5qr38iEkSujJpQ0TgsLFXE9h09F2By8XUyW2yC6LJHpBpAFIb2+hhedGk0WS3HZLmMNEBTvDt5NnWd4BAtt6+FpGJsnTt0KFQ4PXgjScHJKgImNpg9uS6uyY4B3APNtOi/L7bWDZ16EGhTi+I+wlScv5oShuypamUWp","tracks": [    {"file": "https://cc.2cdns.com/8c/20/8c20331ffd2997b702ef06421609d381/eng-2.vtt","label": "English","kind": "captions","default": true    },    {"file": "https://cc.2cdns.com/8c/20/8c20331ffd2997b702ef06421609d381/eng-3.vtt","label": "English - English (CC)","kind": "captions"    },  ],"encrypted": true,"server": 29}

and here sources is an encoded string and after doing some research i found out they are using AES encryption and they are using key to decode which is in player.min.js or they are generating key in that file this file is minified and it's headers are

content-encoding:brcontent-type:application/javascript; charset=UTF-8

I used unminify and result is like this

function P(t, B) {    var E = W();    return (        (P = function (b, i) {            b = b - 0x7b;            var S = E[b];            if (P["JAQmvP"] === undefined) {                var G = function (v) {                    var q = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=";                    var X = "",                        O = "";                    for (var Y = 0x0, H, y, w = 0x0; (y = v["charAt"](w++)); ~y && ((H = Y % 0x4 ? H * 0x40 + y : y), Y++ % 0x4) ? (X += String["fromCharCode"](0xff & (H >> ((-0x2 * Y) & 0x6)))) : 0x0) {                        y = q["indexOf"](y);                    }                    for (var f = 0x0, d = X["length"]; f < d; f++) {                        O += "%" + ("00" + X["charCodeAt"](f)["toString"](0x10))["slice"](-0x2);                    }                    return decodeURIComponent(O);                };                (P["vtivXi"] = G), (t = arguments), (P["JAQmvP"] = !![]);            }            var T = E[0x0],                p = b + T,                c = t[p];            return !c ? ((S = P["vtivXi"](S)), (t[p] = S)) : (S = c), S;        }),        P(t, B)    );}(function (t, B) {    function SS(t, B) {        return P(B - 0x3e8, t);    }    function Si(t, B) {        return J(B - 0x28, t);    }    function Sb(t, B) {        return C(B - -0x29, t);    }    var E = t();    while (!![]) {        try {            var b =                (-parseInt(Sb("a52$", 0x74c)) / 0x1) * (parseInt(Si(0xd0b, 0x78c)) / 0x2) +                (parseInt(Sb("evHJ", 0xac2)) / 0x3) * (-parseInt(Sb("4Nr5", 0xb12)) / 0x4) +                parseInt(SS(0x44, 0x8e2)) / 0x5 +                (parseInt(SS(0x1894, 0x135b)) / 0x6) * (-parseInt(Sb("CoF$", 0x5a0)) / 0x7) +                parseInt(Si(0xd9, 0x26e)) / 0x8 +                (parseInt(SS(0xe07, 0x9ee)) / 0x9) * (-parseInt(Si(0xac6, 0x246)) / 0xa) +                (-parseInt(Sb("2vY(", 0x448)) / 0xb) * (-parseInt(Sb("M[Gg", 0x702)) / 0xc);            if (b === B) break;            else E["push"](E["shift"]());        } catch (i) {            E["push"](E["shift"]());        }    }})(W, 0x44fea),    (!(function (tx, tj) {        function th(iy, iw) {            function SG(t, B) {                return P(t - -0x4, B);            }            return iw[SG(0x464, 0xd3b)]();        }        function tm() {            function Sc(t, B) {                return C(B - -0x27c, t);            }            function ST(t, B) {                return P(t - 0x24b, B);            }            function Sp(t, B) {                return J(t - 0x325, B);            }            tZ[ST(0xd34, 0x8b4)] ? (tZ[ST(0xc4f, 0x608)](Sp(0x11ae, 0x12a4), BG, !0x1), tx[Sc("&%kp", 0x5a5)](Sc("#]pw", 0x435), BG, !0x1)) : (tZ[Sc("LZ0(", 0x5da)](Sp(0x1401, 0xf4a), BG), tx[ST(0x4c3, 0x8e5)]("onload", BG));        }        var tD,            tQ = typeof tj,            tZ = tx[Sv(0xc03, 0x10e8)],            tW = tx[Sv(-0x638, 0x15b)],            tJ = tx[Sv(0x1a3, 0x3ee)],            tP = tx["$"],            tC = {},            tg = [],            tL = Sv(0xd0f, 0x809),            ts = tg[Sq(-0x61b, -0x4c)],            tF = tg[SX("1xgS", 0x1d2)],            tU = tg[Sq(0x838, -0x7a)],            to = tg[Sq(0x179, -0x54)],            B0 = tC["toString"],            B1 = tC[Sv(0x488, 0x41a)],            B2 = tL[Sq(0xeca, 0xdd3)],            B3 = function (iy, iw) {                return new B3["fn"]["init"](iy, iw, Bp);            },            B4 = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/[Sq(0x182, 0x27b)],            B5 = /\S+/g,            B6 = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,            B7 = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,            B8 = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,            B9 = /^[\],:{}\s]*$/,            BB = /(?:^|:|,)(?:\s*\[)+/g,            BE = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,            Bb = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,            Bi = /^-ms-/,            BS = /-([\da-z])/gi,            BG = function (iy) {                function SY(t, B) {                    return Sq(t, B - 0xeb);                }                function SO(t, B) {                    return SX(B, t - 0x463);                }                function SH(t, B) {                    return Sv(B, t - -0x2cd);                }                (!tZ[SO(0x99f, "0&%k")] && SY(0x11d3, 0xddd) !== iy[SH(-0x191, -0x1ad)] && SH(0xe96, 0x69e) !== tZ[SO(0xb54, "TnUj")]) || (tm(), B3[SH(0xd70, 0xccd)]());            };        function BT(iy) {            function Sy(t, B) {                return Sq(t, B - 0x526);            }            var iw = iy["length"],                ik = B3[Sy(0x668, 0x315)](iy);            function Sw(t, B) {                return Sv(B, t - -0x16b);            }            return !B3[Sy(0x116a, 0x146b)](iy) && (!(0x1 !== iy[Sw(0x388, 0x1fb)] || !iw) || "array" === ik || (Sw(0x184, -0xe3) !== ik && (0x0 === iw || ("number" == typeof iw && 0x0 < iw && iw - 0x1 in iy))));        }        (B3["fn"] = B3[SX("Hl7h", 0xbde)] = {            jquery: tL,            constructor: B3,            init: function (iy, iw, ik) {                function Sk(t, B) {                    return Sq(B, t - 0x74);                }                var iu, iV;                function Sd(t, B) {                    return Sv(t, B - 0x2fc);                }                if (iy) {                    if (Sf("a52$", 0xfa2) != typeof iy)                        return iy[Sd(0x67, 0x7ef)]                            ? ((this[Sd(0x159e, 0x1177)] = this[0x0] = iy), (this[Sd(0x162d, 0x1188)] = 0x1), this)                            : B3[Sk(-0x3f, -0x5ac)](iy)                            ? ik[Sd(0xcb8, 0x1339)](iy)                            : (iy["selector"] !== tj && ((this[Sk(0x33a, 0xc1e)] = iy[Sk(0x33a, 0x196)]), (this["context"] = iy["context"])), B3[Sf("%y2K", 0xcf9)](iy, this));                    if (!(iu = "<" === iy["charAt"](0x0) && ">" === iy[Sk(0x886, 0x1fe)](iy[Sf("evHJ", 0x115)] - 0x1) && 0x3 <= iy[Sf("hbSa", 0xc6e)] ? [null, iy, null] : B7[Sf("T2%Q", 0x128)](iy)) || (!iu[0x1] && iw))                        return (!iw || iw[Sf("9dAZ", 0x1224)] ? iw || ik : this[Sk(-0x14a, -0x364)](iw))[Sf("HCSw", 0x2b0)](iy);                    if (iu[0x1]) {                        if (                            ((iw = iw instanceof B3 ? iw[0x0] : iw),                            B3["merge"](this, B3[Sk(0xd38, 0xe72)](iu[0x1], iw && iw[Sd(0x2c2, 0x7ef)] ? iw[Sd(0xb7c, 0xe9b)] || iw : tZ, !0x0)),                            B8[Sf("KYF(", 0x889)](iu[0x1]) && B3["isPlainObject"](iw))                        ) {                            for (iu in iw) B3[Sf("VUmD", 0x115c)](this[iu]) ? this[iu](iw[iu]) : this["attr"](iu, iw[iu]);                        }                    } else {                        if ((iV = tZ[Sf("%y2K", 0x26f)](iu[0x2])) && iV["parentNode"]) {                            if (iV["id"] !== iu[0x2]) return ik["find"](iy);                            (this[Sd(0xce3, 0x1188)] = 0x1), (this[0x0] = iV);                        }                        (this[Sd(0x13c1, 0x1177)] = tZ), (this[Sd(0xd97, 0xd71)] = iy);                    }                }                function Sf(t, B) {                    return SX(t, B - 0x228);                }                return this;            },            selector: "",            length: 0x0,            size: function () {                function Su(t, B) {                    return Sq(t, B - 0x302);                }                return this[Su(0x10ec, 0xfe5)];            },            toArray: function () {                function SV(t, B) {                    return Sq(t, B - 0x67f);                }                return tU[SV(0x14eb, 0xf8c)](this);            },            get: function (iy) {                function Sr(t, B) {                    return Sq(B, t - 0x84);                }                function SR(t, B) {                    return SX(t, B - 0x24e);                }                return null == iy ? this[Sr(0x35d, -0x2ee)]() : iy < 0x0 ? this[this[SR("evHJ", 0x13b)] + iy] : this[iy];            },            pushStack: function (iy) {                iy = B3[Sl(0x9c7, "QLs)")](this["constructor"](), iy);                function Se(t, B) {                    return Sq(B, t - 0x2c1);                }                function Sl(t, B) {                    return SX(B, t - 0x2c5);                }                return (iy[Se(0xfe6, 0x13fc)] = this), (iy[Sl(0xe74, "zeT$")] = this[Se(0xc36, 0xfc2)]), iy;            },            each: function (iy, iw) {                return B3["each"](this, iy, iw);            },            ready: function (iy) {                function SM(t, B) {                    return SX(t, B - -0x92);                }                return B3["ready"][SM("Ovtz", 0x9c4)]()["done"](iy), this;            },            slice: function () {                function SI(t, B) {                    return Sv(t, B - 0x3cb);                }                return this[SI(0x759, 0x939)](tU["apply"](this, arguments));            },            first: function () {                return this["eq"](0x0);            },            last: function () {                return this["eq"](-0x1);            },            eq: function (iy) {                var iw = this[SN("@T%s", -0x128)],                    iy = +iy + (iy < 0x0 ? iw : 0x0);                function SN(t, B) {                    return SX(t, B - 0x10);                }                function Sa(t, B) {                    return Sq(t, B - 0x59d);                }                return this[Sa(0xf8d, 0xc6b)](0x0 <= iy && iy < iw ? [this[iy]] : []);            },            map: function (iy) {                function Sz(t, B) {                    return Sq(t, B - -0xeb);                }                return this[Sz(0x621, 0x5e3)](                    B3["map"](this, function (iw, ik) {                        function SK(t, B) {                            return P(B - 0x11b, t);                        }                        return iy[SK(0x984, 0x1053)](iw, ik, iw);                    })                );            },            end: function () {                function SA(t, B) {                    return SX(B, t - 0x418);                }                function Sx(t, B) {                    return Sq(B, t - 0x60b);                }                return this[SA(0xeb5, "HCSw")] || this[Sx(0x44d, 0x943)](null);            },            push: tF,            sort: [][Sv(0x2bc, 0xacf)],            splice: [][Sv(0x441, 0x9ac)],        }),            (B3["fn"]["init"][SX("Z[cy", 0x25a)] = B3["fn"]),            (B3[Sv(0x2ac, 0x7d8)] = B3["fn"][Sq(0x4e4, 0xc87)] = function () {                var iy,                    iw,                    ik,                    iu,                    iV,                    ir = arguments[0x0] || {},                    iR = 0x1,                    il = arguments[Sj(0x11a5, 0x18c6)],                    iM = !0x1;                function Sh(t, B) {                    return Sq(B, t - 0x164);                }                for (Sj(0x357, 0x33f) == typeof ir && ((iM = ir), (ir = arguments[0x1] || {}), (iR = 0x2)), Sh(0xe6b, 0xa23) == typeof ir || B3["isFunction"](ir) || (ir = {}), il === iR && ((ir = this), --iR); iR < il; iR++)                    if (null != (iu = arguments[iR])) {                        for (ik in iu)                            (iV = ir[ik]),                                (iw = iu[ik]),                                ir !== iw &&                                    (iM && iw && (B3[Sh(0x36f, 0x497)](iw) || (iy = B3["isArray"](iw)))                                        ? ((iV = iy ? ((iy = !0x1), iV && B3["isArray"](iV) ? iV : []) : iV && B3["isPlainObject"](iV) ? iV : {}), (ir[ik] = B3[Sj(0xaf1, 0x26e)](iM, iV, iw)))                                        : iw !== tj && (ir[ik] = iw));                    }                function Sj(t, B) {                    return Sv(B, t - 0x319);                }                return ir;            }),            B3["extend"]({                noConflict: function (iy) {                    function SD(t, B) {                        return Sq(t, B - -0x12e);                    }                    function Sm(t, B) {                        return SX(t, B - 0x472);                    }                    return tx["$"] === B3 && (tx["$"] = tP), iy && tx[Sm("LZ0(", 0xa82)] === B3 && (tx[SD(0x794, 0xe55)] = tJ), B3;                },                isReady: !0x1,                readyWait: 0x1,                holdReady: function (iy) {                    function SQ(t, B) {                        return Sq(t, B - 0x5c2);                    }                    iy ? B3[SQ(0xdd7, 0x6d5)]++ : B3[SQ(0x1191, 0x1183)](!0x0);                },                ready: function (iy) {                    function SZ(t, B) {                        return SX(B, t - 0x3a2);                    }                    function SW(t, B) {                        return Sq(B, t - -0x127);                    }                    if (!0x0 === iy ? !--B3[SZ(0x49e, "jq#i")] : !B3[SW(0x8e1, 0x6e6)]) {                        if (!tZ[SW(0xb09, 0x106a)]) return setTimeout(B3["ready"]);                        ((B3[SZ(0xcdc, "stUl")] = !0x0) !== iy && 0x0 < --B3["readyWait"]) || (tD["resolveWith"](tZ, [B3]), B3["fn"][SW(0xf8, -0x51)] && B3(tZ)["trigger"](SZ(0xb2f, "stUl"))[SW(0x48d, 0x19)]("ready"));                    }                },                isFunction: function (iy) {                    function SJ(t, B) {                        return SX(t, B - 0x1c9);                    }                    return SJ(")V63", 0x9a5) === B3[SJ("CoF$", 0xe16)](iy);                },                isArray:                    Array[Sq(0x11e4, 0xe79)] ||                    function (iy) {                        function SP(t, B) {                            return Sq(t, B - 0x4e1);                        }                        return SP(0x16b5, 0x132e) === B3[SP(0x19, 0x2d0)](iy);                    },                isWindow: function (iy) {                    function SC(t, B) {                        return Sq(t, B - 0x10);                    }                    return null != iy && iy == iy[SC(0xf8b, 0xbb5)];                },                isNumeric: function (iy) {                    return !isNaN(parseFloat(iy)) && isFinite(iy);                },                type: function (iy) {                    function Sg(t, B) {                        return Sq(t, B - -0x135);                    }                    function SL(t, B) {                        return Sv(B, t - -0x2d1);                    }                    return null == iy ? iy +"" : Sg(0x31d, 0xbd2) == typeof iy || Sg(0x496, 0xcb3) == typeof iy ? tC[B0[SL(0xc03, 0x133b)](iy)] || "object" : typeof iy;                },                isPlainObject: function (iy) {                    if (!iy || Ss(0xc80, 0x7a3) !== B3[Ss(-0x298, -0x6d9)](iy) || iy[SF(0x785, 0x74b)] || B3[Ss(0xebe, 0x143b)](iy)) return !0x1;                    try {                        if (iy[SU(0x66f, "@T%s")] && !B1["call"](iy, SU(0xcea, "LZ0(")) && !B1[SU(0xbbe, ")V63")](iy[SU(0xf6e, "a52$")][SU(0x1008, "&YJx")], "isPrototypeOf")) return !0x1;                    } catch (ik) {                        return !0x1;                    }                    function SU(t, B) {                        return SX(B, t - 0xb8);                    }                    function Ss(t, B) {                        return Sq(B, t - -0x87);                    }                    for (var iw in iy);                    function SF(t, B) {                        return Sv(t, B - 0x258);                    }                    return iw === tj || B1[SU(0x289, "jsZE")](iy, iw);                },                isEmptyObject: function (iy) {                    for (var iw in iy) return !0x1;                    return !0x0;                },                error: function (iy) {                    throw Error(iy);                },                parseHTML: function (iy, iw, ik) {                    function Sn(t, B) {                        return SX(B, t - -0xff);                    }                    if (!iy || So(0xa46, 0xb3f) != typeof iy) return null;                    function So(t, B) {                        return Sv(t, B - -0x310);                    }                    So(-0x921, -0x2d2) == typeof iw && ((ik = iw), (iw = !0x1)), (iw = iw || tZ);                    var iu = B8[Sn(-0x1ff, "T2%Q")](iy),                        ik = !ik && [];                    function G0(t, B) {                        return Sq(t, B - 0x143);                    }                    return iu ? [iw[Sn(0xa43, "a52$")](iu[0x1])] : ((iu = B3[So(0x7d5, 0x444)]([iy], iw, ik)), ik && B3(ik)[So(-0x5f3, -0x4d)](), B3[G0(0x932, 0x459)]([], iu[Sn(0xd31, "Z[cy")]));                },                parseJSON: function (iy) {                    function G2(t, B) {                        return Sv(t, B - -0x76);                    }                    function G3(t, B) {                        return Sq(t, B - 0xd1);                    }                    function G1(t, B) {                        return SX(B, t - -0x1a2);                    }                    return tx[G1(0x818, "Ovtz")] && tx["JSON"][G1(0xca7, "&%kp")]                        ? tx[G2(0x9a0, 0xc57)][G3(0x10b1, 0xc0d)](iy)                        : null === iy                        ? iy                        : "string" == typeof iy && (iy = B3["trim"](iy)) && B9[G1(0x2c2, "QLs)")](iy[G2(0xf0b, 0xef3)](BE, "@")[G3(0x1a2, 0x774)](Bb, "]")[G1(0xabb, "HCSw")](BB, ""))                        ? Function(G1(0x503, "MtUi") + iy)()                        : (B3[G3(-0x266, -0xa2)](G3(0x382, 0x324) + iy), tj);                },                parseXML: function (iy) {                    var iw;                    if (!iy || G4(0x11b7, 0x1124) != typeof iy) return null;                    function G4(t, B) {                        return Sv(B, t - 0x368);                    }                    function G6(t, B) {                        return Sq(t, B - 0x4fe);                    }                    function G5(t, B) {                        return SX(t, B - -0x141);                    }                    try {                        tx[G5("cE0%", 0x569)] ? (iw = new DOMParser()[G4(0xb3c, 0xaf5)](iy, G5("4Nr5", 0x98b))) : (((iw = new ActiveXObject(G4(0xa3d, 0xde4)))[G4(0xd44, 0xcfc)] = G6(0xc0a, 0xfa6)), iw["loadXML"](iy));                    } catch (ik) {                        iw = tj;                    }                    return (iw && iw[G6(0xc11, 0x5a3)] && !iw[G6(0xf21, 0x142e)](G6(0x5f7, 0x816))[G6(0x1429, 0x11e1)]) || B3["error"]("Invalid\x20XML:\x20" + iy), iw;                },                noop: function () {},                globalEval: function (iy) {                    function G7(t, B) {                        return SX(B, t - -0x1cd);                    }                    iy &&                        B3[G7(0x9d2, "#]pw")](iy) &&                        (                            tx["execScript"] ||                            function (iw) {                                function G8(t, B) {                                    return P(t - -0xf9, B);                                }                                function G9(t, B) {                                    return J(B - -0x335, t);                                }                                tx[G8(0x131, 0x451)][G9(0xcf3, 0x876)](tx, iw);                            }                        )(iy);                },               .......

i can't understant the code properly i think it is still compressed/encoded what can i do to decompress/decode it to find key and decode sources string


Viewing all articles
Browse latest Browse all 1060

Trending Articles