false, 'error' => 'No code provided']); exit; } $code = $input['code']; class LuartexHyperionV8_1 { private $rawCode; private $constants = []; private $instructions = []; private $keys = []; private $opMap = []; private $polyKey; public function __construct($code) { $this->rawCode = $code; $this->polyKey = rand(10, 200); for ($i = 0; $i < 32; $i++) { $this->keys[] = rand(0, 255); } $this->setupOpcodes(); } private function setupOpcodes() { $ops = [ 'LOADK', 'GETGLOBAL', 'SETGLOBAL', 'CALL', 'MOVE', 'ADD', 'SUB', 'MUL', 'DIV', 'MOD', 'POW', 'JMP', 'EQ', 'LT', 'LE', 'RETURN', 'GETTABLE', 'SETTABLE', 'NEWTABLE', 'CLOSURE', 'VARARG', 'FORPREP', 'FORLOOP', 'AND', 'OR', 'NOT', 'LEN', 'TFORLOOP', 'SETLIST', 'CLOSE', 'JUNK1', 'JUNK2', 'JUNK3', 'OPAQUE', 'SET_GLOBAL_CONST', 'MOVE_GLOBAL', 'CALL_GLOBAL_K', 'CALL_GLOBAL_V', 'RECURSIVE_CALL', 'TAMPER_CHECK', 'LAYER_ENTER', 'STACK_SHUFFLE', 'LOAD_ASM_MATH', 'POLY_SHIFT' ]; shuffle($ops); foreach ($ops as $op) { $this->opMap[$op] = rand(0, 255); } } private function genVar($len = 32) { $sets = ['l1Ii', 'O0Q', 'uvvw', 'nmM', 'S5s', 'Z2z', 'B8b', 'g9q']; $res = '_'; for($i=0; $i<$len; $i++) { $set = $sets[array_rand($sets)]; $res .= $set[rand(0, strlen($set)-1)]; } return $res . bin2hex(random_bytes(2)); } private function genAssemblyMath($n) { $bytecode = []; $current = 0; $target = (float)$n; for ($i = 0; $i < 12; $i++) { $op = rand(1, 4); $imm = rand(1, 20); switch($op) { case 1: $current += $imm; break; case 2: $current -= $imm; break; case 3: $current *= ($imm % 3 + 1); break; case 4: $current = (int)$current ^ $imm; break; } $bytecode[] = ($imm << 3) | ($op & 0x7); } return ['ops' => $bytecode, 'remainder' => $target - $current]; } private function addConst($val) { $idx = array_search($val, $this->constants); if ($idx === false) { $this->constants[] = $val; $idx = count($this->constants) - 1; } return $idx; } private function emitJunk() { if (rand(0, 10) > 6) { $junkOps = ['JUNK1', 'JUNK2', 'JUNK3', 'OPAQUE']; $op = $junkOps[array_rand($junkOps)]; $this->instructions[] = [$this->opMap[$op], rand(0, 255), rand(0, 255), rand(0, 255)]; } } private function compile() { $this->addConst("Hyperion V8.1 - Table Virtualization & Roblox Optimized Engine"); $cleanCode = $this->rawCode; $cleanCode = preg_replace('/--[[]*.*?[]]*--/s', '', $cleanCode); $cleanCode = preg_replace('/--.*$/m', '', $cleanCode); $tokens = preg_split('/[; ]+/', $cleanCode); foreach ($tokens as $token) { $token = trim($token); if (empty($token)) continue; $this->emitJunk(); // local t = {} if (preg_match('/^(?:local\s+)?([a-zA-Z_]\w*)\s*=\s*\{\}$/', $token, $m)) { $this->instructions[] = [$this->opMap['NEWTABLE'], 0, 0, 0]; $sIdx = $this->addConst($m[1]); $this->instructions[] = [$this->opMap['SETGLOBAL'], 0, $sIdx, 0]; } // t["key"] = value or t.key = value elseif (preg_match('/^([a-zA-Z_]\w*)\s*[.[\]\s*["\']?(.*?)["\']?\s*[\\\]]?\s*=\s*(.*)$/', $token, $m)) { $this->emitTableSet($m[1], $m[2], $m[3]); } // function call elseif (preg_match('/^([a-zA-Z_]\w*(?:[.:]\w*)*)\s*\((.*?)\)$/', $token, $m)) { $this->emitCall($m[1], $m[2]); } // assignment elseif (preg_match('/^(?:local\s+)?([a-zA-Z_]\w*)\s*=\s*(.*)$/', $token, $m)) { $this->emitAssignment($m[1], $m[2]); } $this->emitJunk(); } $this->instructions[] = [$this->opMap['RETURN'], 0, 0, 0]; } private function emitTableSet($tableName, $key, $val) { $tIdx = $this->addConst($tableName); $this->instructions[] = [$this->opMap['GETGLOBAL'], 0, $tIdx, 0]; $kIdx = $this->addConst($key); $val = trim($val); $vReg = 1; if (preg_match('/^["\'](.*)["\']$/', $val, $vm)) { $vIdx = $this->addConst($vm[1]); $this->instructions[] = [$this->opMap['LOADK'], $vReg, $vIdx, 0]; } elseif (is_numeric($val)) { $asm = $this->genAssemblyMath($val); $vIdx = $this->addConst(json_encode($asm)); $this->instructions[] = [$this->opMap['LOAD_ASM_MATH'], $vReg, $vIdx, 0]; } else { $vIdx = $this->addConst($val); $this->instructions[] = [$this->opMap['GETGLOBAL'], $vReg, $vIdx, 0]; } $this->instructions[] = [$this->opMap['SETTABLE'], 0, $kIdx, $vReg]; } private function emitCall($funcName, $argStr) { $fIdx = $this->addConst($funcName); $this->instructions[] = [$this->opMap['GETGLOBAL'], 0, $fIdx, 0]; $args = []; if (!empty(trim($argStr))) { $rawArgs = explode(',', $argStr); foreach ($rawArgs as $idx => $arg) { $arg = trim($arg); $rIdx = $idx + 1; // Check if it's a table access: t.key or t["key"] if (preg_match('/^([a-zA-Z_]\w*)\s*[.[\]\s*["\']?(.*?)["\']?\s*[\\\]]?$/', $arg, $m)) { $tIdx = $this->addConst($m[1]); $this->instructions[] = [$this->opMap['GETGLOBAL'], 100, $tIdx, 0]; // temp reg 100 $kIdx = $this->addConst($m[2]); $this->instructions[] = [$this->opMap['GETTABLE'], $rIdx, 100, $kIdx]; } else { $first = substr($arg, 0, 1); $last = substr($arg, -1); if (($first == '"' || $first == "'") && $first == $last) { $vIdx = $this->addConst(substr($arg, 1, -1)); $this->instructions[] = [$this->opMap['LOADK'], $rIdx, $vIdx, 0]; } elseif (is_numeric($arg)) { $asm = $this->genAssemblyMath($arg); $vIdx = $this->addConst(json_encode($asm)); $this->instructions[] = [$this->opMap['LOAD_ASM_MATH'], $rIdx, $vIdx, 0]; } else { $vIdx = $this->addConst($arg); $this->instructions[] = [$this->opMap['GETGLOBAL'], $rIdx, $vIdx, 0]; } } $args[] = $rIdx; } } $this->instructions[] = [$this->opMap['CALL'], 0, count($args), 0]; } private function emitAssignment($var, $val) { $val = trim($val); // Check if it's a table access: t.key or t["key"] if (preg_match('/^([a-zA-Z_]\w*)\s*[.[\]\s*["\']?(.*?)["\']?\s*[\\\]]?$/', $val, $m)) { $tIdx = $this->addConst($m[1]); $this->instructions[] = [$this->opMap['GETGLOBAL'], 1, $tIdx, 0]; $kIdx = $this->addConst($m[2]); $this->instructions[] = [$this->opMap['GETTABLE'], 0, 1, $kIdx]; } else { $first = substr($val, 0, 1); $last = substr($val, -1); if (($first == '"' || $first == "'") && $first == $last) { $vIdx = $this->addConst(substr($val, 1, -1)); $this->instructions[] = [$this->opMap['LOADK'], 0, $vIdx, 0]; } elseif (is_numeric($val)) { $asm = $this->genAssemblyMath($val); $vIdx = $this->addConst(json_encode($asm)); $this->instructions[] = [$this->opMap['LOAD_ASM_MATH'], 0, $vIdx, 0]; } else { $vIdx = $this->addConst($val); $this->instructions[] = [$this->opMap['GETGLOBAL'], 0, $vIdx, 0]; } } $sIdx = $this->addConst($var); $this->instructions[] = [$this->opMap['SETGLOBAL'], 0, $sIdx, 0]; } private function serializeAll() { $bin = ""; $bin .= pack("N", count($this->instructions)); foreach ($this->instructions as $pc_idx => $inst) { $pc = $pc_idx + 1; $op = (int)$inst[0]; $mask = ($this->polyKey + $pc) % 256; $raw_op = $op ^ $mask; $bin .= chr($raw_op); $bin .= chr((int)$inst[1] & 0xFF); $bin .= pack("n", (int)$inst[2]); $bin .= chr((int)$inst[3] & 0xFF); } $bin .= pack("N", count($this->constants)); foreach ($this->constants as $c) { if (is_string($c)) { $bin .= chr(1); $bin .= pack("N", strlen($c)); $bin .= $c; } elseif (is_numeric($c)) { $bin .= chr(2); $sNum = (string)$c; $bin .= pack("N", strlen($sNum)); $bin .= $sNum; } else { $bin .= chr(0); } } $keyLen = count($this->keys); $enc = ""; for ($i = 0; $i < strlen($bin); $i++) { $enc .= chr(ord($bin[$i]) ^ $this->keys[$i % $keyLen] ^ (($i * 17) % 256)); } return bin2hex($enc); } public function build() { $this->compile(); $k_v = $this->genVar(); $b_v = $this->genVar(); $e_v = $this->genVar(); $f_v = $this->genVar(); $d_v = $this->genVar(); $c_v = $this->genVar(); $v_v = $this->genVar(); $stack_v = $this->genVar(); $asm_v = $this->genVar(); $poly_v = $this->genVar(); $handlers_v = $this->genVar(); $tamper_v = $this->genVar(); $watchdog_v = $this->genVar(); $fetch_v = $this->genVar(); $tk_v = $this->genVar(); // transformKey $k_str = implode(",", $this->keys); $allHex = $this->serializeAll(); $lua = "-- [[ Hyperion Engine V8.1 - Roblox Optimized ]] --\n"; $lua .= "local " . $k_v . " = { " . $k_str . " }; "; $lua .= "local " . $b_v . " = \"" . $allHex . "\"; "; $lua .= "local " . $e_v . " = (getgenv and getgenv()) or (getfenv and getfenv(0)) or _G; "; // Optimized hex decoder $lua .= "local function _H(h) local b = {}; for i = 1, #h, 2 do b[#b+1] = tonumber(h:sub(i, i+1), 16) end return b end; "; // Decryption function $lua .= "local function _D(b) local o = {}; for i = 1, #b do local k = ((i - 1) % 32) + 1; o[i] = bit32.bxor(b[i], " . $k_v . "[k], ((i - 1) * 17) % 256) end return o end; "; $lua .= "local " . $d_v . " = _D(_H(" . $b_v . ")); "; // Helpers $lua .= "local function _R32(b, p) return b[p]*16777216 + b[p+1]*65536 + b[p+2]*256 + b[p+3] end; "; $lua .= "local function _R16(b, p) return b[p]*256 + b[p+1] end; "; $lua .= "local ic = _R32(" . $d_v . ", 1); "; $lua .= "local co = 5 + ic * 5; "; $lua .= "local cc = _R32(" . $d_v . ", co); "; $lua .= "local " . $c_v . " = {}; "; $lua .= "local cu = co + 4; "; // Constant loading $lua .= "for i = 1, cc do "; $lua .= "local t = " . $d_v . "[cu]; cu = cu + 1; "; $lua .= "if t == 1 or t == 2 then "; $lua .= "local l = _R32(" . $d_v . ", cu); cu = cu + 4; "; $lua .= "local s = {}; for j = 1, l do s[j] = string.char(" . $d_v . "[cu]); cu = cu + 1 end; "; $lua .= "s = table.concat(s); if t == 2 then " . $c_v . "[i] = tonumber(s) else " . $c_v . "[i] = s end; "; $lua .= "else cu = cu + 1 end end; "; // Table Virtualization: Key Transformation $lua .= "local function " . $tk_v . "(k, s) if type(k) ~= 'string' then return k end; local r = {}; for i = 1, #k do r[i] = string.char(bit32.bxor(k:byte(i), s)) end; return table.concat(r) end; "; // Assembly Math sub-VM $lua .= "local function " . $asm_v . "(data) "; $lua .= "local ops = {}; for x in data:gmatch('\"ops\":%[(.-)%]') do for v in x:gmatch('%d+') do ops[#ops+1] = tonumber(v) end end; "; $lua .= "local rem = 0; for x in data:gmatch('\"remainder\":(%-?%d+%.?%d*)') do rem = tonumber(x) end; "; $lua .= "local val = 0; "; $lua .= "for i = 1, #ops do "; $lua .= "local op = bit32.band(ops[i], 0x7); local imm = bit32.rshift(ops[i], 3); "; $lua .= "if op == 1 then val = val + imm elseif op == 2 then val = val - imm elseif op == 3 then val = val * ((imm % 3) + 1) elseif op == 4 then val = bit32.bxor(val, imm) end; "; $lua .= "end; return val + rem; end; "; // Anti-Tamper $lua .= "local function " . $tamper_v . "() "; $lua .= "local is_re = false; "; $lua .= "if debug and debug.info then "; $lua .= "local s = debug.info(print, 's'); if s ~= '[C]' then is_re = true end; "; $lua .= "end; "; $lua .= "if type(bit32) ~= 'table' or type(bit32.bxor) ~= 'function' then is_re = true end; "; $lua .= "if is_re then while true do end end; "; $lua .= "end; "; $lua .= "local function " . $fetch_v . "(p) local o = 5 + (p - 1) * 5; "; $lua .= "return " . $d_v . "[o], " . $d_v . "[o+1], _R16(" . $d_v . ", o+2), " . $d_v . "[o+4] end; "; $lua .= "local " . $poly_v . " = " . $this->polyKey . "; "; // VM Implementation $lua .= "local " . $v_v . " = function() "; $lua .= "local " . $stack_v . " = {}; local pc = 1; local " . $watchdog_v . " = 0; "; $lua .= "local " . $handlers_v . " = {}; "; // Define Handlers foreach ($this->opMap as $name => $val) { $lua .= $handlers_v . "[" . $val . "] = function(a, b, c) "; switch($name) { case 'GETGLOBAL': $lua .= "local n = " . $c_v . "[b + 1]; local t = " . $e_v . "; for p in n:gmatch('[^.:]+') do t = t[p] end; " . $stack_v . "[a] = t; "; break; case 'LOADK': $lua .= $stack_v . "[a] = " . $c_v . "[b + 1]; "; break; case 'LOAD_ASM_MATH': $lua .= $stack_v . "[a] = " . $asm_v . "(" . $c_v . "[b + 1]); "; break; case 'CALL': $lua .= "local f = " . $stack_v . "[a]; local args = {}; for m = 1, b do args[m] = " . $stack_v . "[a + m] end; if f then f((table.unpack or unpack)(args)) end; "; break; case 'SETGLOBAL': $lua .= "local n = " . $c_v . "[b + 1]; " . $e_v . "[n] = " . $stack_v . "[a]; "; break; case 'RETURN': $lua .= "pc = -1; "; break; case 'NEWTABLE': $lua .= $stack_v . "[a] = {__isVTable = true, data = {}, seed = math.random(1, 255)}; "; break; case 'SETTABLE': $lua .= "local t = " . $stack_v . "[a]; local k = " . $c_v . "[b + 1]; local v = " . $stack_v . "[c]; if type(t) == 'table' and t.__isVTable then t.data[" . $tk_v . "(k, t.seed)] = v else t[k] = v end; "; break; case 'GETTABLE': $lua .= "local t = " . $stack_v . "[b]; local k = " . $c_v . "[c + 1]; if type(t) == 'table' and t.__isVTable then " . $stack_v . "[a] = t.data[" . $tk_v . "(k, t.seed)] else " . $stack_v . "[a] = t[k] end; "; break; case 'JUNK1': case 'JUNK2': case 'JUNK3': $lua .= "local x = a + b + c; "; break; case 'OPAQUE': $lua .= "if math.abs(a) < -1 then pc = pc + b end; "; break; case 'TAMPER_CHECK': $lua .= $tamper_v . "(); "; break; default: $lua .= " "; break; } $lua .= "end; "; } // Main Dispatch Loop $lua .= "while pc > 0 do "; $lua .= "local raw_op, a, b, c = " . $fetch_v . "(pc); if not raw_op then break end; "; $lua .= "local op = bit32.bxor(raw_op, (" . $poly_v . " + pc) % 256); "; $lua .= "local h = " . $handlers_v . "[op]; "; $lua .= "if h then h(a, b, c) end; "; $lua .= "pc = pc + 1; " . $watchdog_v . " = " . $watchdog_v . " + 1; "; $lua .= "if " . $watchdog_v . " > 5000 then " . $watchdog_v . " = 0; if task and task.wait then task.wait() elseif wait then wait() end end; "; $lua .= "end end; "; $lua .= "pcall(" . $v_v . "); "; return [ 'success' => true, 'protected_code' => $lua, 'stats' => ['original_size' => strlen($this->rawCode), 'protected_size' => strlen($lua), 'vm_version' => '8.1-table-virt'] ]; } } try { $vm = new LuartexHyperionV8_1($code); echo json_encode($vm->build()); } catch (Exception $e) { echo json_encode(['success' => false, 'error' => $e->getMessage()]); }