-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
30 lines (23 loc) · 980 Bytes
/
Copy pathindex.js
File metadata and controls
30 lines (23 loc) · 980 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
const fs = require('fs');
function aadecode(text) {
var evalPreamble = "(\uFF9F\u0414\uFF9F) ['_'] ( (\uFF9F\u0414\uFF9F) ['_'] (";
var decodePreamble = "( (\uFF9F\u0414\uFF9F) ['_'] (";
var evalPostamble = ") (\uFF9F\u0398\uFF9F)) ('_');";
var decodePostamble = ") ());";
text = text.replace(/^\s*/, "").replace(/\s*$/, "");
if (/^\s*$/.test(text)) {
return "";
}
if (text.lastIndexOf(evalPreamble) < 0) {
throw new Error("Given code is not encoded as aaencode.");
}
if (text.lastIndexOf(evalPostamble) != text.length - evalPostamble.length) {
throw new Error("Given code is not encoded as aaencode.");
}
var decodingScript = text.replace(evalPreamble, decodePreamble)
.replace(evalPostamble, decodePostamble);
return eval(decodingScript);
}
var input = fs.readFileSync('input.js', 'utf8');
var output = aadecode(input);
fs.writeFileSync('output.js', output, 'utf8');