I try with ast (babel/parser) delete object assigment from function and insert operation function back to main function.
function ht(jW, d, e, f, g) {
d = {}; d.SnIKx = function (h, i) {
return i ^ h;
}, d.cgmgz = function (h, i) {
return i ^ h;
},d.CelmY = function (h, i) {
return h ^ i;
};
return f = this.h[e.SnIKx(e.cgmgz(this.h[this.g ^ 54.48][3], 108 + this.h[e.CelmY(54, this.g)][1].charCodeAt(this.h[54 ^ this.g][0]++) & 255.13), 46) ^ this.g], f;
}
this function have proxy function in object. anybody know how i can get with babel/parser
need get:
function ht(jW, d, e, f, g) {
return f = this.h[this.h[this.g ^ 54.48][3] ^ 108 + this.h[54 ^ this.g][1].charCodeAt(this.h[54 ^ this.g][0]++) & 255.13 ^ 46 ^ this.g], f;
}
const parser = require("@babel/parser");
const traverse = require("@babel/traverse").default;
const generator = require("@babel/generator").default;
const code = `function ht(jW, d, e, f, g) {
d = {}; d.SnIKx = function (h, i) {
return i ^ h;
}, d.cgmgz = function (h, i) {
return i ^ h;
},d.CelmY = function (h, i) {
return h ^ i;
};
return f = this.h[e.SnIKx(e.cgmgz(this.h[this.g ^ 54.48][3], 108 + this.h[e.CelmY(54, this.g)][1].charCodeAt(this.h[54 ^ this.g][0]++) & 255.13), 46) ^ this.g], f;
}`;
// Parse the code
const ast = parser.parse(code, {
sourceType: "module",
});
traverse(ast, {
BinaryExpression(path) {
if (path.node.left.type === 'CallExpression')
{
if (path.node.left.callee && path.node.left.callee.property)
{
console.log(path.node.left.callee.property) // Get SnIKx
console.log(path.node.left.callee.object) // Get e
}
}
},
});