【JS逆向】粉X网登陆 RSA加密

注意:文章内容仅用于学习和技术交流,如有侵权请联系我删除。

学者应洁身自好,切勿做出违法的事情,旨在提供逆向思路。

➣➣欢迎关注本人微信公众号:Anonymous NoteBook➣➣

分享好玩有趣的网络资源&软件工具~

分享各种技术性PDF资源/付费查询PDF资源~

分享各种编程语言、开发技术、分布式事务、大数据与云计算技术~

分享有关网络爬虫(Web爬虫逆向 | 安卓逆向)案例、数据挖掘、技术心得等~

aHR0cHM6Ly9mZW5iaS5jb20vcGFnZS9ob21l

问题描述:

通过查看请求接口,发现password为加密字段:

初步猜测为rsa加密。

逆向开始:

老方法,全局搜索”password“字段,出现两条数据:

 点进去看下:

此处为加密算法。

打断点,动态调试下,调用的是encrypt方法:

 继续跟进去:

看到publicKey,着实为RSA加密。

全局搜索 publicKey,可以看到该字段为事先定义的变量:

 继续跟进去匿名函数:

 进入到一个加密逻辑js文件:

这个文件里就是所有的加密逻辑,代码不多,直接全部拷贝下来到本地js文件。

代码稍作改动,就可以本地调试运行了。

 注意:当你调试本地js时,会出现一些未定义的变量,比如:windows、navigator,这个时候你只需要在本地自定义下就ok了

 然后运行js文件,发现不报错了,完美运行。

 我们通过py文件来模拟请求网站,验证数据是否正确。

 结果正常,看来我们的加密数据时正确的。

完整代码:

var window = {};
var navigator = {
    appName : "Netscape",
};
(function(av) {
        function l() {
            this.i = 0;
            this.j = 0;
            this.S = new Array()
        }
        function f(aI) {
            var aH, z, aG;
            for (aH = 0; aH < 256; ++aH) {
                this.S[aH] = aH
            }
            z = 0;
            for (aH = 0; aH < 256; ++aH) {
                z = (z + this.S[aH] + aI[aH % aI.length]) & 255;
                aG = this.S[aH];
                this.S[aH] = this.S[z];
                this.S[z] = aG
            }
            this.i = 0;
            this.j = 0
        }
        function b() {
            var z;
            this.i = (this.i + 1) & 255;
            this.j = (this.j + this.S[this.i]) & 255;
            z = this.S[this.i];
            this.S[this.i] = this.S[this.j];
            this.S[this.j] = z;
            return this.S[(z + this.S[this.i]) & 255]
        }
        l.prototype.init = f;
        l.prototype.next = b;
        function au() {
            return new l()
        }
        var O = 256;
        var n;
        var V;
        var ag;
        function d(t) {
            V[ag++] ^= t & 255;
            V[ag++] ^= (t >> 8) & 255;
            V[ag++] ^= (t >> 16) & 255;
            V[ag++] ^= (t >> 24) & 255;
            if (ag >= O) {
                ag -= O
            }
        }
        function U() {
            d(new Date().getTime())
        }
        if (V == null) {
            V = new Array();
            ag = 0;
            var K;
            if (navigator.appName == "Netscape" && navigator.appVersion < "5" && av.crypto) {
                var H = av.crypto.random(32);
                for (K = 0; K < H.length; ++K) {
                    V[ag++] = H.charCodeAt(K) & 255
                }
            }
            while (ag < O) {
                K = Math.floor(65536 * Math.random());
                V[ag++] = K >>> 8;
                V[ag++] = K & 255
            }
            ag = 0;
            U()
        }
        function E() {
            if (n == null) {
                U();
                n = au();
                n.init(V);
                for (ag = 0; ag < V.length; ++ag) {
                    V[ag] = 0
                }
                ag = 0
            }
            return n.next()
        }
        function aB(z) {
            var t;
            for (t = 0; t < z.length; ++t) {
                z[t] = E()
            }
        }
        function ah() {}
        ah.prototype.nextBytes = aB;
        var aC;
        var an = 244837814094590;
        var ac = ((an & 16777215) == 15715070);
        function ay(z, t, aG) {
            if (z != null) {
                if ("number" == typeof z) {
                    this.fromNumber(z, t, aG)
                } else {
                    if (t == null && "string" != typeof z) {
                        this.fromString(z, 256)
                    } else {
                        this.fromString(z, t)
                    }
                }
            }
        }
        function i() {
            return new ay(null)
        }
        function c(aI, t, z, aH, aK, aJ) {
            while (--aJ >= 0) {
                var aG = t * this[aI++] + z[aH] + aK;
                aK = Math.floor(aG / 67108864);
                z[aH++] = aG & 67108863
            }
            return aK
        }
        function aE(aI, aN, aO, aH, aL, t) {
            var aK = aN & 32767
                , aM = aN >> 15;
            while (--t >= 0) {
                var aG = this[aI] & 32767;
                var aJ = this[aI++] >> 15;
                var z = aM * aG + aJ * aK;
                aG = aK * aG + ((z & 32767) << 15) + aO[aH] + (aL & 1073741823);
                aL = (aG >>> 30) + (z >>> 15) + aM * aJ + (aL >>> 30);
                aO[aH++] = aG & 1073741823
            }
            return aL
        }
        function aD(aI, aN, aO, aH, aL, t) {
            var aK = aN & 16383
                , aM = aN >> 14;
            while (--t >= 0) {
                var aG = this[aI] & 16383;
                var aJ = this[aI++] >> 14;
                var z = aM * aG + aJ * aK;
                aG = aK * aG + ((z & 16383) << 14) + aO[aH] + aL;
                aL = (aG >> 28) + (z >> 14) + aM * aJ;
                aO[aH++] = aG & 268435455
            }
            return aL
        }
        if (ac && (navigator.appName == "Microsoft Internet Explorer")) {
            ay.prototype.am = aE;
            aC = 30
        } else {
            if (ac && (navigator.appName != "Netscape")) {
                ay.prototype.am = c;
                aC = 26
            } else {
                ay.prototype.am = aD;
                aC = 28
            }
        }
        ay.prototype.DB = aC;
        ay.prototype.DM = ((1 << aC) - 1);
        ay.prototype.DV = (1 << aC);
        var ae = 52;
        ay.prototype.FV = Math.pow(2, ae);
        ay.prototype.F1 = ae - aC;
        ay.prototype.F2 = 2 * aC - ae;
        var aj = "0123456789abcdefghijklmnopqrstuvwxyz";
        var al = new Array();
        var aw, x;
        aw = "0".charCodeAt(0);
        for (x = 0; x <= 9; ++x) {
            al[aw++] = x
        }
        aw = "a".charCodeAt(0);
        for (x = 10; x < 36; ++x) {
            al[aw++] = x
        }
        aw = "A".charCodeAt(0);
        for (x = 10; x < 36; ++x) {
            al[aw++] = x
        }
        function aF(t) {
            return aj.charAt(t)
        }
        function C(z, t) {
            var aG = al[z.charCodeAt(t)];
            return (aG == null) ? -1 : aG
        }
        function ab(z) {
            for (var t = this.t - 1; t >= 0; --t) {
                z[t] = this[t]
            }
            z.t = this.t;
            z.s = this.s
        }
        function o(t) {
            this.t = 1;
            this.s = (t < 0) ? -1 : 0;
            if (t > 0) {
                this[0] = t
            } else {
                if (t < -1) {
                    this[0] = t + DV
                } else {
                    this.t = 0
                }
            }
        }
        function e(t) {
            var z = i();
            z.fromInt(t);
            return z
        }
        function y(aK, z) {
            var aH;
            if (z == 16) {
                aH = 4
            } else {
                if (z == 8) {
                    aH = 3
                } else {
                    if (z == 256) {
                        aH = 8
                    } else {
                        if (z == 2) {
                            aH = 1
                        } else {
                            if (z == 32) {
                                aH = 5
                            } else {
                                if (z == 4) {
                                    aH = 2
                                } else {
                                    this.fromRadix(aK, z);
                                    return
                                }
                            }
                        }
                    }
                }
            }
            this.t = 0;
            this.s = 0;
            var aJ = aK.length
                , aG = false
                , aI = 0;
            while (--aJ >= 0) {
                var t = (aH == 8) ? aK[aJ] & 255 : C(aK, aJ);
                if (t < 0) {
                    if (aK.charAt(aJ) == "-") {
                        aG = true
                    }
                    continue
                }
                aG = false;
                if (aI == 0) {
                    this[this.t++] = t
                } else {
                    if (aI + aH > this.DB) {
                        this[this.t - 1] |= (t & ((1 << (this.DB - aI)) - 1)) << aI;
                        this[this.t++] = (t >> (this.DB - aI))
                    } else {
                        this[this.t - 1] |= t << aI
                    }
                }
                aI += aH;
                if (aI >= this.DB) {
                    aI -= this.DB
                }
            }
            if (aH == 8 && (aK[0] & 128) != 0) {
                this.s = -1;
                if (aI > 0) {
                    this[this.t - 1] |= ((1 << (this.DB - aI)) - 1) << aI
                }
            }
            this.clamp();
            if (aG) {
                ay.ZERO.subTo(this, this)
            }
        }
        function Q() {
            var t = this.s & this.DM;
            while (this.t > 0 && this[this.t - 1] == t) {
                --this.t
            }
        }
        function r(z) {
            if (this.s < 0) {
                return "-" + this.negate().toString(z)
            }
            var aG;
            if (z == 16) {
                aG = 4
            } else {
                if (z == 8) {
                    aG = 3
                } else {
                    if (z == 2) {
                        aG = 1
                    } else {
                        if (z == 32) {
                            aG = 5
                        } else {
                            if (z == 4) {
                                aG = 2
                            } else {
                                return this.toRadix(z)
                            }
                        }
                    }
                }
            }
            var aI = (1 << aG) - 1, aL, t = false, aJ = "", aH = this.t;
            var aK = this.DB - (aH * this.DB) % aG;
            if (aH-- > 0) {
                if (aK < this.DB && (aL = this[aH] >> aK) > 0) {
                    t = true;
                    aJ = aF(aL)
                }
                while (aH >= 0) {
                    if (aK < aG) {
                        aL = (this[aH] & ((1 << aK) - 1)) << (aG - aK);
                        aL |= this[--aH] >> (aK += this.DB - aG)
                    } else {
                        aL = (this[aH] >> (aK -= aG)) & aI;
                        if (aK <= 0) {
                            aK += this.DB;
                            --aH
                        }
                    }
                    if (aL > 0) {
                        t = true
                    }
                    if (t) {
                        aJ += aF(aL)
                    }
                }
            }
            return t ? aJ : "0"
        }
        function T() {
            var t = i();
            ay.ZERO.subTo(this, t);
            return t
        }
        function aq() {
            return (this.s < 0) ? this.negate() : this
        }
        function I(t) {
            var aG = this.s - t.s;
            if (aG != 0) {
                return aG
            }
            var z = this.t;
            aG = z - t.t;
            if (aG != 0) {
                return aG
            }
            while (--z >= 0) {
                if ((aG = this[z] - t[z]) != 0) {
                    return aG
                }
            }
            return 0
        }
        function k(z) {
            var aH = 1, aG;
            if ((aG = z >>> 16) != 0) {
                z = aG;
                aH += 16
            }
            if ((aG = z >> 8) != 0) {
                z = aG;
                aH += 8
            }
            if ((aG = z >> 4) != 0) {
                z = aG;
                aH += 4
            }
            if ((aG = z >> 2) != 0) {
                z = aG;
                aH += 2
            }
            if ((aG = z >> 1) != 0) {
                z = aG;
                aH += 1
            }
            return aH
        }
        function w() {
            if (this.t <= 0) {
                return 0
            }
            return this.DB * (this.t - 1) + k(this[this.t - 1] ^ (this.s & this.DM))
        }
        function ax(aG, z) {
            var t;
            for (t = this.t - 1; t >= 0; --t) {
                z[t + aG] = this[t]
            }
            for (t = aG - 1; t >= 0; --t) {
                z[t] = 0
            }
            z.t = this.t + aG;
            z.s = this.s
        }
        function aa(aG, z) {
            for (var t = aG; t < this.t; ++t) {
                z[t - aG] = this[t]
            }
            z.t = Math.max(this.t - aG, 0);
            z.s = this.s
        }
        function u(aL, aH) {
            var z = aL % this.DB;
            var t = this.DB - z;
            var aJ = (1 << t) - 1;
            var aI = Math.floor(aL / this.DB), aK = (this.s << z) & this.DM, aG;
            for (aG = this.t - 1; aG >= 0; --aG) {
                aH[aG + aI + 1] = (this[aG] >> t) | aK;
                aK = (this[aG] & aJ) << z
            }
            for (aG = aI - 1; aG >= 0; --aG) {
                aH[aG] = 0
            }
            aH[aI] = aK;
            aH.t = this.t + aI + 1;
            aH.s = this.s;
            aH.clamp()
        }
        function m(aK, aH) {
            aH.s = this.s;
            var aI = Math.floor(aK / this.DB);
            if (aI >= this.t) {
                aH.t = 0;
                return
            }
            var z = aK % this.DB;
            var t = this.DB - z;
            var aJ = (1 << z) - 1;
            aH[0] = this[aI] >> z;
            for (var aG = aI + 1; aG < this.t; ++aG) {
                aH[aG - aI - 1] |= (this[aG] & aJ) << t;
                aH[aG - aI] = this[aG] >> z
            }
            if (z > 0) {
                aH[this.t - aI - 1] |= (this.s & aJ) << t
            }
            aH.t = this.t - aI;
            aH.clamp()
        }
        function af(z, aH) {
            var aG = 0
                , aI = 0
                , t = Math.min(z.t, this.t);
            while (aG < t) {
                aI += this[aG] - z[aG];
                aH[aG++] = aI & this.DM;
                aI >>= this.DB
            }
            if (z.t < this.t) {
                aI -= z.s;
                while (aG < this.t) {
                    aI += this[aG];
                    aH[aG++] = aI & this.DM;
                    aI >>= this.DB
                }
                aI += this.s
            } else {
                aI += this.s;
                while (aG < z.t) {
                    aI -= z[aG];
                    aH[aG++] = aI & this.DM;
                    aI >>= this.DB
                }
                aI -= z.s
            }
            aH.s = (aI < 0) ? -1 : 0;
            if (aI < -1) {
                aH[aG++] = this.DV + aI
            } else {
                if (aI > 0) {
                    aH[aG++] = aI
                }
            }
            aH.t = aG;
            aH.clamp()
        }
        function F(z, aH) {
            var t = this.abs()
                , aI = z.abs();
            var aG = t.t;
            aH.t = aG + aI.t;
            while (--aG >= 0) {
                aH[aG] = 0
            }
            for (aG = 0; aG < aI.t; ++aG) {
                aH[aG + t.t] = t.am(0, aI[aG], aH, aG, 0, t.t)
            }
            aH.s = 0;
            aH.clamp();
            if (this.s != z.s) {
                ay.ZERO.subTo(aH, aH)
            }
        }
        function S(aG) {
            var t = this.abs();
            var z = aG.t = 2 * t.t;
            while (--z >= 0) {
                aG[z] = 0
            }
            for (z = 0; z < t.t - 1; ++z) {
                var aH = t.am(z, t[z], aG, 2 * z, 0, 1);
                if ((aG[z + t.t] += t.am(z + 1, 2 * t[z], aG, 2 * z + 1, aH, t.t - z - 1)) >= t.DV) {
                    aG[z + t.t] -= t.DV;
                    aG[z + t.t + 1] = 1
                }
            }
            if (aG.t > 0) {
                aG[aG.t - 1] += t.am(z, t[z], aG, 2 * z, 0, 1)
            }
            aG.s = 0;
            aG.clamp()
        }
        function G(aO, aL, aK) {
            var aU = aO.abs();
            if (aU.t <= 0) {
                return
            }
            var aM = this.abs();
            if (aM.t < aU.t) {
                if (aL != null) {
                    aL.fromInt(0)
                }
                if (aK != null) {
                    this.copyTo(aK)
                }
                return
            }
            if (aK == null) {
                aK = i()
            }
            var aI = i()
                , z = this.s
                , aN = aO.s;
            var aT = this.DB - k(aU[aU.t - 1]);
            if (aT > 0) {
                aU.lShiftTo(aT, aI);
                aM.lShiftTo(aT, aK)
            } else {
                aU.copyTo(aI);
                aM.copyTo(aK)
            }
            var aQ = aI.t;
            var aG = aI[aQ - 1];
            if (aG == 0) {
                return
            }
            var aP = aG * (1 << this.F1) + ((aQ > 1) ? aI[aQ - 2] >> this.F2 : 0);
            var aX = this.FV / aP
                , aW = (1 << this.F1) / aP
                , aV = 1 << this.F2;
            var aS = aK.t
                , aR = aS - aQ
                , aJ = (aL == null) ? i() : aL;
            aI.dlShiftTo(aR, aJ);
            if (aK.compareTo(aJ) >= 0) {
                aK[aK.t++] = 1;
                aK.subTo(aJ, aK)
            }
            ay.ONE.dlShiftTo(aQ, aJ);
            aJ.subTo(aI, aI);
            while (aI.t < aQ) {
                aI[aI.t++] = 0
            }
            while (--aR >= 0) {
                var aH = (aK[--aS] == aG) ? this.DM : Math.floor(aK[aS] * aX + (aK[aS - 1] + aV) * aW);
                if ((aK[aS] += aI.am(0, aH, aK, aR, 0, aQ)) < aH) {
                    aI.dlShiftTo(aR, aJ);
                    aK.subTo(aJ, aK);
                    while (aK[aS] < --aH) {
                        aK.subTo(aJ, aK)
                    }
                }
            }
            if (aL != null) {
                aK.drShiftTo(aQ, aL);
                if (z != aN) {
                    ay.ZERO.subTo(aL, aL)
                }
            }
            aK.t = aQ;
            aK.clamp();
            if (aT > 0) {
                aK.rShiftTo(aT, aK)
            }
            if (z < 0) {
                ay.ZERO.subTo(aK, aK)
            }
        }
        function P(t) {
            var z = i();
            this.abs().divRemTo(t, null, z);
            if (this.s < 0 && z.compareTo(ay.ZERO) > 0) {
                t.subTo(z, z)
            }
            return z
        }
        function M(t) {
            this.m = t
        }
        function X(t) {
            if (t.s < 0 || t.compareTo(this.m) >= 0) {
                return t.mod(this.m)
            } else {
                return t
            }
        }
        function ap(t) {
            return t
        }
        function L(t) {
            t.divRemTo(this.m, null, t)
        }
        function J(t, aG, z) {
            t.multiplyTo(aG, z);
            this.reduce(z)
        }
        function aA(t, z) {
            t.squareTo(z);
            this.reduce(z)
        }
        M.prototype.convert = X;
        M.prototype.revert = ap;
        M.prototype.reduce = L;
        M.prototype.mulTo = J;
        M.prototype.sqrTo = aA;
        function D() {
            if (this.t < 1) {
                return 0
            }
            var t = this[0];
            if ((t & 1) == 0) {
                return 0
            }
            var z = t & 3;
            z = (z * (2 - (t & 15) * z)) & 15;
            z = (z * (2 - (t & 255) * z)) & 255;
            z = (z * (2 - (((t & 65535) * z) & 65535))) & 65535;
            z = (z * (2 - t * z % this.DV)) % this.DV;
            return (z > 0) ? this.DV - z : -z
        }
        function g(t) {
            this.m = t;
            this.mp = t.invDigit();
            this.mpl = this.mp & 32767;
            this.mph = this.mp >> 15;
            this.um = (1 << (t.DB - 15)) - 1;
            this.mt2 = 2 * t.t
        }
        function ao(t) {
            var z = i();
            t.abs().dlShiftTo(this.m.t, z);
            z.divRemTo(this.m, null, z);
            if (t.s < 0 && z.compareTo(ay.ZERO) > 0) {
                this.m.subTo(z, z)
            }
            return z
        }
        function az(t) {
            var z = i();
            t.copyTo(z);
            this.reduce(z);
            return z
        }
        function R(t) {
            while (t.t <= this.mt2) {
                t[t.t++] = 0
            }
            for (var aG = 0; aG < this.m.t; ++aG) {
                var z = t[aG] & 32767;
                var aH = (z * this.mpl + (((z * this.mph + (t[aG] >> 15) * this.mpl) & this.um) << 15)) & t.DM;
                z = aG + this.m.t;
                t[z] += this.m.am(0, aH, t, aG, 0, this.m.t);
                while (t[z] >= t.DV) {
                    t[z] -= t.DV;
                    t[++z]++
                }
            }
            t.clamp();
            t.drShiftTo(this.m.t, t);
            if (t.compareTo(this.m) >= 0) {
                t.subTo(this.m, t)
            }
        }
        function ar(t, z) {
            t.squareTo(z);
            this.reduce(z)
        }
        function B(t, aG, z) {
            t.multiplyTo(aG, z);
            this.reduce(z)
        }
        g.prototype.convert = ao;
        g.prototype.revert = az;
        g.prototype.reduce = R;
        g.prototype.mulTo = B;
        g.prototype.sqrTo = ar;
        function j() {
            return ((this.t > 0) ? (this[0] & 1) : this.s) == 0
        }
        function A(aL, aM) {
            if (aL > 4294967295 || aL < 1) {
                return ay.ONE
            }
            var aK = i()
                , aG = i()
                , aJ = aM.convert(this)
                , aI = k(aL) - 1;
            aJ.copyTo(aK);
            while (--aI >= 0) {
                aM.sqrTo(aK, aG);
                if ((aL & (1 << aI)) > 0) {
                    aM.mulTo(aG, aJ, aK)
                } else {
                    var aH = aK;
                    aK = aG;
                    aG = aH
                }
            }
            return aM.revert(aK)
        }
        function at(aG, t) {
            var aH;
            if (aG < 256 || t.isEven()) {
                aH = new M(t)
            } else {
                aH = new g(t)
            }
            return this.exp(aG, aH)
        }
        ay.prototype.copyTo = ab;
        ay.prototype.fromInt = o;
        ay.prototype.fromString = y;
        ay.prototype.clamp = Q;
        ay.prototype.dlShiftTo = ax;
        ay.prototype.drShiftTo = aa;
        ay.prototype.lShiftTo = u;
        ay.prototype.rShiftTo = m;
        ay.prototype.subTo = af;
        ay.prototype.multiplyTo = F;
        ay.prototype.squareTo = S;
        ay.prototype.divRemTo = G;
        ay.prototype.invDigit = D;
        ay.prototype.isEven = j;
        ay.prototype.exp = A;
        ay.prototype.toString = r;
        ay.prototype.negate = T;
        ay.prototype.abs = aq;
        ay.prototype.compareTo = I;
        ay.prototype.bitLength = w;
        ay.prototype.mod = P;
        ay.prototype.modPowInt = at;
        ay.ZERO = e(0);
        ay.ONE = e(1);
        function h(z, t) {
            return new ay(z,t)
        }
        function am(aG, aH) {
            var t = "";
            var z = 0;
            while (z + aH < aG.length) {
                t += aG.substring(z, z + aH) + "\n";
                z += aH
            }
            return t + aG.substring(z, aG.length)
        }
        function s(t) {
            if (t < 16) {
                return "0" + t.toString(16)
            } else {
                return t.toString(16)
            }
        }
        function ak(aH, aK) {
            if (aK < aH.length + 11) {
                alert("Message too long for RSA");
                return null
            }
            var aJ = new Array();
            var aG = aH.length - 1;
            while (aG >= 0 && aK > 0) {
                var aI = aH.charCodeAt(aG--);
                if (aI < 128) {
                    aJ[--aK] = aI
                } else {
                    if ((aI > 127) && (aI < 2048)) {
                        aJ[--aK] = (aI & 63) | 128;
                        aJ[--aK] = (aI >> 6) | 192
                    } else {
                        aJ[--aK] = (aI & 63) | 128;
                        aJ[--aK] = ((aI >> 6) & 63) | 128;
                        aJ[--aK] = (aI >> 12) | 224
                    }
                }
            }
            aJ[--aK] = 0;
            var z = new ah();
            var t = new Array();
            while (aK > 2) {
                t[0] = 0;
                while (t[0] == 0) {
                    z.nextBytes(t)
                }
                aJ[--aK] = t[0]
            }
            aJ[--aK] = 2;
            aJ[--aK] = 0;
            return new ay(aJ)
        }
        function N() {
            this.n = null;
            this.e = 0;
            this.d = null;
            this.p = null;
            this.q = null;
            this.dmp1 = null;
            this.dmq1 = null;
            this.coeff = null
        }
        function p(z, t) {
            if (z != null && t != null && z.length > 0 && t.length > 0) {
                this.n = h(z, 16);
                this.e = parseInt(t, 16)
            } else {
                alert("Invalid RSA public key")
            }
        }
        function Z(t) {
            return t.modPowInt(this.e, this.n)
        }
        function q(aG) {
            var t = ak(aG, (this.n.bitLength() + 7) >> 3);
            if (t == null) {
                return null
            }
            var aH = this.doPublic(t);
            if (aH == null) {
                return null
            }
            var z = aH.toString(16);
            if ((z.length & 1) == 0) {
                return z
            } else {
                return "0" + z
            }
        }
        N.prototype.doPublic = Z;
        N.prototype.setPublic = p;
        N.prototype.encrypt = q;
        var ad = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
        var Y = "=";
        function ai(aG) {
            var z;
            var aH;
            var t = "";
            for (z = 0; z + 3 <= aG.length; z += 3) {
                aH = parseInt(aG.substring(z, z + 3), 16);
                t += ad.charAt(aH >> 6) + ad.charAt(aH & 63)
            }
            if (z + 1 == aG.length) {
                aH = parseInt(aG.substring(z, z + 1), 16);
                t += ad.charAt(aH << 2)
            } else {
                if (z + 2 == aG.length) {
                    aH = parseInt(aG.substring(z, z + 2), 16);
                    t += ad.charAt(aH >> 2) + ad.charAt((aH & 3) << 4)
                }
            }
            while ((t.length & 3) > 0) {
                t += Y
            }
            return t
        }
        function a(aI) {
            var aG = "";
            var aH;
            var t = 0;
            var z;
            for (aH = 0; aH < aI.length; ++aH) {
                if (aI.charAt(aH) == Y) {
                    break
                }
                v = ad.indexOf(aI.charAt(aH));
                if (v < 0) {
                    continue
                }
                if (t == 0) {
                    aG += aF(v >> 2);
                    z = v & 3;
                    t = 1
                } else {
                    if (t == 1) {
                        aG += aF((z << 2) | (v >> 4));
                        z = v & 15;
                        t = 2
                    } else {
                        if (t == 2) {
                            aG += aF(z);
                            aG += aF(v >> 2);
                            z = v & 3;
                            t = 3
                        } else {
                            aG += aF((z << 2) | (v >> 4));
                            aG += aF(v & 15);
                            t = 0
                        }
                    }
                }
            }
            if (t == 1) {
                aG += aF(z << 2)
            }
            return aG
        }
        function W(aH) {
            var aG = a(aH);
            var z;
            var t = new Array();
            for (z = 0; 2 * z < aG.length; ++z) {
                t[z] = parseInt(aG.substring(2 * z, 2 * z + 2), 16)
            }
            return t
        }
        av.encrypt = function(aG, z) {
            var t = new N();
            t.setPublic(a(aG), "10001");
            return ai(t.encrypt(z))
        }
    }
)(window);


function getPwd(n) {
    this.publicKey = "ANKi9PWuvDOsagwIVvrPx77mXNV0APmjySsYjB1/GtUTY6cyKNRl2RCTt608m9nYk5VeCG2EAZRQmQNQTyfZkw0Uo+MytAkjj17BXOpY4o6+BToi7rRKfTGl6J60/XBZcGSzN1XVZ80ElSjaGE8Ocg8wbPN18tbmsy761zN5SuIl"
    return window.encrypt(this.publicKey, n)
}

console.log(getPwd('123456'))
import requests
import execjs

def get_pwd_encry(pwd):
    path = "D:\js_text\xxx.js"

    with open(path, 'r') as f:
        data = f.read()

    com_ = execjs.compile(data)
    data_ = com_.call('getPwd',pwd)
    return data_

def login(phone, pwd):
    url = "https://xxxx.com/api/users/loginV2?kav=12&app=web&client_context_id=4b02b707fcd28a20fe27473f50a30ff6"
    headers = {
        "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36",
        "Host":"xxx.com",
        "Origin":"https://xxx.com",
        "Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",
    }
    data = {
        "persistent":"true",
        "app":"web",
        "phone":phone,
        "password":get_pwd_encry(pwd),
    }
    print(data)
    resp = requests.post(url, headers=headers, data=data)
    print(resp.text)


login("15845655489","123456")

完事~~~~收工~~~~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值