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)