-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move cli logic to bin/deobfuscate.js * Adjust usage documentation * 2.0.2
- Loading branch information
1 parent
a832a8f
commit 6009a3e
Showing
6 changed files
with
63 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env node | ||
import {REstringer} from '../src/restringer.js'; | ||
import {argsAreValid, parseArgs} from'../src/utils/parseArgs.js'; | ||
|
||
try { | ||
const args = parseArgs(process.argv.slice(2)); | ||
if (argsAreValid(args)) { | ||
const fs = await import('node:fs'); | ||
let content = fs.readFileSync(args.inputFilename, 'utf-8'); | ||
const startTime = Date.now(); | ||
|
||
const restringer = new REstringer(content); | ||
if (args.quiet) restringer.logger.setLogLevelNone(); | ||
else if (args.verbose) restringer.logger.setLogLevelDebug(); | ||
restringer.logger.log(`[!] REstringer v${REstringer.__version__}`); | ||
restringer.logger.log(`[!] Deobfuscating ${args.inputFilename}...`); | ||
if (args.maxIterations) { | ||
restringer.maxIterations.value = args.maxIterations; | ||
restringer.logger.log(`[!] Running at most ${args.maxIterations} iterations`); | ||
} | ||
if (restringer.deobfuscate()) { | ||
restringer.logger.log(`[+] Saved ${args.outputFilename}`); | ||
restringer.logger.log(`[!] Deobfuscation took ${(Date.now() - startTime) / 1000} seconds.`); | ||
if (args.outputToFile) fs.writeFileSync(args.outputFilename, restringer.script, {encoding: 'utf-8'}); | ||
else console.log(restringer.script); | ||
} else restringer.logger.log(`[-] Nothing was deobfuscated ¯\\_(ツ)_/¯`); | ||
} | ||
} catch (e) { | ||
console.error(`[-] Critical Error: ${e}`); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters