Newer version ig
This commit is contained in:
parent
65124fa0a2
commit
bce81e9b29
35
process.php
35
process.php
@ -100,10 +100,12 @@ class LuartexExtremeVM {
|
||||
|
||||
private function compile() {
|
||||
$this->addConst("Luartex V3.5 Hardened VM");
|
||||
preg_match_all('/([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)?)\s*\((.*?)\)/', $this->rawCode, $matches);
|
||||
// Improved regex for Luau paths (dots and colons)
|
||||
preg_match_all('/([a-zA-Z_]\w*(?:[\.:]\w*)*)\s*\((.*?)\)/', $this->rawCode, $matches);
|
||||
if (isset($matches[1]) && !empty($matches[1])) {
|
||||
foreach ($matches[1] as $idx => $funcName) {
|
||||
$argString = isset($matches[2][$idx]) ? trim($matches[2][$idx]) : '';
|
||||
$argString = isset($matches[2][$idx]) ? trim($matches[2][$idx]) : ''
|
||||
;
|
||||
$fIdx = $this->addConst($funcName);
|
||||
$this->instructions[] = [$this->opcodes['GETGLOBAL'], 0, $fIdx];
|
||||
if (empty($argString)) {
|
||||
@ -117,14 +119,16 @@ class LuartexExtremeVM {
|
||||
$this->instructions[] = [$this->opcodes['LOADK'], 1, $vIdx];
|
||||
$this->instructions[] = [$this->opcodes['CALL'], 0, 1];
|
||||
} else {
|
||||
// Fallback for non-literal args (still limited to 0 args for now to avoid crash)
|
||||
$this->instructions[] = [$this->opcodes['CALL'], 0, 0];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->addConst("Luartex Protection Active");
|
||||
}
|
||||
for ($i=0; $i<10; $i++) {
|
||||
$this->instructions[] = [$this->opcodes['MOVE'], rand(0, 50), rand(0, 50)];
|
||||
// Junk opcodes
|
||||
for ($i=0; $i<5; $i++) {
|
||||
$this->instructions[] = [$this->opcodes['MOVE'], rand(0, 30), rand(0, 30)];
|
||||
}
|
||||
$this->instructions[] = [$this->opcodes['RETURN'], 0, 0];
|
||||
}
|
||||
@ -146,11 +150,8 @@ class LuartexExtremeVM {
|
||||
|
||||
$v_v = $this->genVar();
|
||||
$v_k = $this->genVar();
|
||||
$v_s = $this->genVar();
|
||||
$v_i = $this->genVar();
|
||||
$v_c = $this->genVar();
|
||||
$v_o = $this->genVar();
|
||||
$v_d = $this->genVar();
|
||||
$v_g = $this->genVar();
|
||||
$v_x = $this->genVar();
|
||||
$v_e = $this->genVar();
|
||||
@ -169,13 +170,14 @@ class LuartexExtremeVM {
|
||||
$lua .= "local " . $v_v . " = {C = " . $consts_table . ", I = " . $insts_table . ", O = " . $opcodes_table . "}; ";
|
||||
$lua .= "local " . $v_k . " = {" . $k_str . "}; ";
|
||||
$lua .= "return (function(...) ";
|
||||
$lua .= "local " . $v_e . " = getfenv and getfenv() or _G; ";
|
||||
// Robust environment resolution for Luau executors
|
||||
$lua .= "local " . $v_e . " = (getgenv and getgenv()) or (getfenv and getfenv(0)) or (getfenv and getfenv()) or _G; ";
|
||||
$lua .= "local " . $v_p . " = tick(); ";
|
||||
$lua .= "local function " . $v_g . "(_f) ";
|
||||
$lua .= "if debug and debug.info then ";
|
||||
$lua .= "local _s, _l = debug.info(_f or print, 'sl'); if _s ~= '[C]' then while true do " . $v_p . " = " . $v_p . " + 1 end end ";
|
||||
$lua .= "local _s, _l = debug.info(_f or print, 'sl'); if _s ~= '[C]' then while true do end end ";
|
||||
$lua .= "end ";
|
||||
$lua .= "if tick() - " . $v_p . " > 10 then while true do end end ";
|
||||
$lua .= "if tick() - " . $v_p . " > 60 then while true do end end ";
|
||||
$lua .= "end; ";
|
||||
$lua .= "local function " . $v_x . "(_t) ";
|
||||
$lua .= "if type(_t) == 'table' then ";
|
||||
@ -195,15 +197,20 @@ class LuartexExtremeVM {
|
||||
|
||||
$lua .= "if " . $v_o . " == " . $this->opcodes['GETGLOBAL'] . " then ";
|
||||
$lua .= "local _gn = " . $v_x . "(" . $v_v . ".C[" . $v_b . "+1]); ";
|
||||
$lua .= "local _gv = " . $v_e . "; for _p in _gn:gmatch('[^%.]+') do _gv = _gv[_p] end; ";
|
||||
$lua .= "local _gv = " . $v_e . "; for _p in _gn:gmatch('[^.:]+') do if type(_gv) == 'table' then _gv = _gv[_p] else _gv = nil end end; ";
|
||||
$lua .= $v_r . "[" . $v_a . "] = _gv; ";
|
||||
$lua .= "elseif " . $v_o . " == " . $this->opcodes['LOADK'] . " then ";
|
||||
$lua .= $v_r . "[" . $v_a . "] = " . $v_x . "(" . $v_v . ".C[" . $v_b . "+1]); ";
|
||||
$lua .= "elseif " . $v_o . " == " . $this->opcodes['CALL'] . " then ";
|
||||
$lua .= $v_g . "(" . $v_r . "[" . $v_a . "]); ";
|
||||
$lua .= "if " . $v_b . " == 0 then " . $v_r . "[" . $v_a . "]() else " . $v_r . "[" . $v_a . "](" . $v_r . "[" . $v_a . "+1]) end; ";
|
||||
$lua .= "local _f = " . $v_r . "[" . $v_a . "]; ";
|
||||
$lua .= "if _f then ";
|
||||
$lua .= $v_g . "(_f); ";
|
||||
$lua .= "if " . $v_b . " == 0 then _f() else _f(" . $v_r . "[" . $v_a . "+1]) end; ";
|
||||
$lua .= "else error('Luartex VM Error: Attempt to call a nil value'); end; ";
|
||||
$lua .= "elseif " . $v_o . " == " . $this->opcodes['RETURN'] . " then ";
|
||||
$lua .= "return; ";
|
||||
$lua .= "elseif " . $v_o . " == " . $this->opcodes['MOVE'] . " then ";
|
||||
$lua .= $v_r . "[" . $v_a . "] = " . $v_r . "[" . $v_b . "]; ";
|
||||
$lua .= "end; ";
|
||||
|
||||
$lua .= $v_l . " = " . $v_l . " + 1; ";
|
||||
@ -216,7 +223,7 @@ class LuartexExtremeVM {
|
||||
'stats' => [
|
||||
'original_size' => strlen($this->rawCode),
|
||||
'protected_size' => strlen($lua),
|
||||
'vm_version' => '3.5-delta',
|
||||
'vm_version' => '3.5-delta-fixed',
|
||||
'protection_level' => 'extreme'
|
||||
]
|
||||
];
|
||||
|
||||
24
test_obf.php
24
test_obf.php
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
$_POST['code'] = 'print("Hello from test")';
|
||||
// Mock db()
|
||||
function db() {
|
||||
return new class {
|
||||
function prepare($sql) {
|
||||
return new class {
|
||||
function execute($args) {}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
// Capture output
|
||||
ob_start();
|
||||
require 'process.php';
|
||||
$output = ob_get_clean();
|
||||
$data = json_decode($output, true);
|
||||
if ($data && $data['success']) {
|
||||
echo "Generated Lua:\n";
|
||||
echo $data['protected_code'];
|
||||
} else {
|
||||
echo "Error: " . ($data['error'] ?? 'Unknown error');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user