forked from AIRE-lab/etacsufbo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·43 lines (34 loc) · 967 Bytes
/
Copy pathcli.js
File metadata and controls
executable file
·43 lines (34 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env node --harmony --harmony_arrow_functions
'use strict';
const fs = require('fs');
require('colors');
const deobfuscator = require('./');
// run as a command line tool
//
// Usage:
// node deobfuscator.js input [output]
//
if ([3, 4].indexOf(process.argv.length) > -1) {
let src = process.argv[2];
let dst = process.argv[3];
let code = fs.readFileSync(src).toString('utf8');
if (dst)
fs.writeFile(dst, code);
else
console.log(code.green);
} else if (process.argv.length === 2) {
process.stdin.setEncoding('utf8');
process.stdin.on('readable', function() {
var chunk = process.stdin.read();
if (chunk && chunk.length) {
try {
console.log(deobfuscator.clean(chunk).green);
} catch (ex) {
if (ex.lineNumber && ex.column) {
console.log(`Error: ${ex.description} at line ${ex.lineNumber}, col ${ex.column}`.red);
}
}
}
process.stdout.write('> ');
});
}