@nodesecure/js-x-ray
Version:
JavaScript AST XRay analysis
30 lines • 850 B
JavaScript
// Import Internal Dependencies
import { isCallExpression, joinArrayExpression } from "../estree/index.js";
import { walkEnter } from "../walker/index.js";
export class Deobfuscate {
name = "deobfuscate";
#withCallExpression(node) {
const value = joinArrayExpression(node);
if (value !== null) {
return {
type: "Literal",
value,
raw: value
};
}
return void 0;
}
walk(body) {
const self = this;
walkEnter(body, function walk(node) {
if (Array.isArray(node)) {
return;
}
if (isCallExpression(node)) {
this.replaceAndSkip(self.#withCallExpression(node));
}
});
return body;
}
}
//# sourceMappingURL=deobfuscate.js.map