逆向23-中远


网址

image

1. 分析

根据上面的参数,我们可以看出是有三个

captchaVerification # 滑动验证
password						# 加密的密码
username						# 明文的用户名

2. 定位

搜索password: 太多了,根本累的慌,我们可以搜索他边上的captchaVerification,有11个,这个定位就很快了

image

打断点------> 刷新

image

3. password加密流程

3.1 代码分析

var a = t("32e3") // 调度器
, o = t("b775")
, i = "/api/bid/client/user";
function r(e, n, t) {
  var i = {
    username: e,
    // 目标 n是123456明文密码,a["b"]函数进行加密,a函数是个啥呢?网上看 是一个a = t("32e3")就是调度器了
    password: Object(a["b"])(n), 
    captchaVerification: t
  };
  return o["a"].post("/api/auth/bid/authorization/client/login", i)
}

3.2 扣代码

loader.js

(function(e) {
    function n(n) {
        for (var a, o, s = n[0], c = n[1], u = n[2], d = 0, l = []; d < s.length; d++)
            o = s[d],
            Object.prototype.hasOwnProperty.call(i, o) && i[o] && l.push(i[o][0]),
            i[o] = 0;
        for (a in c)
            Object.prototype.hasOwnProperty.call(c, a) && (e[a] = c[a]);
        m && m(n);
        while (l.length)
            l.shift()();
        return r.push.apply(r, u || []),
        t()
    }
    // ...省略...
    function c(n) {
        if (a[n])
            return a[n].exports;
        var t = a[n] = {
            i: n,
            l: !1,
            exports: {}
        };
      //自己添加的日志
        console.log("n::::::", n);
        return e[n].call(t.exports, t, t.exports, c),
        t.l = !0,
        t.exports
    }
    //自己添加的全局调用
    window.loader = c,
    // ...省略...
    )({
         "32e3": function(e, n, t) {
        "use strict";
        t.d(n, "b", (function() {
            return o
        }
        )),
        t.d(n, "a", (function() {
            return i
        }
        ));
        var a = t("5c1a");
        function o(e) {
            var n = a["pki"].publicKeyFromPem("-----BEGIN PUBLIC KEY-----\n  ".concat("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsy4xppPDUT2eAOR5h0cyydzxtKB9O80AGjUT6FmDgg6CwelpnE0C2h2JQyP1gCveJs6GDwSDn20RVVpD67f//YPYErjaH/CBOxNG3k5IkW1oQx04uqFNMtWvjzk0aFh2eJLsBi7Ha4elw3WySg00B8oZCL4VBay4ML9kyOAjjCj5jHCX8a2yxIMJIF+EjW3kBR68IMwBvuDL45Qa0oB24vTffaSEs+hGjMTQvoCciOfti3pmEAlVc438/cBgAhK5cIMfIMElxYAVvmsDy0I7RCUTrajetKjX94Q+JuQUxnIHNC3IVtYsl1x0lNRtb93IhlRCkZ9djOu350eqhZIOXQIDAQAB", "\n  -----END PUBLIC KEY-----"))
              , t = n.encrypt(e, "RSA-OAEP", {
                md: a["md"].sha256.create(),
                mgf1: {
                    md: a["md"].sha1.create()
                }
            });
            return window.btoa(t)
        }
        function i(e) {
            var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "XwKsGlMcdPMEhR1B"
              , t = a["cipher"].createCipher("AES-ECB", a["util"].createBuffer(n));
            return t.start(),
            t.update(a["util"].createBuffer(e)),
            t.finish(),
            a["util"].encode64(t.output.getBytes())
        }
    },
    })

env.js

window = global;

rukou.js

require("./env.js")
require("./loader.js")
require("./mod.js")

console.log(window.loader)

三个文件填充好之后,运行rukou.js得到下面这些就对了

image

3.2 对代码进行填充

主要是对rukou.js 进行操作

require("./env.js")
require("./loader.js")
require("./mod.js")

console.log(window.loader("32e3")) // 添加上"32e3"

运行结果

n:::::: 32e3
n:::::: 5c1a // 说明运行到这个key的调度器,咱们的代码中没有,所有报错了
/Users/xxxx/Desktop/js/23中远/loader.js:70
        return e[n].call(t.exports, t, t.exports, c),
                    ^

TypeError: Cannot read properties of undefined (reading 'call')
    at c (/Users/xxxx/Desktop/js/23中远/loader.js:70:21)
    at 32e3 (/Users/xxxx/Desktop/js/23中远/loader.js:562:17)
    at c (/Users/xxxx/Desktop/js/23中远/loader.js:70:21)
    at Object.<anonymous> (/Users/xxxx/Desktop/js/23中远/23zhongyuan.js:5:20)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.15.1

// copy 5c1a,全局搜索,找到之后把整个代码copy到一个mod.js的文件【需要新建一个mod.js文件】

image

将5c1a放在mod.js运行报错

image

解决办法

image

运行看效果

image

3.3 调用调度器中的函数

require("./env.js")
require("./loader.js")
require("./mod.js")

a = window.loader("32e3")

console.log(a["b"]("123456"))

image

结束语:具体在python中怎么使用,我们在这个案例中,略

posted @ 2024-10-18 14:08  流年中渲染了微笑  阅读(0)  评论(0)    收藏  举报