initial commit
This commit is contained in:
+159
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,63 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const checkboxFilePath = path.join(__dirname, '..', 'gui', 'src', 'checkbox.json');
|
||||
const stubFilePath = path.join(__dirname, 'stub.js');
|
||||
|
||||
const readJsonFile = (filePath, callback) => {
|
||||
fs.readFile(filePath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
callback(err, null);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const jsonData = JSON.parse(data);
|
||||
callback(null, jsonData);
|
||||
} catch (parseError) {
|
||||
callback(parseError, null);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
readJsonFile(checkboxFilePath, (err, jsonData) => {
|
||||
if (err) {
|
||||
console.error('Error reading or parsing checkbox.json file:', err);
|
||||
return;
|
||||
}
|
||||
|
||||
fs.readFile(stubFilePath, 'utf8', (err, stubData) => {
|
||||
if (err) {
|
||||
console.error('Error reading stub.js file:', err);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('Updating CONFIG object in stub.js...');
|
||||
|
||||
const configPattern = /const CONFIG = \{([\s\S]*?)\};/;
|
||||
const match = stubData.match(configPattern);
|
||||
|
||||
if (match) {
|
||||
let configBlock = match[1];
|
||||
|
||||
Object.keys(jsonData).forEach(key => {
|
||||
const val = jsonData[key];
|
||||
const keyPattern = new RegExp(`(${key}:\\s*)(true|false)`, 'i');
|
||||
|
||||
if (keyPattern.test(configBlock)) {
|
||||
console.log(`Setting ${key} to ${val}`);
|
||||
configBlock = configBlock.replace(keyPattern, `$1${val}`);
|
||||
}
|
||||
});
|
||||
|
||||
const newStubData = stubData.replace(configPattern, `const CONFIG = {${configBlock}};`);
|
||||
|
||||
fs.writeFile(stubFilePath, newStubData, 'utf8', (err) => {
|
||||
if (err) {
|
||||
console.error('Error writing to stub.js:', err);
|
||||
return;
|
||||
}
|
||||
console.log('stub.js CONFIG has been updated successfully.');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,68 @@
|
||||
const JsConfuser = require("js-confuser");
|
||||
const fs = require('fs');
|
||||
const colors = require('colors');
|
||||
const path = require('path');
|
||||
const { exec } = require('child_process');
|
||||
|
||||
const inputFile = "./node_modules/input.js";
|
||||
|
||||
if (!fs.existsSync(inputFile)) {
|
||||
console.error('❌ input.js file not found in node_modules/');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
const file = fs.readFileSync(inputFile, "utf-8");
|
||||
|
||||
JsConfuser.obfuscate(file, {
|
||||
"calculator": true,
|
||||
"compact": true,
|
||||
"controlFlowFlattening": 1.0,
|
||||
"deadCode": 0.9,
|
||||
"dispatcher": 1.0,
|
||||
"duplicateLiteralsRemoval": 1.0,
|
||||
"globalConcealing": true,
|
||||
"hexadecimalNumbers": true,
|
||||
"identifierGenerator": "mangled",
|
||||
"minify": true,
|
||||
"movedDeclarations": true,
|
||||
"objectExtraction": true,
|
||||
"opaquePredicates": 1.0,
|
||||
"preset": "high",
|
||||
"renameGlobals": true,
|
||||
"renameVariables": true,
|
||||
"shuffle": "hash",
|
||||
"stringConcealing": true,
|
||||
"stringSplitting": 1.0,
|
||||
"target": "node"
|
||||
}).then((obfuscatedCode) => {
|
||||
console.log('✅ Code obfuscated with JsConfuser');
|
||||
|
||||
const targetFolderName = '../build';
|
||||
const fileName = 'index.js';
|
||||
const targetFolder = path.join(__dirname, targetFolderName);
|
||||
|
||||
if (!fs.existsSync(targetFolder)) {
|
||||
fs.mkdirSync(targetFolder, { recursive: true });
|
||||
}
|
||||
|
||||
const targetFile = path.join(targetFolder, fileName);
|
||||
|
||||
if (typeof obfuscatedCode !== 'string') {
|
||||
console.error('❌ Error: The obfuscated code is not a string');
|
||||
console.log('Type received:', typeof obfuscatedCode);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
fs.writeFileSync(targetFile, obfuscatedCode, { encoding: 'utf-8' });
|
||||
console.log('✅ Final file written to build/index.js');
|
||||
|
||||
}).catch((error) => {
|
||||
console.error('❌ Error during JsConfuser obfuscation:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Error reading input.js file:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
Generated
+3772
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"archiver": "^7.0.1",
|
||||
"axios": "^1.13.2",
|
||||
"colors": "^1.4.0",
|
||||
"form-data": "^4.0.5",
|
||||
"javascript-obfuscator": "^4.1.1",
|
||||
"js-confuser": "^1.7.1",
|
||||
"readline-sync": "^1.4.10",
|
||||
"sqlite3": "^5.1.7"
|
||||
}
|
||||
}
|
||||
+3010
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user