diff --git a/packages/webcrack/src/ast-utils/inline.ts b/packages/webcrack/src/ast-utils/inline.ts index 366893e8..3b220ec3 100644 --- a/packages/webcrack/src/ast-utils/inline.ts +++ b/packages/webcrack/src/ast-utils/inline.ts @@ -265,7 +265,7 @@ export function inlineVariableAliases( ref.parentPath.remove(); } else { // Replace `(alias = decoder)(1);` with `decoder(1);` - ref.parentPath.replaceWith(ref.parentPath.node.right); + ref.parentPath.replaceWith(t.identifier(targetName)); } } else if (ref.parentPath?.isVariableDeclarator()) { // Remove `alias = decoder;` of declarator diff --git a/packages/webcrack/src/deobfuscate/test/__snapshots__/deobfuscate.test.ts.snap b/packages/webcrack/src/deobfuscate/test/__snapshots__/deobfuscate.test.ts.snap index 982fd749..8b86159d 100644 --- a/packages/webcrack/src/deobfuscate/test/__snapshots__/deobfuscate.test.ts.snap +++ b/packages/webcrack/src/deobfuscate/test/__snapshots__/deobfuscate.test.ts.snap @@ -21,7 +21,7 @@ decoder(1); decoder(2); decoder(3); () => { - alias(4); + decoder(4); }; decoder(5); };"