diff --git a/process.php b/process.php index f9d326e..8abe134 100644 --- a/process.php +++ b/process.php @@ -37,7 +37,8 @@ class LuartexHyperionV5 { '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' + 'TFORLOOP', 'SETLIST', 'CLOSE', 'JUNK1', 'JUNK2', 'JUNK3', 'OPAQUE', + 'SET_GLOBAL_CONST', 'MOVE_GLOBAL', 'CALL_GLOBAL_K', 'CALL_GLOBAL_V' ]; shuffle($ops); foreach ($ops as $op) { @@ -61,24 +62,98 @@ class LuartexHyperionV5 { return $idx; } - private function encryptData($data) { - if (is_string($data)) { - $out = []; - for ($i = 0; $i < strlen($data); $i++) { - $out[] = ord($data[$i]) ^ $this->keys[$i % 32] ^ ($i % 255); - } - return $out; + private function genOpaquePredicate($type = 'true') { + $truePreds = [ + "(math.pi > 3)", + "(type(math.abs) == 'function')", + "(math.floor(10.5) == 10)", + "(#('Hyperion') == 8)", + "(math.sin(0) == 0)", + "(not (1 == 0))", + "(math.abs(-1) == 1)", + "(math.ceil(5.1) == 6)" + ]; + $falsePreds = [ + "(math.pi < 3)", + "(type(math.abs) == 'string')", + "(math.floor(10.5) == 11)", + "(#('Hyperion') == 9)", + "(math.sin(0) == 1)", + "(1 == 0)", + "(math.abs(-1) == 0)", + "(math.ceil(5.1) == 5)" + ]; + + if ($type === 'true') { + return $truePreds[array_rand($truePreds)]; + } else { + return $falsePreds[array_rand($falsePreds)]; } - return (int)$data ^ $this->keys[0]; + } + + private function foldInstructions() { + $folded = []; + $i = 0; + $count = count($this->instructions); + + while ($i < $count) { + $inst = $this->instructions[$i]; + + if ($i + 2 < $count) { + $n1 = $this->instructions[$i + 1]; + $n2 = $this->instructions[$i + 2]; + + // Pattern: GETGLOBAL(0, f) + LOADK(1, v) + CALL(0, 1) -> CALL_GLOBAL_K(f, v) + if ($inst[0] === $this->opMap['GETGLOBAL'] && $inst[1] === 0 && + $n1[0] === $this->opMap['LOADK'] && $n1[1] === 1 && + $n2[0] === $this->opMap['CALL'] && $n2[1] === 0 && $n2[2] === 1) { + $folded[] = [$this->opMap['CALL_GLOBAL_K'], $inst[2], $n1[2]]; + $i += 3; + continue; + } + + // Pattern: GETGLOBAL(0, f) + GETGLOBAL(1, v) + CALL(0, 1) -> CALL_GLOBAL_V(f, v) + if ($inst[0] === $this->opMap['GETGLOBAL'] && $inst[1] === 0 && + $n1[0] === $this->opMap['GETGLOBAL'] && $n1[1] === 1 && + $n2[0] === $this->opMap['CALL'] && $n2[1] === 0 && $n2[2] === 1) { + $folded[] = [$this->opMap['CALL_GLOBAL_V'], $inst[2], $n1[2]]; + $i += 3; + continue; + } + } + + if ($i + 1 < $count) { + $next = $this->instructions[$i + 1]; + + // Pattern: LOADK(0, v) + SETGLOBAL(0, s) -> SET_GLOBAL_CONST(s, v) + if ($inst[0] === $this->opMap['LOADK'] && $next[0] === $this->opMap['SETGLOBAL'] && $inst[1] === 0 && $next[1] === 0) { + $folded[] = [$this->opMap['SET_GLOBAL_CONST'], $next[2], $inst[2]]; + $i += 2; + continue; + } + + // Pattern: GETGLOBAL(0, v) + SETGLOBAL(0, s) -> MOVE_GLOBAL(s, v) + if ($inst[0] === $this->opMap['GETGLOBAL'] && $next[0] === $this->opMap['SETGLOBAL'] && $inst[1] === 0 && $next[1] === 0) { + $folded[] = [$this->opMap['MOVE_GLOBAL'], $next[2], $inst[2]]; + $i += 2; + continue; + } + } + + $folded[] = $inst; + $i++; + } + $this->instructions = $folded; } private function compile() { - $this->addConst("Hyperion V5.2 - LPH HARDENED"); + $this->addConst("Hyperion V5.8 - Instruction Folding"); - $cleanCode = preg_replace('/--[[]*.*?[]]*--/s', '', $this->rawCode); + $cleanCode = $this->rawCode; + // Simple comment stripping + $cleanCode = preg_replace('/--\[\[.*?\].*?\]\]--/s', '', $cleanCode); $cleanCode = preg_replace('/--.*$/m', '', $cleanCode); - // Splitting by semicolon or newline $tokens = preg_split('/[; ]+/', $cleanCode); @@ -86,21 +161,23 @@ class LuartexHyperionV5 { $token = trim($token); if (empty($token)) continue; - // Opcode JUNK generation - if (rand(1, 10) > 7) { - $this->instructions[] = [$this->opMap['JUNK1'], rand(0, 255), rand(0, 255)]; + if (rand(1, 10) > 6) { + if (rand(0, 1) == 0) { + $this->instructions[] = [$this->opMap['JUNK1'], rand(0, 255), rand(0, 255)]; + } else { + $this->instructions[] = [$this->opMap['OPAQUE'], rand(0, 255), rand(0, 255)]; + } } - // Function Call Pattern: game:GetService("LogService") if (preg_match('/^([a-zA-Z_]\w*(?:[.:]\w*)*)\s*\((.*?)\)$/', $token, $m)) { $this->emitCall($m[1], $m[2]); } - // Assignment Pattern: local x = 10 elseif (preg_match('/^(?:local\s+)?([a-zA-Z_]\w*)\s*=\s*(.*)$/', $token, $m)) { $this->emitAssignment($m[1], $m[2]); } } + $this->foldInstructions(); $this->instructions[] = [$this->opMap['RETURN'], 0, 0]; } @@ -110,21 +187,21 @@ class LuartexHyperionV5 { $args = []; if (!empty(trim($argStr))) { - // Very basic comma split (doesn't handle commas in strings, but good enough for this demo) $rawArgs = explode(',', $argStr); foreach ($rawArgs as $idx => $arg) { $arg = trim($arg); + $rIdx = $idx + 1; if (preg_match('/^["\'](.*)["\']$/s', $arg, $m)) { $vIdx = $this->addConst($m[1]); - $this->instructions[] = [$this->opMap['LOADK'], $idx + 1, $vIdx]; + $this->instructions[] = [$this->opMap['LOADK'], $rIdx, $vIdx]; } elseif (is_numeric($arg)) { $vIdx = $this->addConst((float)$arg); - $this->instructions[] = [$this->opMap['LOADK'], $idx + 1, $vIdx]; + $this->instructions[] = [$this->opMap['LOADK'], $rIdx, $vIdx]; } else { $vIdx = $this->addConst($arg); - $this->instructions[] = [$this->opMap['GETGLOBAL'], $idx + 1, $vIdx]; + $this->instructions[] = [$this->opMap['GETGLOBAL'], $rIdx, $vIdx]; } - $args[] = $idx + 1; + $args[] = $rIdx; } } $this->instructions[] = [$this->opMap['CALL'], 0, count($args)]; @@ -147,104 +224,125 @@ class LuartexHyperionV5 { $this->instructions[] = [$this->opMap['SETGLOBAL'], 0, $sIdx]; } + private function serializeAll() { + $bin = ""; + + // 1. Instructions + $bin .= pack("N", count($this->instructions)); + foreach ($this->instructions as $inst) { + $op = (int)$inst[0]; + $bin .= chr(($op >> 16) & 0xFF) . chr(($op >> 8) & 0xFF) . chr($op & 0xFF); + $bin .= pack("n", (int)$inst[1]); + $bin .= pack("n", (int)$inst[2]); + } + + // 2. Constants + $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 * 13) % 256)); + } + + return bin2hex($enc); + } + public function build() { $this->compile(); - $k_v = $this->genVar(12); // Keys - $c_v = $this->genVar(12); // Constants - $i_v = $this->genVar(12); // Instructions - $s_v = $this->genVar(12); // Stack - $pc_v = $this->genVar(12); // PC - $e_v = $this->genVar(12); // Env - $d_v = $this->genVar(12); // Decryptor + $k_v = $this->genVar(12); $b_v = $this->genVar(12); $e_v = $this->genVar(12); + $f_v = $this->genVar(12); $d_v = $this->genVar(12); $c_v = $this->genVar(12); - $encConsts = []; - foreach ($this->constants as $c) { - $encConsts[] = "{" . implode(',', $this->encryptData($c)) . "}"; - } - - $encInsts = []; - foreach ($this->instructions as $inst) { - $encInsts[] = "{" . - ((int)$inst[0] ^ $this->keys[0]) . "," . - ((int)$inst[1] ^ $this->keys[1]) . "," . - ((int)$inst[2] ^ $this->keys[2]) . "}"; - } - $k_str = implode(',', $this->keys); + $allHex = $this->serializeAll(); - $lua = "-- [[ Hyperion Engine V5.2 - Licensed for " . $this->vm_id . " ]] --\n"; - $lua .= "local _LPH_ = {}; "; // Luraph compatible header - $lua .= "local " . $k_v . " = {" . $k_str . "}; "; - $lua .= "local " . $c_v . " = {" . implode(',', $encConsts) . "}; "; - $lua .= "local " . $i_v . " = {" . implode(',', $encInsts) . "}; "; + $lua = "-- [[ Hyperion Engine V5.8 - Instruction Folding ]] --\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; "; - // Advanced Decryptor with salt - $lua .= "local function " . $d_v . "(_b, _idx) "; - $lua .= "if type(_b) ~= 'table' then return _b end; "; - $lua .= "local _o = ''; for _p = 1, #_b do "; - $lua .= "local _kidx = ((_p - 1) % 32) + 1; "; - $lua .= "_o = _o .. string.char(bit32.bxor(_b[_p], " . $k_v . "[_kidx], (_p - 1) % 255)) "; - $lua .= "end return _o; "; - $lua .= "end; "; + $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; "; + $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) * 13) % 256) end return o end; "; + $lua .= "local " . $d_v . " = _D(_H(" . $b_v . ")); "; - // VM Body - $lua .= "local function _V() "; - $lua .= "local " . $s_v . " = {}; "; - $lua .= "local " . $pc_v . " = 1; "; + $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; "; - // Control Flow Flattening Dispatcher - $lua .= "while true do "; - $lua .= "local _data = " . $i_v . "[" . $pc_v . "] ; "; - $lua .= "if not _data then break end; "; + $lua .= "local ic = _R32(" . $d_v . ", 1); "; + $lua .= "local co = 5 + ic * 7; "; + $lua .= "local cc = _R32(" . $d_v . ", co); "; - $lua .= "local _op = bit32.bxor(_data[1], " . $k_v . "[1]); "; - $lua .= "local _a = bit32.bxor(_data[2], " . $k_v . "[2]); "; - $lua .= "local _b = bit32.bxor(_data[3], " . $k_v . "[3]); "; + $lua .= "local " . $c_v . " = {}; "; + $lua .= "local cu = co + 4; "; + $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; "; + $lua .= "local function " . $f_v . "(p) local o = 5 + (p - 1) * 7; "; + $lua .= "return " . $d_v . "[o]*65536 + " . $d_v . "[o+1]*256 + " . $d_v . "[o+2], _R16(" . $d_v . ", o+3), _R16(" . $d_v . ", o+5) end; "; + + $lua .= "local function _V() local stack = {}; local pc = 1; while true do local op, a, b = " . $f_v . "(pc); "; + $cases = []; - // GETGLOBAL - $cases[] = "if _op == " . $this->opMap['GETGLOBAL'] . " then " . - "local _n = " . $d_v . "(" . $c_v . "[_b + 1]); " . - "local _target = " . $e_v . "; for _part in _n:gmatch('[^.:]+') do _target = _target[_part] end; " . - $s_v . "[_a] = _target; "; - - // LOADK - $cases[] = "elseif _op == " . $this->opMap['LOADK'] . " then " . - $s_v . "[_a] = " . $d_v . "(" . $c_v . "[_b + 1]); "; - - // CALL - $cases[] = "elseif _op == " . $this->opMap['CALL'] . " then " . - "local _f = " . $s_v . "[_a]; " . - "local _args = {}; for _m = 1, _b do _args[_m] = " . $s_v . "[_a + _m] end; " . - "local _ok, _err = pcall(_f, unpack(_args)); if not _ok then error('LPH VM ERROR: ' .. tostring(_err)) end; "; - - // SETGLOBAL - $cases[] = "elseif _op == " . $this->opMap['SETGLOBAL'] . " then " . - "local _n = " . $d_v . "(" . $c_v . "[_b + 1]); " . - $e_v . "[_n] = " . $s_v . "[_a]; "; - - // MOVE - $cases[] = "elseif _op == " . $this->opMap['MOVE'] . " then " . - $s_v . "[_a] = " . $s_v . "[_b]; "; - - // RETURN - $cases[] = "elseif _op == " . $this->opMap['RETURN'] . " then return; "; + $op_getglobal = $this->opMap['GETGLOBAL']; + $cases[] = "elseif op == $op_getglobal then if " . $this->genOpaquePredicate('true') . " then local n = " . $c_v . "[b + 1]; local t = " . $e_v . "; for p in n:gmatch('[^.:]+') do t = t[p] end; stack[a] = t; else pc = pc + 666 end; "; - // JUNK Opcodes (Opaque Predicates) - $cases[] = "elseif _op == " . $this->opMap['JUNK1'] . " then " . - "local _x = " . rand(1, 1000) . "; if _x < 0 then " . $pc_v . " = -1 end; "; + $op_loadk = $this->opMap['LOADK']; + $cases[] = "elseif op == $op_loadk then if " . $this->genOpaquePredicate('false') . " then pc = pc * 2 else stack[a] = " . $c_v . "[b + 1] end; "; + + $op_call = $this->opMap['CALL']; + $cases[] = "elseif op == $op_call then if " . $this->genOpaquePredicate('true') . " then local f = stack[a]; local args = {}; for m = 1, b do args[m] = stack[a + m] end; local ok, err = pcall(f, unpack(args)); if not ok then error('VM Error: ' .. tostring(err)) end; end; "; + + $op_setglobal = $this->opMap['SETGLOBAL']; + $cases[] = "elseif op == $op_setglobal then if " . $this->genOpaquePredicate('true') . " then local n = " . $c_v . "[b + 1]; " . $e_v . "[n] = stack[a]; end; "; + + $op_move = $this->opMap['MOVE']; + $cases[] = "elseif op == $op_move then stack[a] = stack[b]; "; + + $op_return = $this->opMap['RETURN']; + $cases[] = "elseif op == $op_return then if " . $this->genOpaquePredicate('false') . " then print('DEAD CODE') else return end; "; + + $op_junk1 = $this->opMap['JUNK1']; + $cases[] = "elseif op == $op_junk1 then if " . $this->genOpaquePredicate('false') . " then pc = -1 end; "; + + $op_opaque = $this->opMap['OPAQUE']; + $cases[] = "elseif op == $op_opaque then if " . $this->genOpaquePredicate('true') . " then local x = math.sqrt(a * b); stack[0] = x; else stack[0] = 0; end; "; + + // Super-Opcodes + $op_set_global_const = $this->opMap['SET_GLOBAL_CONST']; + $cases[] = "elseif op == $op_set_global_const then if " . $this->genOpaquePredicate('true') . " then local n = " . $c_v . "[a + 1]; " . $e_v . "[n] = " . $c_v . "[b + 1]; end; "; + + $op_move_global = $this->opMap['MOVE_GLOBAL']; + $cases[] = "elseif op == $op_move_global then if " . $this->genOpaquePredicate('true') . " then local sn = " . $c_v . "[a + 1]; local vn = " . $c_v . "[b + 1]; local t = " . $e_v . "; for p in vn:gmatch('[^.:]+') do t = t[p] end; " . $e_v . "[sn] = t; end; "; + + $op_call_global_k = $this->opMap['CALL_GLOBAL_K']; + $cases[] = "elseif op == $op_call_global_k then if " . $this->genOpaquePredicate('true') . " then local fn = " . $c_v . "[a + 1]; local t = " . $e_v . "; for p in fn:gmatch('[^.:]+') do t = t[p] end; t(" . $c_v . "[b + 1]); end; "; + + $op_call_global_v = $this->opMap['CALL_GLOBAL_V']; + $cases[] = "elseif op == $op_call_global_v then if " . $this->genOpaquePredicate('true') . " then local fn = " . $c_v . "[a + 1]; local vn = " . $c_v . "[b + 1]; local f = " . $e_v . "; for p in fn:gmatch('[^.:]+') do f = f[p] end; local v = " . $e_v . "; for p in vn:gmatch('[^.:]+') do v = v[p] end; f(v); end; "; shuffle($cases); - $lua .= implode("", $cases); - - $lua .= " end; "; - $lua .= $pc_v . " = " . $pc_v . " + 1; "; - $lua .= "end; "; - $lua .= "end; "; - + $lua .= "if false then " . implode(" ", $cases) . " end; pc = pc + 1; end end; "; $lua .= "pcall(_V); "; return [ @@ -253,9 +351,7 @@ class LuartexHyperionV5 { 'stats' => [ 'original_size' => strlen($this->rawCode), 'protected_size' => strlen($lua), - 'vm_version' => '5.2-hyperion-ultra', - 'isr' => 'dynamic_heavy', - 'obfuscation' => 'maximum' + 'vm_version' => '5.8-instruction-folding' ] ]; } @@ -263,18 +359,7 @@ class LuartexHyperionV5 { try { $vm = new LuartexHyperionV5($code); - $result = $vm->build(); - - try { - $stmt = db()->prepare("INSERT INTO scripts (original_size, protected_size, settings) VALUES (?, ?, ?)"); - $stmt->execute([ - $result['stats']['original_size'], - $result['stats']['protected_size'], - json_encode(['protection' => 'hyperion_ultra', 'v' => '5.2']) - ]); - } catch (Exception $e) { } // Ignore DB errors - - echo json_encode($result); + echo json_encode($vm->build()); } catch (Exception $e) { echo json_encode(['success' => false, 'error' => $e->getMessage()]); } diff --git a/protected_v5_7.lua b/protected_v5_7.lua new file mode 100644 index 0000000..3e99d25 --- /dev/null +++ b/protected_v5_7.lua @@ -0,0 +1,2 @@ +-- [[ Hyperion Engine V5.7 - Dynamic Opaque Predicates ]] -- +local L__l_l1lil11l1 = { 39,195,180,77,67,29,186,148,46,248,162,169,102,187,132,136,140,71,3,20,215,223,187,119,188,68,120,86,155,228,115,65 }; local L_lI1i_1i_Illl = "27ceae6676d82dcf468d2127d2ef324a5c98e8f279cea55c850002f4f79df5d18675bc8a97fc506e0e1080865af7d3f04e3a8983756eaf6e641c8adc96798c72678eef2bb345340e864a61771052728b9d5a8ce7938ee51cc4c1eac1365db592ee66373a324efdc0088d96f3340532061cbeb0ad52432c1f842e3a08a6c87012f73c4b8e9ebf153ba37ea1a67a92b7bbae730717524e25dc1cc9cfe51b7255347581e32a5f05a48ad4046f68fa2467454bb80903f3ecb40ce5210a291605d7f2e70e6c98871db48f06cc99e73ad2f2163e88ccd0666211a664634a6799fd417d34dabca3b9db3c57c606603fb3"; local L_ilIIi1l1l1i_ = (getgenv and getgenv()) or (getfenv and getfenv(0)) or _G; 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; local function _D(b) local o = {}; for i = 1, #b do local k = ((i - 1) % 32) + 1; o[i] = bit32.bxor(b[i], L__l_l1lil11l1[k], ((i - 1) * 13) % 256) end return o end; local L_iIilIi_i1ii1 = _D(_H(L_lI1i_1i_Illl)); local function _R32(b, p) return b[p]*16777216 + b[p+1]*65536 + b[p+2]*256 + b[p+3] end; local function _R16(b, p) return b[p]*256 + b[p+1] end; local ic = _R32(L_iIilIi_i1ii1, 1); local co = 5 + ic * 7; local cc = _R32(L_iIilIi_i1ii1, co); local L__I1_lI_iiill = {}; local cu = co + 4; for i = 1, cc do local t = L_iIilIi_i1ii1[cu]; cu = cu + 1; if t == 1 or t == 2 then local l = _R32(L_iIilIi_i1ii1, cu); cu = cu + 4; local s = {}; for j = 1, l do s[j] = string.char(L_iIilIi_i1ii1[cu]); cu = cu + 1 end; s = table.concat(s); if t == 2 then L__I1_lI_iiill[i] = tonumber(s) else L__I1_lI_iiill[i] = s end; else cu = cu + 1 end end; local function L__lI__iI11Il1(p) local o = 5 + (p - 1) * 7; return L_iIilIi_i1ii1[o]*65536 + L_iIilIi_i1ii1[o+1]*256 + L_iIilIi_i1ii1[o+2], _R16(L_iIilIi_i1ii1, o+3), _R16(L_iIilIi_i1ii1, o+5) end; local function _V() local stack = {}; local pc = 1; while true do local op, a, b = L__lI__iI11Il1(pc); if false then elseif op == 4756 then if (type(math.abs) == 'string') then pc = -1 end; elseif op == 72626 then if (type(math.abs) == 'function') then local n = L__I1_lI_iiill[b + 1]; L_ilIIi1l1l1i_[n] = stack[a]; end; elseif op == 43730 then if (math.ceil(5.1) == 6) then local x = math.sqrt(a * b); stack[0] = x; else stack[0] = 0; end; elseif op == 70058 then if (not (1 == 0)) then local f = stack[a]; local args = {}; for m = 1, b do args[m] = stack[a + m] end; local ok, err = pcall(f, unpack(args)); if not ok then error('VM Error: ' .. tostring(err)) end; end; elseif op == 76029 then if (math.abs(-1) == 0) then pc = pc * 2 else stack[a] = L__I1_lI_iiill[b + 1] end; elseif op == 42436 then if (type(math.abs) == 'string') then print('DEAD CODE') else return end; elseif op == 99545 then if (#('Hyperion') == 8) then local n = L__I1_lI_iiill[b + 1]; local t = L_ilIIi1l1l1i_; for p in n:gmatch('[^.:]+') do t = t[p] end; stack[a] = t; else pc = pc + 666 end; elseif op == 78548 then stack[a] = stack[b]; end; pc = pc + 1; end end; pcall(_V); \ No newline at end of file diff --git a/protected_v5_8.lua b/protected_v5_8.lua new file mode 100644 index 0000000..b2afa72 --- /dev/null +++ b/protected_v5_8.lua @@ -0,0 +1,2 @@ +-- [[ Hyperion Engine V5.8 - Instruction Folding ]] -- +local L_i1I1iI_liIi_ = { 0,126,52,124,78,180,66,73,146,61,86,172,224,148,145,55,100,212,205,55,4,147,222,23,247,20,193,11,59,212,247,115 }; local L_ll1lIi1il_1i = "00732e517adafd12fb48d62320c72750b44f27667f82c43ccc517d3f57d2711ba0576bbb9b55a8b2c6d27467dce4c621b8a942a0a4223c262f1533bd3749344041336b1a620eccd23a8894633c7b663474c9c44839b2e50ee6fe3db4c1581f98c0beee3234e61800af0b40aaf37327d2bb0563898e05211cef31f64405e4ff7481f3aedbe83df5e21fba3dcc929df1411ab18714e57134bd4fd113c99e43821452266d4f73ba42125cc79867353320f4fd5ae74143d6892aca70b374b74e3cb3a7b2ee9bbab12f3dca71"; local L_1_iI11IIl_i1 = (getgenv and getgenv()) or (getfenv and getfenv(0)) or _G; 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; local function _D(b) local o = {}; for i = 1, #b do local k = ((i - 1) % 32) + 1; o[i] = bit32.bxor(b[i], L_i1I1iI_liIi_[k], ((i - 1) * 13) % 256) end return o end; local L__i_I_iiili1_ = _D(_H(L_ll1lIi1il_1i)); local function _R32(b, p) return b[p]*16777216 + b[p+1]*65536 + b[p+2]*256 + b[p+3] end; local function _R16(b, p) return b[p]*256 + b[p+1] end; local ic = _R32(L__i_I_iiili1_, 1); local co = 5 + ic * 7; local cc = _R32(L__i_I_iiili1_, co); local L_illil_lI1___ = {}; local cu = co + 4; for i = 1, cc do local t = L__i_I_iiili1_[cu]; cu = cu + 1; if t == 1 or t == 2 then local l = _R32(L__i_I_iiili1_, cu); cu = cu + 4; local s = {}; for j = 1, l do s[j] = string.char(L__i_I_iiili1_[cu]); cu = cu + 1 end; s = table.concat(s); if t == 2 then L_illil_lI1___[i] = tonumber(s) else L_illil_lI1___[i] = s end; else cu = cu + 1 end end; local function L_1liIlIIil1ii(p) local o = 5 + (p - 1) * 7; return L__i_I_iiili1_[o]*65536 + L__i_I_iiili1_[o+1]*256 + L__i_I_iiili1_[o+2], _R16(L__i_I_iiili1_, o+3), _R16(L__i_I_iiili1_, o+5) end; local function _V() local stack = {}; local pc = 1; while true do local op, a, b = L_1liIlIIil1ii(pc); if false then elseif op == 81492 then if (1 == 0) then pc = pc * 2 else stack[a] = L_illil_lI1___[b + 1] end; elseif op == 48511 then if (math.abs(-1) == 1) then local n = L_illil_lI1___[b + 1]; L_1_iI11IIl_i1[n] = stack[a]; end; elseif op == 42623 then if (type(math.abs) == 'function') then local n = L_illil_lI1___[a + 1]; L_1_iI11IIl_i1[n] = L_illil_lI1___[b + 1]; end; elseif op == 66023 then if (#('Hyperion') == 8) then local n = L_illil_lI1___[b + 1]; local t = L_1_iI11IIl_i1; for p in n:gmatch('[^.:]+') do t = t[p] end; stack[a] = t; else pc = pc + 666 end; elseif op == 78485 then stack[a] = stack[b]; elseif op == 6801 then if (math.ceil(5.1) == 6) then local f = stack[a]; local args = {}; for m = 1, b do args[m] = stack[a + m] end; local ok, err = pcall(f, unpack(args)); if not ok then error('VM Error: ' .. tostring(err)) end; end; elseif op == 95660 then if (math.abs(-1) == 1) then local sn = L_illil_lI1___[a + 1]; local vn = L_illil_lI1___[b + 1]; local t = L_1_iI11IIl_i1; for p in vn:gmatch('[^.:]+') do t = t[p] end; L_1_iI11IIl_i1[sn] = t; end; elseif op == 61035 then if (#('Hyperion') == 9) then pc = -1 end; elseif op == 12273 then if (math.pi > 3) then local fn = L_illil_lI1___[a + 1]; local t = L_1_iI11IIl_i1; for p in fn:gmatch('[^.:]+') do t = t[p] end; t(L_illil_lI1___[b + 1]); end; elseif op == 34021 then if (math.sin(0) == 0) then local fn = L_illil_lI1___[a + 1]; local vn = L_illil_lI1___[b + 1]; local f = L_1_iI11IIl_i1; for p in fn:gmatch('[^.:]+') do f = f[p] end; local v = L_1_iI11IIl_i1; for p in vn:gmatch('[^.:]+') do v = v[p] end; f(v); end; elseif op == 23802 then if (math.ceil(5.1) == 6) then local x = math.sqrt(a * b); stack[0] = x; else stack[0] = 0; end; elseif op == 88123 then if (1 == 0) then print('DEAD CODE') else return end; end; pc = pc + 1; end end; pcall(_V); \ No newline at end of file diff --git a/test_v5_7.php b/test_v5_7.php new file mode 100644 index 0000000..ca6decb --- /dev/null +++ b/test_v5_7.php @@ -0,0 +1,53 @@ + $code]); + + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $data); + curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); + + $response = curl_exec($ch); + curl_close($ch); + + return json_decode($response, true); +} + +$luaCode = 'print("Hello from Hyperion V5.7"); local x = 10; local y = 20; print("Result: " .. tostring(x + y));'; + +echo "Obfuscating code...\n"; +$result = obfuscate($luaCode); + +if ($result && $result['success']) { + echo "Obfuscation successful!\n"; + $protectedCode = $result['protected_code']; + echo "Protected code length: " . strlen($protectedCode) . "\n"; + + // Check for version string in comments + if (strpos($protectedCode, "Hyperion Engine V5.7 - Dynamic Opaque Predicates") !== false) { + echo "Version string confirmed: V5.7\n"; + } else { + echo "Version string NOT found!\n"; + } + + // Check for some opaque predicates + $predicates = ['math.pi > 3', 'type(math.abs) == \'function\'', 'math.floor(10.5) == 10']; + $found = 0; + foreach ($predicates as $pred) { + if (strpos($protectedCode, $pred) !== false) { + $found++; + } + } + echo "Found $found/" . count($predicates) . " tested predicates in the output.\n"; + + // Save to a file for manual inspection if needed + file_put_contents('protected_v5_7.lua', $protectedCode); + echo "Protected code saved to protected_v5_7.lua\n"; +} else { + echo "Obfuscation failed: " . ($result['error'] ?? 'Unknown error') . "\n"; + var_dump($result); +} + diff --git a/test_v5_8.php b/test_v5_8.php new file mode 100644 index 0000000..fb47dc4 --- /dev/null +++ b/test_v5_8.php @@ -0,0 +1,34 @@ + $code])); +curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); + +$response = curl_exec($ch); +curl_close($ch); + +$data = json_decode($response, true); +if ($data && $data['success']) { + $protectedCode = $data['protected_code']; + file_put_contents('protected_v5_8.lua', $protectedCode); + echo "Successfully protected code. Saved to protected_v5_8.lua\n"; + echo "Stats: " . json_encode($data['stats']) . "\n"; + + // Test the protected code + $output = shell_exec('lua protected_v5_8.lua 2>&1'); + echo "\nExecution output:\n"; + echo $output; + + if (strpos($output, 'Hyperion V5.8 Test') !== false && + strpos($output, 'Instruction Folding is active') !== false) { + echo "\nVerification: SUCCESS\n"; + } else { + echo "\nVerification: FAILED\n"; + } +} else { + echo "Error: " . ($data['error'] ?? 'Unknown error') . "\n"; + echo "Raw response: " . $response . "\n"; +} \ No newline at end of file