Fucking new version
This commit is contained in:
parent
9a9b691c24
commit
c99fbf1834
@ -23,7 +23,7 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Enterprise Luau Obfusc
|
||||
<nav class="navbar">
|
||||
<a href="/" class="brand">LUAR<span>TEX</span></a>
|
||||
<div style="flex-grow: 1;"></div>
|
||||
<div class="badge">VM v3.5-delta (Extreme)</div>
|
||||
<div class="badge">Hyperion V10.0 (DIP)</div>
|
||||
</nav>
|
||||
|
||||
<main class="container-main">
|
||||
@ -54,11 +54,11 @@ print('Hello Luartex!')"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="controls" style="justify-content: center;">
|
||||
<button id="protect-btn" class="btn-primary" style="padding: 1rem 4rem; font-size: 1.2rem;">Obfuscate with Maximum Protection</button>
|
||||
<button id="protect-btn" class="btn-primary" style="padding: 1rem 4rem; font-size: 1.2rem;">Obfuscate with Hyperion V10.0</button>
|
||||
</div>
|
||||
|
||||
<div id="terminal" class="terminal-log">
|
||||
<div class="log-entry log-info">[SYSTEM] Luartex VM v3.5 initialized. Delta Executor compatibility layer active.</div>
|
||||
<div class="log-entry log-info">[SYSTEM] Hyperion V10.0 Engine Initialized. Dynamic Instruction Polymorphism (DIP) & Seed Evolution Active.</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
|
||||
385
process.php
385
process.php
@ -14,17 +14,27 @@ if (!$input || empty($input['code'])) {
|
||||
|
||||
$code = $input['code'];
|
||||
|
||||
class LuartexHyperionV8_1 {
|
||||
/**
|
||||
* Hyperion V10.0 - Dynamic Instruction Polymorphism
|
||||
* Features:
|
||||
* - Dynamic Opcode Mapping (Seed-based)
|
||||
* - Operand Permutation (A, B, C swap roles)
|
||||
* - Instruction Ghosting & Seed Evolution
|
||||
* - Semantic Flattening & Environmental Entanglement (inherited)
|
||||
*/
|
||||
class LuartexHyperionV10_0 {
|
||||
private $rawCode;
|
||||
private $constants = [];
|
||||
private $instructions = [];
|
||||
private $keys = [];
|
||||
private $opMap = [];
|
||||
private $polyKey;
|
||||
private $seed;
|
||||
|
||||
public function __construct($code) {
|
||||
$this->rawCode = $code;
|
||||
$this->polyKey = rand(10, 200);
|
||||
$this->polyKey = rand(50, 200);
|
||||
$this->seed = rand(1000, 9999);
|
||||
for ($i = 0; $i < 32; $i++) {
|
||||
$this->keys[] = rand(0, 255);
|
||||
}
|
||||
@ -33,14 +43,13 @@ class LuartexHyperionV8_1 {
|
||||
|
||||
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'
|
||||
'LOADK', 'CALL', 'MOVE',
|
||||
'ADD', 'SUB', 'MUL', 'DIV',
|
||||
'RETURN', 'GETTABLE', 'SETTABLE', 'NEWTABLE',
|
||||
'TAMPER_CHECK', 'ENTROPY_SYNC',
|
||||
'FETCH_ENV', 'RESOLVE_SYMBOL',
|
||||
'MUTATE_BYTECODE', 'COMPUTE_PC',
|
||||
'MORPH_STATE', 'GHOST_NOP'
|
||||
];
|
||||
shuffle($ops);
|
||||
foreach ($ops as $op) {
|
||||
@ -48,7 +57,7 @@ class LuartexHyperionV8_1 {
|
||||
}
|
||||
}
|
||||
|
||||
private function genVar($len = 32) {
|
||||
private function genVar($len = 24) {
|
||||
$sets = ['l1Ii', 'O0Q', 'uvvw', 'nmM', 'S5s', 'Z2z', 'B8b', 'g9q'];
|
||||
$res = '_';
|
||||
for($i=0; $i<$len; $i++) {
|
||||
@ -58,22 +67,18 @@ class LuartexHyperionV8_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);
|
||||
private function synthesizeString($s) {
|
||||
$res = [];
|
||||
for ($i = 0; $i < strlen($s); $i++) {
|
||||
$char = ord($s[$i]);
|
||||
$a = rand(1, 100);
|
||||
$b = rand(1, 100);
|
||||
$op = rand(0, 2);
|
||||
if ($op == 0) { $x = $char - ($a + $b); $res[] = "($x + $a + $b)"; }
|
||||
elseif ($op == 1) { $x = $char + ($a - $b); $res[] = "($x - $a + $b)"; }
|
||||
else { $x = $char ^ $a ^ $b; $res[] = "bit32.bxor($x, $a, $b)"; }
|
||||
}
|
||||
return ['ops' => $bytecode, 'remainder' => $target - $current];
|
||||
return "function() local r = ''; for _, v in ipairs({" . implode(",", $res) . "}) do r = r .. string.char(v) end return r end";
|
||||
}
|
||||
|
||||
private function addConst($val) {
|
||||
@ -85,104 +90,87 @@ class LuartexHyperionV8_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);
|
||||
$this->addConst("Hyperion V10.0 - DIP Engine Active");
|
||||
$cleanCode = preg_replace('/--[[]*.*?[]]*--/s', '', $this->rawCode);
|
||||
$cleanCode = preg_replace('/--.*$/m', '', $cleanCode);
|
||||
$tokens = preg_split('/[;
|
||||
]+/', $cleanCode);
|
||||
$tokens = preg_split('/[;\n]+/', $cleanCode);
|
||||
|
||||
foreach ($tokens as $token) {
|
||||
$token = trim($token);
|
||||
if (empty($token)) continue;
|
||||
|
||||
$this->emitJunk();
|
||||
|
||||
// local t = {}
|
||||
// Randomly inject Ghost NOPs to evolve the state
|
||||
if (rand(0, 5) == 0) {
|
||||
$this->instructions[] = [$this->opMap['GHOST_NOP'], rand(0,255), rand(0,255), rand(0,255)];
|
||||
}
|
||||
|
||||
$this->instructions[] = [$this->opMap['ENTROPY_SYNC'], 0, 0, 0];
|
||||
|
||||
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];
|
||||
$this->emitSemanticSetGlobal(0, $m[1]);
|
||||
}
|
||||
// t["key"] = value or t.key = value
|
||||
elseif (preg_match('/^([a-zA-Z_]\w*)\s*[.[\]\s*["\']?(.*?)["\']?\s*[\\\]]?\s*=\s*(.*)$/', $token, $m)) {
|
||||
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];
|
||||
private function emitSemanticGetGlobal($reg, $name) {
|
||||
$this->instructions[] = [$this->opMap['FETCH_ENV'], $reg, 0, 0];
|
||||
foreach (explode('.', $name) as $part) {
|
||||
$kIdx = $this->addConst($this->synthesizeString($part));
|
||||
$this->instructions[] = [$this->opMap['LOADK'], 250, $kIdx, 1];
|
||||
$this->instructions[] = [$this->opMap['RESOLVE_SYMBOL'], $reg, $reg, 250];
|
||||
}
|
||||
|
||||
$this->instructions[] = [$this->opMap['SETTABLE'], 0, $kIdx, $vReg];
|
||||
}
|
||||
|
||||
private function emitSemanticSetGlobal($reg, $name) {
|
||||
$this->instructions[] = [$this->opMap['FETCH_ENV'], 251, 0, 0];
|
||||
$kIdx = $this->addConst($this->synthesizeString($name));
|
||||
$this->instructions[] = [$this->opMap['LOADK'], 252, $kIdx, 1];
|
||||
$this->instructions[] = [$this->opMap['SETTABLE'], 251, 252, $reg];
|
||||
}
|
||||
|
||||
private function emitTableSet($tableName, $key, $val) {
|
||||
$this->emitSemanticGetGlobal(0, $tableName);
|
||||
$kIdx = $this->addConst($this->synthesizeString($key));
|
||||
$this->instructions[] = [$this->opMap['LOADK'], 1, $kIdx, 1];
|
||||
$val = trim($val); $vReg = 2;
|
||||
if (preg_match('/^["\\](.*)["\\]$/', $val, $vm)) {
|
||||
$vIdx = $this->addConst($this->synthesizeString($vm[1]));
|
||||
$this->instructions[] = [$this->opMap['LOADK'], $vReg, $vIdx, 1];
|
||||
} elseif (is_numeric($val)) {
|
||||
$vIdx = $this->addConst($val);
|
||||
$this->instructions[] = [$this->opMap['LOADK'], $vReg, $vIdx, 0];
|
||||
} else {
|
||||
$this->emitSemanticGetGlobal($vReg, $val);
|
||||
}
|
||||
$this->instructions[] = [$this->opMap['SETTABLE'], 0, 1, $vReg];
|
||||
}
|
||||
|
||||
private function emitCall($funcName, $argStr) {
|
||||
$fIdx = $this->addConst($funcName);
|
||||
$this->instructions[] = [$this->opMap['GETGLOBAL'], 0, $fIdx, 0];
|
||||
$this->emitSemanticGetGlobal(0, $funcName);
|
||||
$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];
|
||||
foreach (explode(',', $argStr) as $idx => $arg) {
|
||||
$arg = trim($arg); $rIdx = $idx + 1;
|
||||
if (preg_match('/^["\\](.*)["\\]$/', $arg, $m)) {
|
||||
$vIdx = $this->addConst($this->synthesizeString($m[1]));
|
||||
$this->instructions[] = [$this->opMap['LOADK'], $rIdx, $vIdx, 1];
|
||||
} elseif (is_numeric($arg)) {
|
||||
$vIdx = $this->addConst($arg);
|
||||
$this->instructions[] = [$this->opMap['LOADK'], $rIdx, $vIdx, 0];
|
||||
} 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];
|
||||
}
|
||||
$this->emitSemanticGetGlobal($rIdx, $arg);
|
||||
}
|
||||
$args[] = $rIdx;
|
||||
}
|
||||
@ -192,191 +180,124 @@ class LuartexHyperionV8_1 {
|
||||
|
||||
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];
|
||||
if (preg_match('/^["\\](.*)["\\]$/', $val, $m)) {
|
||||
$vIdx = $this->addConst($this->synthesizeString($m[1]));
|
||||
$this->instructions[] = [$this->opMap['LOADK'], 0, $vIdx, 1];
|
||||
} elseif (is_numeric($val)) {
|
||||
$vIdx = $this->addConst($val);
|
||||
$this->instructions[] = [$this->opMap['LOADK'], 0, $vIdx, 0];
|
||||
} 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];
|
||||
}
|
||||
$this->emitSemanticGetGlobal(0, $val);
|
||||
}
|
||||
|
||||
$sIdx = $this->addConst($var);
|
||||
$this->instructions[] = [$this->opMap['SETGLOBAL'], 0, $sIdx, 0];
|
||||
$this->emitSemanticSetGlobal(0, $var);
|
||||
}
|
||||
|
||||
private function serializeAll() {
|
||||
$bin = "";
|
||||
$bin .= pack("N", count($this->instructions));
|
||||
$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 .= chr($op ^ $mask);
|
||||
$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);
|
||||
}
|
||||
$t = is_string($c) ? 1 : (is_numeric($c) ? 2 : 0);
|
||||
$bin .= chr($t);
|
||||
$s = (string)$c;
|
||||
$bin .= pack("N", strlen($s)) . $s;
|
||||
}
|
||||
$keyLen = count($this->keys);
|
||||
$enc = "";
|
||||
$keyLen = count($this->keys); $enc = "";
|
||||
for ($i = 0; $i < strlen($bin); $i++) {
|
||||
$enc .= chr(ord($bin[$i]) ^ $this->keys[$i % $keyLen] ^ (($i * 17) % 256));
|
||||
$enc .= chr(ord($bin[$i]) ^ $this->keys[$i % $keyLen] ^ (($i * 31) % 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
|
||||
|
||||
$vars = [];
|
||||
foreach(['k','b','e','f','d','c','v','stack','asm','poly','handlers','tamper','watchdog','fetch','tk','entropy','pc','rolling','inst','op','a','b_p','c_p','res','env','hash','sym','prev_op','state_hash','ctx','seed','morph','perm'] as $v) {
|
||||
$vars[$v] = $this->genVar();
|
||||
}
|
||||
$k_str = implode(",", $this->keys);
|
||||
$allHex = $this->serializeAll();
|
||||
$lua = "-- [[ Hyperion Engine V10.0 - DIP ]] --\n";
|
||||
$lua .= "local " . $vars['k'] . " = { " . $k_str . " }; ";
|
||||
$lua .= "local " . $vars['b'] . " = \"" . $this->serializeAll() . "\"; ";
|
||||
$lua .= "local " . $vars['e'] . " = (getgenv and getgenv()) or (getfenv and getfenv(0)) or _G; ";
|
||||
|
||||
$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; ";
|
||||
$lua .= "local function _D(b) local o = {}; for i = 1, #b do local k = ((i - 1) % 32) + 1; o[i] = bit32.bxor(b[i], " . $vars['k'] . "[k], ((i - 1) * 31) % 256) end return o end; ";
|
||||
$lua .= "local " . $vars['d'] . " = _D(_H(" . $vars['b'] . ")); ";
|
||||
|
||||
// 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 " . $vars['entropy'] . "() return bit32.bxor(math.floor(os.clock() * 1000) % 65536, collectgarbage('count') % 256, 0x1337) end; ";
|
||||
$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; ";
|
||||
$lua .= "local ic = _R32(" . $vars['d'] . ", 1); local co = 5 + ic * 5; local cc = _R32(" . $vars['d'] . ", co); ";
|
||||
$lua .= "local " . $vars['c'] . " = {}; local cu = co + 4; ";
|
||||
$lua .= "for i = 1, cc do local t = " . $vars['d'] . "[cu]; cu = cu + 1; if t > 0 then local l = _R32(" . $vars['d'] . ", cu); cu = cu + 4; local s = ''; for j = 1, l do s = s .. string.char(" . $vars['d'] . "[cu]); cu = cu + 1 end; if t == 2 then " . $vars['c'] . "[i] = tonumber(s) else " . $vars['c'] . "[i] = s end else cu = cu + 1 end end; ";
|
||||
|
||||
// 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; ";
|
||||
$lua .= "local " . $vars['fetch'] . " = function(p) local o = 5 + (p - 1) * 5; return " . $vars['d'] . "[o], " . $vars['d'] . "[o+1], _R16(" . $vars['d'] . ", o+2), " . $vars['d'] . "[o+4] 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; ";
|
||||
$lua .= "local " . $vars['v'] . " = function() ";
|
||||
$lua .= "local " . $vars['stack'] . " = {}; local " . $vars['pc'] . " = 1; local " . $vars['seed'] . " = " . $this->seed . "; ";
|
||||
$lua .= "local " . $vars['rolling'] . " = " . $vars['entropy'] . "(); local " . $vars['handlers'] . " = {}; ";
|
||||
|
||||
// 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; ";
|
||||
// Morphing Function
|
||||
$lua .= "local function " . $vars['morph'] . "(op, seed, pc) return bit32.bxor(op, bit32.band(seed, 0xFF), bit32.band(pc, 0xFF)) % 256 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
|
||||
// Dynamic Handler Population
|
||||
foreach ($this->opMap as $name => $val) {
|
||||
$lua .= $handlers_v . "[" . $val . "] = function(a, b, c) ";
|
||||
$lua .= $vars['handlers'] . "[" . $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;
|
||||
case 'ENTROPY_SYNC': $lua .= $vars['rolling'] . " = bit32.bxor(" . $vars['rolling'] . ", " . $vars['entropy'] . "()); "; break;
|
||||
case 'FETCH_ENV': $lua .= $vars['stack'] . "[a] = " . $vars['e'] . "; "; break;
|
||||
case 'RESOLVE_SYMBOL': $lua .= $vars['stack'] . "[a] = " . $vars['stack'] . "[b][" . $vars['stack'] . "[c]]; "; break;
|
||||
case 'LOADK': $lua .= "local v = " . $vars['c'] . "[b + 1]; if c == 1 then local f = loadstring('return ' .. v); if f then v = f()() end end; " . $vars['stack'] . "[a] = v; "; break;
|
||||
case 'CALL': $lua .= "local f = " . $vars['stack'] . "[a]; local args = {}; for m = 1, b do args[m] = " . $vars['stack'] . "[a + m] end; if f then f((unpack or table.unpack)(args)) end; "; break;
|
||||
case 'RETURN': $lua .= $vars['pc'] . " = -1; "; break;
|
||||
case 'NEWTABLE': $lua .= $vars['stack'] . "[a] = {}; "; break;
|
||||
case 'SETTABLE': $lua .= $vars['stack'] . "[a][" . $vars['stack'] . "[b]] = " . $vars['stack'] . "[c]; "; break;
|
||||
case 'ADD': $lua .= $vars['stack'] . "[a] = " . $vars['stack'] . "[b] + " . $vars['stack'] . "[c]; "; break;
|
||||
case 'MORPH_STATE': $lua .= $vars['seed'] . " = bit32.bxor(" . $vars['seed'] . ", a, b, c); "; break;
|
||||
case 'GHOST_NOP': $lua .= $vars['seed'] . " = bit32.bxor(" . $vars['seed'] . ", " . $vars['rolling'] . "); "; break;
|
||||
default: break;
|
||||
}
|
||||
// Evolution of seed after every instruction
|
||||
$lua .= $vars['seed'] . " = bit32.bxor(" . $vars['seed'] . ", " . $val . ", a or 0) + 1; ";
|
||||
$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 .= "while " . $vars['pc'] . " > 0 do ";
|
||||
$lua .= "local raw_op, _a, _b, _c = " . $vars['fetch'] . "(" . $vars['pc'] . "); if not raw_op then break end; ";
|
||||
$lua .= "local op = bit32.bxor(raw_op, (" . $this->polyKey . " + " . $vars['pc'] . ") % 256); ";
|
||||
|
||||
$lua .= "pcall(" . $v_v . "); ";
|
||||
// Operand Permutation based on seed
|
||||
$lua .= "local a, b, c; local " . $vars['perm'] . " = " . $vars['seed'] . " % 3; ";
|
||||
$lua .= "if " . $vars['perm'] . " == 0 then a,b,c = _a,_b,_c elseif " . $vars['perm'] . " == 1 then a,b,c = _b,_c,_a else a,b,c = _c,_a,_b end; ";
|
||||
|
||||
$lua .= "local h = " . $vars['handlers'] . "[op]; if h then h(a, b, c) end; ";
|
||||
$lua .= "if " . $vars['pc'] . " > 0 then " . $vars['pc'] . " = " . $vars['pc'] . " + 1 end; ";
|
||||
$lua .= "if " . $vars['pc'] . " % 100 == 0 then if task and task.wait then task.wait() elseif wait then wait() end end; ";
|
||||
$lua .= "end; ";
|
||||
|
||||
$lua .= "pcall(" . $vars['v'] . "); ";
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
'protected_code' => $lua,
|
||||
'stats' => ['original_size' => strlen($this->rawCode), 'protected_size' => strlen($lua), 'vm_version' => '8.1-table-virt']
|
||||
'stats' => ['version' => '10.0-DIP', 'poly_key' => $this->polyKey, 'seed' => $this->seed]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$vm = new LuartexHyperionV8_1($code);
|
||||
$vm = new LuartexHyperionV10_0($code);
|
||||
echo json_encode($vm->build());
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
2
protected_v10_0.lua
Normal file
2
protected_v10_0.lua
Normal file
File diff suppressed because one or more lines are too long
2
protected_v9_0.lua
Normal file
2
protected_v9_0.lua
Normal file
File diff suppressed because one or more lines are too long
48
test_v10_0.php
Normal file
48
test_v10_0.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Test for Hyperion V10.0 - Dynamic Instruction Polymorphism
|
||||
*/
|
||||
|
||||
$test_code = '
|
||||
print("Hyperion V10.0 Bootstrapped")
|
||||
local data = {}
|
||||
data["status"] = "Protected"
|
||||
data["version"] = 10.0
|
||||
print("System Status: " .. data["status"])
|
||||
print("Build: " .. data["version"])
|
||||
|
||||
local function complex_math(a, b)
|
||||
return (a * b) + (a - b)
|
||||
end
|
||||
|
||||
print("Test Math: " .. tostring(complex_math(10, 5)))
|
||||
';
|
||||
|
||||
$url = 'http://localhost/process.php';
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => "Content-type: application/json\r\n",
|
||||
'method' => 'POST',
|
||||
'content' => json_encode(['code' => $test_code]),
|
||||
],
|
||||
];
|
||||
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($url, false, $context);
|
||||
|
||||
if ($result === FALSE) {
|
||||
die("Error reaching process.php");
|
||||
}
|
||||
|
||||
$response = json_decode($result, true);
|
||||
|
||||
if ($response && $response['success']) {
|
||||
$protected_file = 'protected_v10_0.lua';
|
||||
file_put_contents($protected_file, $response['protected_code']);
|
||||
echo "Successfully generated $protected_file\n";
|
||||
echo "Stats: " . json_encode($response['stats']) . "\n";
|
||||
} else {
|
||||
echo "Error: " . ($response['error'] ?? 'Unknown error') . "\n";
|
||||
echo "Full response: " . $result . "\n";
|
||||
}
|
||||
|
||||
56
test_v9_0.php
Normal file
56
test_v9_0.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
// Test script for Hyperion V9.0
|
||||
$testCode = "
|
||||
print('Hyperion V9.0 Initializing...')
|
||||
local target = 'Hello from the Entangled VM!'
|
||||
print(target)
|
||||
local mathTest = 10 + 20
|
||||
print('Math test (10 + 20):', mathTest)
|
||||
local t = {}
|
||||
t['status'] = 'Virtualization Active'
|
||||
print('Table test:', t['status'])
|
||||
";
|
||||
|
||||
function testObfuscation($code) {
|
||||
$url = 'http://localhost/process.php';
|
||||
$data = json_encode(['code' => $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);
|
||||
if (curl_errno($ch)) {
|
||||
return ['success' => false, 'error' => curl_error($ch)];
|
||||
}
|
||||
curl_close($ch);
|
||||
|
||||
return json_decode($response, true);
|
||||
}
|
||||
|
||||
$result = testObfuscation($testCode);
|
||||
|
||||
if ($result && $result['success']) {
|
||||
echo "Obfuscation Successful!\n";
|
||||
echo "Stats: " . json_encode($result['stats']) . "\n";
|
||||
$protectedFile = 'protected_v9_0.lua';
|
||||
file_put_contents($protectedFile, $result['protected_code']);
|
||||
echo "Protected code saved to $protectedFile\n";
|
||||
|
||||
// Check if it's valid Lua (syntax check)
|
||||
$output = [];
|
||||
$return_var = 0;
|
||||
exec("luac -p $protectedFile 2>&1", $output, $return_var);
|
||||
if ($return_var === 0) {
|
||||
echo "Syntax Check: PASSED\n";
|
||||
} else {
|
||||
echo "Syntax Check: FAILED\n";
|
||||
echo implode("\n", $output) . "\n";
|
||||
}
|
||||
} else {
|
||||
echo "Obfuscation Failed!\n";
|
||||
print_r($result);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user