Skip to content

Commit

Permalink
Added simple CLI tool (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
wizche committed May 31, 2020
1 parent a2098f9 commit fe4abb1
Show file tree
Hide file tree
Showing 8 changed files with 633 additions and 10,552 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,20 @@
# Usage

## CLI
You can use the deobfuscator straight away with the **babel-cli** node module (`npm install @babel/core @babel/cli`).
Folder `cli/` contains a simple node.js CLI application that uses Babel and the IlluminateJS plugin to deobfuscate the given input file. You can register the `illuminatejs` alias with `npm link` or call the `./cli.js` node script manually.

```
$ cat test.js
var x=1;
console.log(x+1);
$ illuminatejs ./test.js
const x = 1;
console.log(2);
```

## CLI (using babel-cli module)
You can use the deobfuscator using the **babel-cli** node module (`npm install @babel/core @babel/cli`).
From the root project execute `babel.js` specifying the `plugins` parameter with the `babel-plugin-deobfuscate` path and the desired file to deobfuscate. For example:
```
$ cat test.js
Expand Down
8,589 changes: 0 additions & 8,589 deletions babel-plugin-deobfuscate/package-lock.json

This file was deleted.

9 changes: 4 additions & 5 deletions babel-plugin-deobfuscate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "babel-plugin-deobfuscate",
"version": "0.0.2",
"description": "Reverse code obfuscation for analysis.",
"main": "lib/index.js",
"main": "lib/illuminatejs.js",
"private": true,
"scripts": {
"test": "jest",
Expand All @@ -15,7 +15,7 @@
"obfuscation",
"deobfuscation"
],
"author": "Lucas Neiva",
"author": "GeeksOnSecurity",
"devDependencies": {
"@types/babel-types": "^6.7.16",
"@types/chalk": "^0.4.31",
Expand All @@ -27,8 +27,7 @@
"ts-jest": "^20.0.3",
"tslint": "^5.2.0",
"tslint-config-standard": "^5.0.2",
"typescript": "^2.3.2",
"webpack-cli": "^3.3.11"
"typescript": "^2.3.2"
},
"peerDependencies": {
"babel-core": "6.*"
Expand All @@ -48,6 +47,6 @@
"dependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.7.0",
"webpack": "^4.43.0"
"babel-standalone": "^6.26.0"
}
}
2,514 changes: 557 additions & 1,957 deletions babel-plugin-deobfuscate/yarn.lock

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions cli/cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node
var fs = require('fs');
const Babel = require('babel-standalone');
const IlluminateJs = require('../babel-plugin-deobfuscate/lib/illuminatejs')

Babel.registerPlugin('illuminatejs', IlluminateJs.default);

if(process.argv.length < 3){
console.warn(`IlluminateJS Deobfuscator`);
console.warn(`Usage: ${process.argv[1]} file-to-deobfuscate.js`)
} else {
var args = process.argv.slice(2);
fs.readFile(args[0], 'utf8', function(err, body) {
console.log(Babel.transform(
body,
{plugins: ['illuminatejs']}
).code);
});
}

13 changes: 13 additions & 0 deletions cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "illuminatejs-cli",
"version": "1.0.0",
"description": "Simple CLI tool for IlluminateJS deobfuscator",
"main": "cli.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "GeeksOnSecurity",
"license": "ISC",
"dependencies": {
"babel-standalone": "^6.26.0"
},
"bin": {
"illuminatejs": "./cli.js"
}
}
8 changes: 8 additions & 0 deletions cli/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


babel-standalone@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-standalone/-/babel-standalone-6.26.0.tgz#15fb3d35f2c456695815ebf1ed96fe7f015b6886"
integrity sha1-Ffs9NfLEVmlYFevx7Zb+fwFbaIY=

0 comments on commit fe4abb1

Please sign in to comment.