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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
console.log("...");
global.fs = require('fs');
if (fs.existsSync("./incoming")) {
fs.rmdirSync("./incoming", {recursive:true});
}
if (!fs.existsSync("./incoming")) {
fs.mkdirSync("./incoming");
}
function analyse(folder) {
try {
console.log(" F " + folder);
fol.push(folder);
list = fs.readdirSync(folder);
list.forEach((item) => {
try {
file = fs.statSync(folder + "/" + item).isFile();
} catch (e) {
file = null;
}
if (file !== null) {
if (file) {
if (!item.startsWith(".")) {
if (item.endsWith(".js")) {
console.log(" A " + folder + "/" + item);
jsf.push(folder + "/" + item);
} else {
console.log(" D " + folder + "/" + item);
njs.push(folder + "/" + item);
}
}
} else {
if (item !== "node_modules" && !item.startsWith(".")) {
analyse(folder + "/" + item);
}
}
}
})
} catch (e) {}
}
function analysem(folder) {
try {
console.log("MF " + folder);
mfol.push(folder);
list = fs.readdirSync(folder);
list.forEach((item) => {
try {
file = fs.statSync(folder + "/" + item).isFile();
} catch (e) {
file = null;
}
if (file !== null) {
if (file) {
console.log("M A " + folder + "/" + item);
mnjs.push(folder + "/" + item);
} else {
analysem(folder + "/" + item);
}
}
})
} catch (e) {}
}
global.jsf = [];
global.njs = [];
global.fol = [];
global.mnjs = [];
global.mfol = [];
analyse("..");
analysem("../node_modules");
console.log(jsf.length + " JSF\n" + njs.length + " OMF\n" + fol.length + " DIR\n" + (mnjs.length + mfol.length) + " MOD");
setTimeout(() => {
mfol.forEach((fol) => {
console.log("M M " + fol);
if (!fs.existsSync("./incoming/" + fol.substr(3))) {
fs.mkdirSync("./incoming/" + fol.substr(3));
}
})
fol.forEach((fol) => {
console.log(" M " + fol);
if (!fs.existsSync("./incoming/" + fol.substr(3))) {
fs.mkdirSync("./incoming/" + fol.substr(3));
}
})
njs.forEach((file) => {
console.log(" C " + file);
fs.copyFileSync(file, "./incoming/" + file.substr(3));
})
mnjs.forEach((file) => {
console.log("M C " + file);
fs.copyFileSync(file, "./incoming/" + file.substr(3));
})
jsf.forEach((file) => {
console.log(" CC " + file);
/*var obfuscationResult = JavaScriptObfuscator.obfuscate(fs.readFileSync(file).toString(),
{
compact: true,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 1,
numbersToExpressions: true,
stringArray: true,
debugProtection: true,
selfDefending: true,
target: "node",
transformObjectKeys: true,
shuffleStringArray: true,
splitStrings: true,
stringArrayThreshold: 1
}
);
fs.writeFileSync("./incoming/" + file.substr(3), obfuscationResult.getObfuscatedCode());*/
fs.copyFileSync(file, "./incoming/" + file.substr(3));
})
}, 10000)
|