替换之前的d形如

d("77696669")

执行代码

const fs = require('fs');
const acorn = require('acorn');
const walk = require("acorn-walk")
const escodegen = require('escodegen');

function d(b) {
    var a, c = "";
    for (a = 0; a < b.length; a += 2) c += String.fromCharCode(parseInt(b.slice(a, a + 2), 16));
    return c
}

const content = fs.readFileSync('m301650.js');
const ast = acorn.parse(content);
walk.simple(ast, {
    CallExpression(node) {
        if (node.callee.name === 'd' && node.arguments[0].type === 'Literal') {
            node.type = 'Literal';
            node.value = d(node.arguments[0].value);
        }
    }
});
const decodedContent = escodegen.generate(ast);
fs.writeFileSync('m301650.decoded.js', decodedContent);

替换之后的

就是一个字符串

script

相关文章:

  • 2021-07-26
  • 2021-07-10
  • 2021-11-25
  • 2022-12-23
  • 2021-06-16
  • 2022-01-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2021-08-23
  • 2021-06-13
  • 2021-06-23
相关资源
相似解决方案