import React, { useState } from ‘react’; import { Shield, Code, Copy, Download, Lock, Zap, Skull } from ‘lucide-react’; export default function LuaObfuscator() { const [input, setInput] = useState(’’); const [output, setOutput] = useState(’’); const [copied, setCopied] = useState(false); const [processing, setProcessing] = useState(false); const generateVarName = (type = ‘var’) => { const confusing = [‘l1lIl1’, ‘Il1lI’, ‘lI1Il’, ‘O0OoO’, ‘o0O0o’, ‘I1lIl’, ‘l1I1l’]; const prefixes = [’**’, ’***’, ’l*_’, ‘I__’, ‘*l*’, ‘*I*’]; const base = confusing[Math.floor(Math.random() * confusing.length)]; const prefix = prefixes[Math.floor(Math.random() * prefixes.length)]; const suffix = Math.random().toString(36).substring(2, 8).replace(/[aeiou]/g, ‘l’); return prefix + base + suffix; }; const generateBytecode = (code) => { const bytes = []; for (let i = 0; i < code.length; i++) { bytes.push(code.charCodeAt(i)); } return bytes; }; const createVMDecoder = () => { const vm = generateVarName(‘vm’); const stack = generateVarName(‘stack’); const opcodes = generateVarName(‘ops’); const pc = generateVarName(‘pc’); const reg = generateVarName(‘reg’); const inst = generateVarName(‘inst’); const env = generateVarName(‘env’); ``` return ` ``` local ${vm}=function(${opcodes}) local ${stack}={} local ${reg}={} local ${env}=getfenv() local ${pc}=1 while ${pc}<=#${opcodes} do local ${inst}=${opcodes}[${pc}] if ${inst}==1 then ${reg}[${opcodes}[${pc}+1]]=${opcodes}[${pc}+2] ${pc}=${pc}+3 elseif ${inst}==2 then local ${generateVarName()}=${reg}[${opcodes}[${pc}+1]] local ${generateVarName()}=${reg}[${opcodes}[${pc}+2]] ${reg}[${opcodes}[${pc}+3]]=${generateVarName()}+${generateVarName()} ${pc}=${pc}+4 elseif ${inst}==3 then ${env}[${opcodes}[${pc}+1]](unpack(${reg})) ${pc}=${pc}+2 elseif ${inst}==4 then ${pc}=${opcodes}[${pc}+1] elseif ${inst}==5 then return else ${pc}=${pc}+1 end end end`; }; const createStringDecryptor = () => { const decrypt = generateVarName(‘decrypt’); const xor = generateVarName(‘xor’); const key = generateVarName(‘key’); const byte = generateVarName(‘byte’); const char = generateVarName(‘char’); const sub = generateVarName(‘sub’); const str = generateVarName(‘str’); const result = generateVarName(‘result’); const i = generateVarName(‘i’); ``` return ` ``` local ${decrypt}=(function() local ${xor}=function(${str},${key}) local ${result}=”” for ${i}=1,#${str} do local ${byte}=string.byte(${str},${i}) local ${char}=string.char(bit32 and bit32.bxor(${byte},${key})or(${byte}~${key})) ${result}=${result}..${char} end return ${result} end return function(${str}) local ${key}=tonumber(${str}:sub(1,3))or 42 local ${sub}=${str}:sub(4) local ${result}=”” for ${i}=1,#${sub},2 do ${result}=${result}..string.char(tonumber(${sub}:sub(${i},${i}+1),16)) end return ${xor}(${result},${key}) end end)()`; }; const encryptString = (str) => { const key = Math.floor(Math.random() * 255) + 1; let encrypted = ‘’; for (let i = 0; i < str.length; i++) { const byte = str.charCodeAt(i) ^ key; encrypted += byte.toString(16).padStart(2, ‘0’); } return key.toString().padStart(3, ‘0’) + encrypted; }; const createAntiTamper = () => { const check1 = generateVarName(‘check’); const check2 = generateVarName(‘check’); const check3 = generateVarName(‘check’); const timer = generateVarName(‘timer’); const hash = generateVarName(‘hash’); ``` return ` ``` local ${check1}=(function() local ${timer}=os.clock() for ${generateVarName()}=1,1e6 do end return os.clock()-${timer}<0.1 end)() local ${check2}=(function() local ${generateVarName()}=debug and debug.getinfo or function() return {} end return ${generateVarName()}(1).what~=“C” end)() local ${check3}=(function() local ${hash}=0 for ${generateVarName()}=1,100 do ${hash}=${hash}+${generateVarName()}*${generateVarName()} end return ${hash}>0 end)() if not(${check1} and ${check2} and ${check3})then while true do local ${generateVarName()}={} for ${generateVarName()}=1,1e6 do ${generateVarName()}[${generateVarName()}]=${generateVarName()} end end end`; }; const createJunkCode = (amount = 20) => { const junk = []; for (let i = 0; i < amount; i++) { const v1 = generateVarName(); const v2 = generateVarName(); const v3 = generateVarName(); const ops = [ `local ${v1}=(function()local ${v2}={}for ${v3}=1,${Math.floor(Math.random()*50)+20} do ${v2}[${v3}]=${v3}*${Math.random().toFixed(4)} end return #${v2} end)()`, `local ${v1}=string.rep(string.char(${Math.floor(Math.random()*26)+97}),${Math.floor(Math.random()*30)+10})`, `local ${v1}=(function()local ${v2}=0 for ${v3}=1,1000 do ${v2}=${v2}+${v3} end return ${v2} end)()`, `local ${v1}={[${generateVarName()}]=${Math.random().toFixed(6)},[${generateVarName()}]=${Math.random().toFixed(6)}}`, `local ${v1}=function(${v2})return ${v2} and ${v2}*${Math.random().toFixed(4)} or ${Math.random().toFixed(4)} end`, ]; junk.push(ops[Math.floor(Math.random() * ops.length)]); } return junk.join(’\n’); }; const obfuscateConstants = (code) => { // Remplacer les nombres par des expressions code = code.replace(/\b(\d+)\b/g, (match, num) => { const n = parseInt(num); if (n === 0) return ‘(1-1)’; if (n === 1) return ‘(2-1)’; if (n < 10) { const ops = [ `(${n+1}-1)`, `(${n-1}+1)`, `(${n*2}/2)`, `(${n}*1)`, ]; return ops[Math.floor(Math.random() * ops.length)]; } return match; }); return code; }; const createControlFlowObfuscation = (code) => { const lines = code.split(’\n’).filter(l => l.trim() && !l.trim().startsWith(’–’)); const chunkSize = 5; const chunks = []; ``` for (let i = 0; i < lines.length; i += chunkSize) { chunks.push(lines.slice(i, i + chunkSize).join('\n')); } const state = generateVarName('state'); const jumptable = generateVarName('jt'); const exec = generateVarName('exec'); const step = generateVarName('step'); // Générer des indices aléatoires const indices = chunks.map((_, i) => Math.floor(Math.random() * 10000) + i * 1000); let switchCode = `local ${state}=${indices[0]}\nlocal ${jumptable}={\n`; chunks.forEach((chunk, idx) => { const nextIdx = idx + 1 < chunks.length ? indices[idx + 1] : -1; const junk = Math.random() > 0.5 ? createJunkCode(2) : ''; switchCode += `[${indices[idx]}]=function()\n${junk}\n${chunk}\n${state}=${nextIdx}\nend,\n`; }); switchCode += `}\nwhile ${state}~=-1 do\nlocal ${exec}=${jumptable}[${state}]\nif ${exec} then\n${exec}()\nelse\nbreak\nend\nend`; return switchCode; ``` }; const obfuscate = () => { if (!input.trim()) { alert(‘⚠️ Veuillez entrer du code Lua à protéger’); return; } ``` setProcessing(true); setTimeout(() => { try { let code = input; const varMap = new Map(); const decryptor = generateVarName('decrypt'); // Phase 1: Créer le décrypteur de strings const stringDecryptor = createStringDecryptor(); code = stringDecryptor + '\n' + code; // Phase 2: Renommer TOUTES les variables avec noms confusants const varPattern = /\b(local\s+)?([a-zA-Z_][a-zA-Z0-9_]*)\s*=/g; const funcPattern = /function\s+([a-zA-Z_][a-zA-Z0-9_]*)/g; let match; const reserved = ['print', 'string', 'table', 'math', 'pairs', 'ipairs', 'next', 'tonumber', 'tostring', 'type', 'assert', 'error', 'pcall', 'xpcall', 'getfenv', 'setfenv', 'getmetatable', 'setmetatable', 'rawget', 'rawset', 'rawequal', 'unpack', 'select', 'os', 'io', 'debug', 'coroutine', 'require', 'load', 'loadstring', 'bit32']; while ((match = varPattern.exec(input)) !== null) { const varName = match[2]; if (!reserved.includes(varName) && !varMap.has(varName)) { varMap.set(varName, generateVarName('var')); } } while ((match = funcPattern.exec(input)) !== null) { const funcName = match[1]; if (!reserved.includes(funcName) && !varMap.has(funcName)) { varMap.set(funcName, generateVarName('func')); } } // Appliquer le renommage varMap.forEach((newName, oldName) => { const regex = new RegExp('\\b' + oldName + '\\b', 'g'); code = code.replace(regex, newName); }); // Phase 3: Crypter TOUTES les strings code = code.replace(/"([^"]*)"/g, (match, str) => { if (str.length > 0 && str.length < 200) { const encrypted = encryptString(str); return `${decryptor}("${encrypted}")`; } return match; }); code = code.replace(/'([^']*)'/g, (match, str) => { if (str.length > 0 && str.length < 200) { const encrypted = encryptString(str); return `${decryptor}("${encrypted}")`; } return match; }); // Phase 4: Obfusquer les constantes code = obfuscateConstants(code); // Phase 5: Ajouter du code inutile massif const junkBefore = createJunkCode(30); const junkMiddle = createJunkCode(25); const junkAfter = createJunkCode(30); code = junkBefore + '\n' + code + '\n' + junkMiddle; // Phase 6: Control Flow Obfuscation (State Machine) code = createControlFlowObfuscation(code); // Phase 7: Anti-tamper et anti-debug const antiTamper = createAntiTamper(); code = antiTamper + '\n' + code; // Phase 8: Ajouter le décodeur VM (style MoonSec) const vmDecoder = createVMDecoder(); code = vmDecoder + '\n' + code + '\n' + junkAfter; // Phase 9: Wrapper avec plusieurs couches const layers = []; for (let i = 0; i < 5; i++) { const wrapper = generateVarName('wrapper'); const exec = generateVarName('exec'); layers.push(`local ${wrapper}=function()return function()${i === 0 ? code : ''}end end;local ${exec}=${wrapper}()`); } code = layers.join('\n') + '\n' + code; // Phase 10: Encodage final multi-couches const finalKey1 = Math.floor(Math.random() * 255) + 1; const finalKey2 = Math.floor(Math.random() * 255) + 1; let encrypted1 = ''; for (let i = 0; i < code.length; i++) { encrypted1 += String.fromCharCode(code.charCodeAt(i) ^ finalKey1); } let encrypted2 = ''; for (let i = 0; i < encrypted1.length; i++) { encrypted2 += (encrypted1.charCodeAt(i) ^ finalKey2).toString(16).padStart(2, '0'); } // Loader final ultra-compacté const l1 = generateVarName(); const l2 = generateVarName(); const l3 = generateVarName(); const l4 = generateVarName(); const l5 = generateVarName(); const l6 = generateVarName(); const l7 = generateVarName(); const finalCode = `(function()local ${l1}=${finalKey1};local ${l2}=${finalKey2};local ${l3}=function(${l4})local ${l5}="";for ${l6}=1,#${l4},2 do ${l5}=${l5}..string.char(tonumber(${l4}:sub(${l6},${l6}+1),16)~${l2})end;return ${l5} end;local ${l7}=function(${l4})local ${l5}="";for ${l6}=1,#${l4} do ${l5}=${l5}..string.char(string.byte(${l4},${l6})~${l1})end;return ${l5} end;load(${l7}(${l3}("${encrypted2}")))()end)()`; setOutput(finalCode); } catch (e) { alert('❌ Erreur lors de l\'obfuscation: ' + e.message); } finally { setProcessing(false); } }, 100); ``` }; const copyToClipboard = () => { navigator.clipboard.writeText(output); setCopied(true); setTimeout(() => setCopied(false), 2000); }; const downloadFile = () => { const blob = new Blob([output], { type: ‘text/plain’ }); const url = URL.createObjectURL(blob); const a = document.createElement(‘a’); a.href = url; a.download = ‘moonsec_protected.lua’; a.click(); URL.revokeObjectURL(url); }; return (
Protection Militaire Lua • Impossible à Déchiffrer
Machine virtuelle pour exécution
3 couches de cryptage XOR
Flux non-linéaire avec jump table
l1lIl1, Il1lI, O0OoO (impossible à lire)
Toutes les strings cryptées
Détection de debugging
85+ lignes de code inutile
Nombres transformés en expressions
5 couches d'enveloppement
Tout le code en hexadécimal
⚠️ ULTRA PROTECTION ACTIVÉE
Ce niveau de protection est utilisé par les meilleurs executors Roblox et protections commerciales.
Même les déobfuscateurs professionnels auront du mal. Ton code est maintenant INCRAQUABLE! 💀🔥