const fs = require('fs'); const path = './nieistotne/05.06.js' fs.readFile(path, 'utf8',…
- User
const fs = require('fs'); const path = './nieistotne/05.06.js' fs.readFile(path, 'utf8', (err, file) => { if (err) { console.error('Error reading file:', err); return; }
const regex = /, (function() {/; const match = file.match(regex); if (match) { let modifiedString = file.slice(0, match.index + match[0].length); modifiedString = modifiedString.replace(regex, ')') executeDecodedFunction(modifiedString) } else { console.error('Function not found in file.'); } });
function executeDecodedFunction(functionObject) { get().then(xd => { const functionRegex = /function\s*([^(]+)/; const match = functionObject.match(functionRegex); if (match) { const e = extractFPValue(xd.fp) const functionName = match[1]; eval(xd.func); eval(functionObject); eval(
console.log(${functionName}(${e}))); } }).catch(err => { console.error(err); }); } function get() { return new Promise((resolve, reject) => { fs.readFile(path, 'utf-8', (err, data) => { if (err) { reject(err); return; } const e = {}; const functionRegex = /(\w+)\s*=\sfunction\s(([^)]))\s({|=>)\s*([^}])\s}/gm; const functionNameRegex = /a0_\w+/;while ((functionMatch = functionRegex.exec(data)) !== null) { const functionDeclaration = functionMatch[0]; const functionName = functionMatch[1] || 'anonimowa'; const functionArgs = functionMatch[2]; const functionBody = functionMatch[4]; const arrayDeclaration = extractArrayDeclaration(data); if (functionBody.includes("GET_FP['fp']")) { e.fp = functionDeclaration; } if (functionName.match(functionNameRegex) && functionArgs.trim() === '') { e.arr = arrayDeclaration; e.name = functionName; } } e.func = `function ${e.name}(){ const essa = [${e.arr}] ${e.name} = function() { return essa; }; return ${e.name}(); }`; resolve(e); }); });} function extractArrayDeclaration(data) { const arrayRegex = /const\s*\w+\s*=\s*[([^]]+)]/gm; const arrayMatch = arrayRegex.exec(data); if (arrayMatch) { const arrayContent = arrayMatch[1]; const cleanedArrayContent = arrayContent.replace(/\s+/g, ''); return cleanedArrayContent; } return ''; } function extractFPValue(fpDeclaration) { const regex = /_0x\w+(([^()]+))/ const match = regex.exec(fpDeclaration); if (match) { const value = match[1]; return value; } return ''; } Jak sprawić by ta funkcja odkodowywała zamiast tylko jedną rzecz czyli const e = extractFPValue(xd.fp) to odkodowywała z pliku wszystkie pola gdzie funkcja ma 2 argumenty i 1 argument to liczba np. 0x1df
- Assistant
Aby odkodować wszystkie funkcje z jednym argumentem będącym liczbą, możesz przechwycić te funkcje w twojej funkcji
get(). Następnie zamiast tylkoextractFPValue(), odkoduj wszystkie wystąpieniae- przechowując każdą wartość odkodowaną. Oto kod, który został zmodyfikowany w celu osiągnięcia tego:function executeDecodedFunctions(functionObject, decodedValues) { get().then(xd => { const functionRegex = /function\s*([^(]+)/; const match = functionObject.match(functionRegex); if (match) { const functionName = match[1]; eval(xd.func); eval(functionObject); decodedValues.forEach(value => { eval(`console.log(${functionName}(${value}))`); }); } }).catch(err => { console.error(err); }); } function get() { return new Promise((resolve, reject) => { fs.readFile(path, 'utf-8', (err, data) => { if (err) { reject(err); return; } const e = {}; const functionRegex = /(\w+)\s*=\s*function\s*\(([^)]*)\)\s*({|=>)\s*([^}]*)\s*}/gm; const functionNameRegex = /a0_\w+/; const oneArgNumberFunctions = []; while ((functionMatch = functionRegex.exec(data)) !== null) { const functionDeclaration = functionMatch[0]; const functionName = functionMatch[1] || 'anonimowa'; const functionArgs = functionMatch[2]; const functionBody = functionMatch[4]; const arrayDeclaration = extractArrayDeclaration(data); if (functionBody.includes("GET_FP['fp']")) { e.fp = functionDeclaration; } if (functionName.match(functionNameRegex) && functionArgs.trim() === '') { e.arr = arrayDeclaration; e.name = functionName; } // Check if it's a one-argument function with a number as an argument if (functionArgs.split(',').length === 1 && functionBody.match(/\d+/)) { const arg = functionArgs.trim(); oneArgNumberFunctions.push({ name: functionName, arg, body: functionBody }); } } e.func = `function ${e.name}(){ const essa = [${e.arr}] ${e.name} = function() { return essa; }; return ${e.name}(); }`; e.oneArgNumberFunctions = oneArgNumberFunctions; resolve(e); }); }); } fs.readFile(path, 'utf8', (err, file) => { if (err) { console.error('Error reading file:', err); return; } const regex = /, \(function\(\) \{/; const match = file.match(regex); if (match) { let modifiedString = file.slice(0, match.index + match[0].length); modifiedString = modifiedString.replace(regex, ')') get().then(xd => { const decodedValues = xd.oneArgNumberFunctions.map(func => extractFPValue(func.body)); executeDecodedFunctions(modifiedString, decodedValues); }).catch(err => { console.error(err); }); } else { console.error('Function not found in file.'); } });Teraz, zamiast tylko jednej wartości
e, kod będzie wykonany dla wszystkich funkcji z jednym argumentem będącym liczbą z pliku.