Newest fucking versionnnnn
This commit is contained in:
parent
aba65e04e2
commit
9a9b691c24
435
process.php
435
process.php
@ -14,17 +14,17 @@ if (!$input || empty($input['code'])) {
|
||||
|
||||
$code = $input['code'];
|
||||
|
||||
class LuartexHyperionV6_2 {
|
||||
class LuartexHyperionV8_1 {
|
||||
private $rawCode;
|
||||
private $constants = [];
|
||||
private $instructions = [];
|
||||
private $keys = [];
|
||||
private $opMap = [];
|
||||
private $vm_id;
|
||||
private $polyKey;
|
||||
|
||||
public function __construct($code) {
|
||||
$this->rawCode = $code;
|
||||
$this->vm_id = bin2hex(random_bytes(4));
|
||||
$this->polyKey = rand(10, 200);
|
||||
for ($i = 0; $i < 32; $i++) {
|
||||
$this->keys[] = rand(0, 255);
|
||||
}
|
||||
@ -39,62 +39,41 @@ class LuartexHyperionV6_2 {
|
||||
'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'
|
||||
'RECURSIVE_CALL', 'TAMPER_CHECK', 'LAYER_ENTER', 'STACK_SHUFFLE',
|
||||
'LOAD_ASM_MATH', 'POLY_SHIFT'
|
||||
];
|
||||
shuffle($ops);
|
||||
foreach ($ops as $op) {
|
||||
$this->opMap[$op] = rand(1000, 99999);
|
||||
$this->opMap[$op] = rand(0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
private function genVar($len = 24) {
|
||||
$sets = [
|
||||
'l1Ii', 'O0Q', 'uvvw', 'nmM', 'il1I', 'oO0Q',
|
||||
'S5s', 'Z2z', 'B8b', 'g9q', '01OI'
|
||||
];
|
||||
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(3));
|
||||
return $res . bin2hex(random_bytes(2));
|
||||
}
|
||||
|
||||
private function numToLuaExpr($n, $depth = 0) {
|
||||
if (!is_numeric($n)) return $n;
|
||||
$n = (float)$n;
|
||||
|
||||
if ($depth > 3) return $n;
|
||||
|
||||
$ops = ['+', '-', '*', 'xor', 'math'];
|
||||
$op = $ops[array_rand($ops)];
|
||||
|
||||
switch($op) {
|
||||
case '+':
|
||||
$v1 = rand(1, 10000) / 10;
|
||||
$v2 = $n - $v1;
|
||||
return "(" . $this->numToLuaExpr($v1, $depth + 1) . " + " . $this->numToLuaExpr($v2, $depth + 1) . ")";
|
||||
case '-':
|
||||
$v1 = rand((int)$n + 1, (int)$n + 10000) / 10;
|
||||
$v2 = $v1 - $n;
|
||||
return "(" . $this->numToLuaExpr($v1, $depth + 1) . " - " . $this->numToLuaExpr($v2, $depth + 1) . ")";
|
||||
case '*':
|
||||
if ($n == 0) return "(0 * " . rand(1, 100) . ")";
|
||||
for ($v1 = 2; $v1 <= 8; $v1++) {
|
||||
if ($n != 0 && fmod($n, $v1) == 0) {
|
||||
$v2 = $n / $v1;
|
||||
return "(" . $this->numToLuaExpr($v1, $depth + 1) . " * " . $this->numToLuaExpr($v2, $depth + 1) . ")";
|
||||
}
|
||||
}
|
||||
return "(" . $this->numToLuaExpr($n - 1, $depth + 1) . " + 1)";
|
||||
case 'xor':
|
||||
$v1 = rand(1, 65535);
|
||||
$v2 = (int)$n ^ $v1;
|
||||
return "bit32.bxor(" . $this->numToLuaExpr($v1, $depth + 1) . ", " . $this->numToLuaExpr($v2, $depth + 1) . ")";
|
||||
case 'math':
|
||||
return "(math.abs(" . $this->numToLuaExpr($n, $depth + 1) . "))";
|
||||
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 $n;
|
||||
return ['ops' => $bytecode, 'remainder' => $target - $current];
|
||||
}
|
||||
|
||||
private function addConst($val) {
|
||||
@ -106,144 +85,153 @@ class LuartexHyperionV6_2 {
|
||||
return $idx;
|
||||
}
|
||||
|
||||
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)",
|
||||
"(bit32.bxor(123, 123) == 0)",
|
||||
"(string.len('luartex') == 7)",
|
||||
"(math.log10(100) == 2)"
|
||||
];
|
||||
$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)",
|
||||
"(bit32.bxor(123, 123) ~= 0)",
|
||||
"(math.sqrt(16) == 5)"
|
||||
];
|
||||
|
||||
if ($type === 'true') {
|
||||
return $truePreds[array_rand($truePreds)];
|
||||
} else {
|
||||
return $falsePreds[array_rand($falsePreds)];
|
||||
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 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];
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
$folded[] = $inst;
|
||||
$i++;
|
||||
}
|
||||
$this->instructions = $folded;
|
||||
}
|
||||
|
||||
private function compile() {
|
||||
$this->addConst("Hyperion V6.2 - Multi-Layer Recursive Virtualization");
|
||||
|
||||
$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('/[;\n]+/', $cleanCode);
|
||||
|
||||
$tokens = preg_split('/[;
|
||||
]+/', $cleanCode);
|
||||
foreach ($tokens as $token) {
|
||||
$token = trim($token);
|
||||
if (empty($token)) continue;
|
||||
|
||||
if (preg_match('/^([a-zA-Z_]\w*(?:[.:]\w*)*)\s*\((.*?)\)$/', $token, $m)) {
|
||||
|
||||
$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->foldInstructions();
|
||||
$this->instructions[] = [$this->opMap['RETURN'], 0, 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];
|
||||
|
||||
$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;
|
||||
if (preg_match('/^["\'](.*)["\']$/s', $arg, $m)) {
|
||||
$vIdx = $this->addConst($m[1]);
|
||||
$this->instructions[] = [$this->opMap['LOADK'], $rIdx, $vIdx];
|
||||
} elseif (is_numeric($arg)) {
|
||||
$vIdx = $this->addConst((float)$arg);
|
||||
$this->instructions[] = [$this->opMap['LOADK'], $rIdx, $vIdx];
|
||||
|
||||
// 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 {
|
||||
$vIdx = $this->addConst($arg);
|
||||
$this->instructions[] = [$this->opMap['GETGLOBAL'], $rIdx, $vIdx];
|
||||
$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)];
|
||||
$this->instructions[] = [$this->opMap['CALL'], 0, count($args), 0];
|
||||
}
|
||||
|
||||
private function emitAssignment($var, $val) {
|
||||
$val = trim($val);
|
||||
if (preg_match('/^["\'](.*)["\']$/s', $val, $m)) {
|
||||
$vIdx = $this->addConst($m[1]);
|
||||
$this->instructions[] = [$this->opMap['LOADK'], 0, $vIdx];
|
||||
} elseif (is_numeric($val)) {
|
||||
$vIdx = $this->addConst((float)$val);
|
||||
$this->instructions[] = [$this->opMap['LOADK'], 0, $vIdx];
|
||||
|
||||
// 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 {
|
||||
$vIdx = $this->addConst($val);
|
||||
$this->instructions[] = [$this->opMap['GETGLOBAL'], 0, $vIdx];
|
||||
$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];
|
||||
$this->instructions[] = [$this->opMap['SETGLOBAL'], 0, $sIdx, 0];
|
||||
}
|
||||
|
||||
private function serializeAll() {
|
||||
$bin = "";
|
||||
$bin .= pack("N", count($this->instructions));
|
||||
foreach ($this->instructions as $inst) {
|
||||
foreach ($this->instructions as $pc_idx => $inst) {
|
||||
$pc = $pc_idx + 1;
|
||||
$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]);
|
||||
$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)) {
|
||||
@ -259,74 +247,51 @@ class LuartexHyperionV6_2 {
|
||||
$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));
|
||||
$enc .= chr(ord($bin[$i]) ^ $this->keys[$i % $keyLen] ^ (($i * 17) % 256));
|
||||
}
|
||||
|
||||
return bin2hex($enc);
|
||||
}
|
||||
|
||||
private function calculateChecksum($hex) {
|
||||
$sum = 0;
|
||||
for ($i = 0; $i < strlen($hex); $i++) {
|
||||
$sum = ($sum + ord($hex[$i]) * ($i + 1)) % 4294967296;
|
||||
}
|
||||
return $sum;
|
||||
}
|
||||
|
||||
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_v = $this->genVar(32); $b_v = $this->genVar(32); $e_v = $this->genVar(32);
|
||||
$f_v = $this->genVar(32); $d_v = $this->genVar(32); $c_v = $this->genVar(32);
|
||||
$cs_v = $this->genVar(32); $tm_v = $this->genVar(32);
|
||||
$v_v = $this->genVar(32); $l2_v = $this->genVar(32);
|
||||
$layers_v = $this->genVar(32);
|
||||
$stack_v = $this->genVar(32);
|
||||
|
||||
$k_str = "";
|
||||
foreach ($this->keys as $i => $k) {
|
||||
$k_str .= ($i > 0 ? "," : "") . $this->numToLuaExpr($k);
|
||||
}
|
||||
|
||||
$k_str = implode(",", $this->keys);
|
||||
$allHex = $this->serializeAll();
|
||||
$checksum = $this->calculateChecksum($allHex);
|
||||
|
||||
$lua = "-- [[ Hyperion Engine V6.2 - Recursive Layered Architecture ]] --\n";
|
||||
|
||||
$lua .= "local function " . $tm_v . "() ";
|
||||
$lua .= "local _G = (getgenv and getgenv()) or _G; ";
|
||||
$lua .= "if debug and (debug.getinfo or debug.setupvalue) then return true end; ";
|
||||
$lua .= "if getfenv and (type(getfenv) ~= 'function') then return true end; ";
|
||||
$lua .= "local check = {string.char, table.concat, tonumber, pcall, bit32.bxor, math.abs}; ";
|
||||
$lua .= "for i=1,#check do if type(check[i]) ~= 'function' then return true end end; ";
|
||||
$lua .= "local s, e = pcall(function() return os.clock() end); if not s then return true end; ";
|
||||
$lua .= "return false end; ";
|
||||
$lua .= "if " . $tm_v . "() then while true do end end; ";
|
||||
|
||||
$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; ";
|
||||
|
||||
$lua .= "local function " . $cs_v . "(s) local h = 0; for i = 1, #s do h = (h + string.byte(s, i) * i) % " . $this->numToLuaExpr(4294967296) . " end return h end; ";
|
||||
$lua .= "if " . $cs_v . "(" . $b_v . ") ~= " . $this->numToLuaExpr($checksum) . " then while true do end end; ";
|
||||
|
||||
// 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], " . $k_v . "[k], ((i - 1) * 13) % 256) end return o 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 * 7; ";
|
||||
$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 ";
|
||||
@ -334,75 +299,83 @@ class LuartexHyperionV6_2 {
|
||||
$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 " . $v_v . "; " . $v_v . " = function(spc, layer) ";
|
||||
$lua .= "local " . $stack_v . " = {}; local pc = spc or 1; local cur_layer = layer or 1; ";
|
||||
$lua .= "while true do local op, a, b = " . $f_v . "(pc); ";
|
||||
|
||||
$cases = [];
|
||||
$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_v . "[a] = t; else pc = pc + " . rand(100, 1000) . " 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; ";
|
||||
|
||||
$op_loadk = $this->opMap['LOADK'];
|
||||
$cases[] = "elseif op == $op_loadk then " . $stack_v . "[a] = " . $c_v . "[b + 1] ";
|
||||
// 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; ";
|
||||
|
||||
$op_call = $this->opMap['CALL'];
|
||||
$cases[] = "elseif op == $op_call then local f = " . $stack_v . "[a]; local args = {}; for m = 1, b do args[m] = " . $stack_v . "[a + m] end; if f == " . $v_v . " then " . $v_v . "(" . $stack_v . "[a+1], cur_layer + 1) else f(unpack(args)) 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; ";
|
||||
|
||||
$op_setglobal = $this->opMap['SETGLOBAL'];
|
||||
$cases[] = "elseif op == $op_setglobal then local n = " . $c_v . "[b + 1]; " . $e_v . "[n] = " . $stack_v . "[a] ";
|
||||
$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; ";
|
||||
|
||||
$op_return = $this->opMap['RETURN'];
|
||||
$cases[] = "elseif op == $op_return then return ";
|
||||
$lua .= "local " . $poly_v . " = " . $this->polyKey . "; ";
|
||||
|
||||
$op_opaque = $this->opMap['OPAQUE'];
|
||||
$cases[] = "elseif op == $op_opaque then if " . $tm_v . "() then while true do end else " . $stack_v . "[0] = math.sqrt(a*b) end ";
|
||||
|
||||
$op_recursive_call = $this->opMap['RECURSIVE_CALL'];
|
||||
$cases[] = "elseif op == $op_recursive_call then " . $v_v . "(a, cur_layer + 1) ";
|
||||
|
||||
$op_tamper_check = $this->opMap['TAMPER_CHECK'];
|
||||
$cases[] = "elseif op == $op_tamper_check then if " . $tm_v . "() then while true do end end ";
|
||||
|
||||
$op_layer_enter = $this->opMap['LAYER_ENTER'];
|
||||
$cases[] = "elseif op == $op_layer_enter then if cur_layer < 10 then " . $v_v . "(pc + 1, cur_layer + 1) return end ";
|
||||
|
||||
$op_call_gk = $this->opMap['CALL_GLOBAL_K'];
|
||||
$cases[] = "elseif op == $op_call_gk then local n = " . $c_v . "[a + 1]; local f = " . $e_v . "; for p in n:gmatch('[^.:]+') do f = f[p] end; f(" . $c_v . "[b + 1]) ";
|
||||
// VM Implementation
|
||||
$lua .= "local " . $v_v . " = function() ";
|
||||
$lua .= "local " . $stack_v . " = {}; local pc = 1; local " . $watchdog_v . " = 0; ";
|
||||
$lua .= "local " . $handlers_v . " = {}; ";
|
||||
|
||||
$op_stack_shuffle = $this->opMap['STACK_SHUFFLE'];
|
||||
$cases[] = "elseif op == $op_stack_shuffle then local t = " . $stack_v . "[a]; " . $stack_v . "[a] = " . $stack_v . "[b]; " . $stack_v . "[b] = t; ";
|
||||
|
||||
shuffle($cases);
|
||||
|
||||
$lua .= "local function " . $layers_v . "(op, a, b, pc) ";
|
||||
$lua .= "if false then elseif op == -1 then return ";
|
||||
$lua .= implode(" ", $cases);
|
||||
$lua .= " end end; ";
|
||||
// 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; ";
|
||||
}
|
||||
|
||||
$lua .= "local s, e = pcall(" . $layers_v . ", op, a, b, pc); ";
|
||||
$lua .= "if not s then if " . $tm_v . "() then while true do end else error(e) end end; ";
|
||||
$lua .= "pc = pc + 1; end 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 . "); ";
|
||||
|
||||
$lua .= "pcall(" . $v_v . ", 1, 1); ";
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
'protected_code' => $lua,
|
||||
'stats' => [
|
||||
'original_size' => strlen($this->rawCode),
|
||||
'protected_size' => strlen($lua),
|
||||
'vm_version' => '6.2-recursive-layered'
|
||||
]
|
||||
'stats' => ['original_size' => strlen($this->rawCode), 'protected_size' => strlen($lua), 'vm_version' => '8.1-table-virt']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$vm = new LuartexHyperionV6_2($code);
|
||||
$vm = new LuartexHyperionV8_1($code);
|
||||
echo json_encode($vm->build());
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
|
||||
|
||||
2
protected_v8_0.lua
Normal file
2
protected_v8_0.lua
Normal file
File diff suppressed because one or more lines are too long
2
protected_v8_1.lua
Normal file
2
protected_v8_1.lua
Normal file
File diff suppressed because one or more lines are too long
48
test_v8_0.php
Normal file
48
test_v8_0.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
$code = '
|
||||
print("Luartex Hyperion V8.0 Test")
|
||||
local message = "Roblox Executor Compatibility Layer"
|
||||
print(message)
|
||||
|
||||
function calculate(a, b)
|
||||
local result = a * b + 50
|
||||
return result
|
||||
end
|
||||
|
||||
local val = calculate(10, 5)
|
||||
print("Calculation Result:", val)
|
||||
|
||||
local x = 123.456
|
||||
print("Floating point test:", x)
|
||||
|
||||
print("Finished Test")
|
||||
';
|
||||
|
||||
$payload = json_encode(['code' => $code]);
|
||||
|
||||
$ch = curl_init('http://localhost/process.php');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$res = json_decode($response, true);
|
||||
if ($res && $res['success']) {
|
||||
$protected_code = $res['protected_code'];
|
||||
file_put_contents('protected_v8_0.lua', $protected_code);
|
||||
echo "Obfuscation successful. Output saved to protected_v8_0.lua\n";
|
||||
echo "Stats: " . json_encode($res['stats']) . "\n";
|
||||
|
||||
// Quick syntax check using php if lua is not available,
|
||||
// but better to just confirm the file exists and has content.
|
||||
if (strlen($protected_code) > 1000) {
|
||||
echo "Protected code looks valid (size: " . strlen($protected_code) . " bytes)\n";
|
||||
}
|
||||
} else {
|
||||
echo "Obfuscation failed: " . ($res['error'] ?? 'Unknown error') . "\n";
|
||||
echo "Response: " . $response . "\n";
|
||||
}
|
||||
|
||||
60
test_v8_1.php
Normal file
60
test_v8_1.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
$code = '
|
||||
print("Hyperion V8.1 - Table Virtualization Test")
|
||||
|
||||
local myTable = {}
|
||||
myTable["secret"] = "This is a virtualized value"
|
||||
myTable.info = "Metadata virtualized"
|
||||
myTable["level"] = 9000
|
||||
|
||||
print("Accessing Table via Virtualization:")
|
||||
local secret = myTable["secret"]
|
||||
print("Secret:", secret)
|
||||
|
||||
local info = myTable.info
|
||||
print("Info:", info)
|
||||
|
||||
local level = myTable["level"]
|
||||
print("Level:", level)
|
||||
|
||||
function checkTable(t)
|
||||
print("Checking Table Key Directly...")
|
||||
local val = t["secret"]
|
||||
if val == "This is a virtualized value" then
|
||||
print("Success: Virtualization Layer Passed")
|
||||
else
|
||||
print("Failure: Virtualization Layer Mismatch")
|
||||
end
|
||||
end
|
||||
|
||||
checkTable(myTable)
|
||||
|
||||
print("Finished V8.1 Test")
|
||||
';
|
||||
|
||||
$payload = json_encode(['code' => $code]);
|
||||
|
||||
$ch = curl_init('http://localhost/process.php');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$res = json_decode($response, true);
|
||||
if ($res && $res['success']) {
|
||||
$protected_code = $res['protected_code'];
|
||||
file_put_contents('protected_v8_1.lua', $protected_code);
|
||||
echo "Obfuscation successful. Output saved to protected_v8_1.lua\n";
|
||||
echo "Stats: " . json_encode($res['stats']) . "\n";
|
||||
|
||||
if (strlen($protected_code) > 1000) {
|
||||
echo "Protected code looks valid (size: " . strlen($protected_code) . " bytes)\n";
|
||||
}
|
||||
} else {
|
||||
echo "Obfuscation failed: " . ($res['error'] ?? 'Unknown error') . "\n";
|
||||
echo "Response: " . $response . "\n";
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user