echo094 / decode-js

JS混淆代码的AST分析工具 AST analysis tool for obfuscated JS code
MIT License
569 stars 301 forks source link

SyntaxError: Identifier '_0x383f6a' has already been declared #14

Closed thejoaomoura closed 10 months ago

thejoaomoura commented 1 year ago

Hello,

I encountered an issue while trying to use the decode-js tool to deobfuscate a JavaScript file. The error message I received was:

D:\decode-js\node_modules@babel\parser\lib\index.js:72
}, descriptor)), Object.assign(new constructor(), properties));
^

SyntaxError: Identifier '_0x383f6a' has already been declared. (4606:16)
at instantiate (D:\decode-js\node_modules@babel\parser\lib\index.js:72:32)
at constructor (D:\decode-js\node_modules@babel\parser\lib\index.js:358:12)
at Parser.raise (D:\decode-js\node_modules@babel\parser\lib\index.js:3335:19)
at ScopeHandler.checkRedeclarationInScope (D:\decode-js\node_modules@babel\parser\lib\index.js:3519:19)
at ScopeHandler.declareName (D:\decode-js\node_modules@babel\parser\lib\index.js:3485:12)
at Parser.declareNameFromIdentifier (D:\decode-js\node_modules@babel\parser\lib\index.js:12058:16)
at Parser.checkIdentifier (D:\decode-js\node_modules@babel\parser\lib\index.js:12053:12)
at Parser.checkLVal (D:\decode-js\node_modules@babel\parser\lib\index.js:11979:12)
at Parser.parseVarId (D:\decode-js\node_modules@babel\parser\lib\index.js:15289:10)
at Parser.parseVar (D:\decode-js\node_modules@babel\parser\lib\index.js:15263:12) {
code: 'BABEL_PARSER_SYNTAX_ERROR',
reasonCode: 'VarRedeclaration',
loc: Position { line: 4606, column: 16, index: 205969 },
pos: [Getter/Setter]
}

Node.js v18.14.0

The error message indicates that the identifier '_0x383f6a' has been declared more than once. I understand that in JavaScript, a variable cannot be declared more than once in the same scope. However, I'm not sure how to proceed with this error.

Could you please provide some guidance on how to resolve this issue? Any help would be greatly appreciated.

Thank you,

echo094 commented 1 year ago

Can you attach a simple example?

Maybe you can try the errorRecovery option when calling @babel/parser doc, or you can fix the error manually by deleting the VariableDeclaration ("var" | "let" | "const" | "using") around the position indicated loc: Position { line: 4606, column: 16, index: 205969 },

github-actions[bot] commented 10 months ago

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.