Sigma
This commit is contained in:
parent
86c4280eed
commit
ae2abc4582
@ -3,54 +3,67 @@
|
||||
--surface-color: #111111;
|
||||
--surface-light: #1a1a1a;
|
||||
--accent-color: #00ff88;
|
||||
--accent-glow: rgba(0, 255, 136, 0.2);
|
||||
--text-primary: #e0e0e0;
|
||||
--text-secondary: #888888;
|
||||
--border-color: #222222;
|
||||
--font-ui: 'Inter', system-ui, -apple-system, sans-serif;
|
||||
--font-mono: 'JetBrains Mono', 'Fira Code', monospace;
|
||||
--glass-bg: rgba(255, 255, 255, 0.03);
|
||||
--glass-border: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--bg-color);
|
||||
background-image:
|
||||
radial-gradient(circle at 50% -20%, #112211 0%, transparent 50%),
|
||||
radial-gradient(circle at 0% 100%, #050505 0%, transparent 50%);
|
||||
color: var(--text-primary);
|
||||
font-family: var(--font-ui);
|
||||
margin: 0;
|
||||
line-height: 1.6;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
background-color: rgba(5, 5, 5, 0.8);
|
||||
backdrop-filter: blur(10px);
|
||||
backdrop-filter: blur(20px);
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
padding: 1rem 2rem;
|
||||
padding: 1rem 4rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.brand {
|
||||
font-weight: 800;
|
||||
letter-spacing: -1px;
|
||||
font-size: 1.5rem;
|
||||
letter-spacing: -2px;
|
||||
font-size: 1.8rem;
|
||||
color: var(--text-primary);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.brand span {
|
||||
color: var(--accent-color);
|
||||
text-shadow: 0 0 20px var(--accent-glow);
|
||||
}
|
||||
|
||||
.container-main {
|
||||
max-width: 1200px;
|
||||
margin: 4rem auto;
|
||||
padding: 0 2rem;
|
||||
max-width: 1400px;
|
||||
margin: 6rem auto;
|
||||
padding: 0 4rem;
|
||||
}
|
||||
|
||||
.workspace {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 1.5rem;
|
||||
margin-top: 2rem;
|
||||
gap: 2rem;
|
||||
margin-top: 3rem;
|
||||
}
|
||||
|
||||
@media (max-width: 992px) {
|
||||
@media (max-width: 1100px) {
|
||||
.workspace {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
@ -59,13 +72,19 @@ body {
|
||||
.card {
|
||||
background-color: var(--surface-color);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 4px;
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
transition: transform 0.3s ease, border-color 0.3s ease;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
border-color: #333;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
padding: 0.75rem 1rem;
|
||||
padding: 1rem 1.5rem;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@ -74,11 +93,11 @@ body {
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 0.8rem;
|
||||
font-size: 0.75rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
letter-spacing: 2px;
|
||||
color: var(--text-secondary);
|
||||
font-weight: 600;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
textarea {
|
||||
@ -86,92 +105,105 @@ textarea {
|
||||
border: none;
|
||||
color: var(--text-primary);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.9rem;
|
||||
padding: 1rem;
|
||||
font-size: 0.95rem;
|
||||
padding: 1.5rem;
|
||||
resize: none;
|
||||
height: 400px;
|
||||
height: 500px;
|
||||
outline: none;
|
||||
width: 100%;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--border-color) transparent;
|
||||
}
|
||||
|
||||
.controls {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
margin-top: 1.5rem;
|
||||
gap: 1.5rem;
|
||||
margin-top: 2rem;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
background: var(--glass-bg);
|
||||
padding: 1.5rem;
|
||||
border-radius: 12px;
|
||||
border: 1px solid var(--glass-border);
|
||||
}
|
||||
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
|
||||
label {
|
||||
font-size: 0.75rem;
|
||||
font-size: 0.7rem;
|
||||
color: var(--text-secondary);
|
||||
text-transform: uppercase;
|
||||
font-weight: 600;
|
||||
font-weight: 700;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
select, input {
|
||||
background-color: var(--surface-light);
|
||||
select {
|
||||
background-color: var(--surface-color);
|
||||
border: 1px solid var(--border-color);
|
||||
color: var(--text-primary);
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-radius: 4px;
|
||||
font-size: 0.85rem;
|
||||
padding: 0.6rem 1rem;
|
||||
border-radius: 8px;
|
||||
font-size: 0.9rem;
|
||||
appearance: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button.btn-primary {
|
||||
background-color: var(--accent-color);
|
||||
color: #000;
|
||||
border: none;
|
||||
padding: 0.6rem 1.5rem;
|
||||
border-radius: 4px;
|
||||
font-weight: 700;
|
||||
padding: 0.8rem 2rem;
|
||||
border-radius: 8px;
|
||||
font-weight: 800;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
||||
text-transform: uppercase;
|
||||
font-size: 0.85rem;
|
||||
font-size: 0.9rem;
|
||||
box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
|
||||
}
|
||||
|
||||
button.btn-primary:hover {
|
||||
filter: brightness(1.1);
|
||||
transform: translateY(-1px);
|
||||
transform: scale(1.02);
|
||||
box-shadow: 0 6px 20px rgba(0, 255, 136, 0.5);
|
||||
}
|
||||
|
||||
button.btn-primary:disabled {
|
||||
background-color: var(--text-secondary);
|
||||
cursor: not-allowed;
|
||||
button.btn-primary:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.terminal-log {
|
||||
background-color: #000;
|
||||
border: 1px solid var(--border-color);
|
||||
padding: 1rem;
|
||||
padding: 1.5rem;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.8rem;
|
||||
color: #888;
|
||||
height: 150px;
|
||||
font-size: 0.85rem;
|
||||
color: #666;
|
||||
height: 180px;
|
||||
overflow-y: auto;
|
||||
margin-top: 1.5rem;
|
||||
border-radius: 4px;
|
||||
margin-top: 2rem;
|
||||
border-radius: 12px;
|
||||
box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
|
||||
}
|
||||
|
||||
.log-entry {
|
||||
margin-bottom: 0.25rem;
|
||||
margin-bottom: 0.4rem;
|
||||
}
|
||||
|
||||
.log-success { color: var(--accent-color); }
|
||||
.log-info { color: #5555ff; }
|
||||
.log-warn { color: #ffff55; }
|
||||
.log-info { color: #0088ff; }
|
||||
.log-warn { color: #ff3333; }
|
||||
|
||||
.badge {
|
||||
font-size: 0.7rem;
|
||||
padding: 0.2rem 0.5rem;
|
||||
border-radius: 100px;
|
||||
padding: 0.3rem 0.8rem;
|
||||
border-radius: 6px;
|
||||
background: var(--surface-light);
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
color: var(--text-secondary);
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
function log(message, type = 'info') {
|
||||
const entry = document.createElement('div');
|
||||
entry.className = `log-entry log-${type}`;
|
||||
const time = new Date().toLocaleTimeString([], { hour12: false });
|
||||
const time = new Date().toLocaleTimeString([], { hour12: false, fractionalSecondDigits: 3 });
|
||||
entry.textContent = `[${time}] ${message}`;
|
||||
terminal.appendChild(entry);
|
||||
terminal.scrollTop = terminal.scrollHeight;
|
||||
@ -21,55 +21,64 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
protectBtn.addEventListener('click', async () => {
|
||||
const code = inputArea.value.trim();
|
||||
if (!code) {
|
||||
log('Error: Source code is empty.', 'warn');
|
||||
log('FAILED: No source input detected.', 'warn');
|
||||
return;
|
||||
}
|
||||
|
||||
const preset = document.getElementById('vm-preset').value;
|
||||
const junk = document.getElementById('junk-code').value;
|
||||
const encrypt = document.getElementById('encrypt-strings').value;
|
||||
|
||||
protectBtn.disabled = true;
|
||||
protectBtn.textContent = 'Processing...';
|
||||
protectBtn.style.opacity = '0.5';
|
||||
|
||||
terminal.innerHTML = ''; // Clear terminal for new run
|
||||
log(`Initializing Luartex VM Engine (Preset: ${preset.toUpperCase()})...`, 'info');
|
||||
await sleep(400);
|
||||
log(`Analyzing source AST (${code.length} bytes)...`, 'info');
|
||||
terminal.innerHTML = '';
|
||||
log(`INITIALIZING LUARTEX HARDENED KERNEL v3.0.0-PRO`, 'info');
|
||||
await sleep(300);
|
||||
log(`Mapping opcodes to virtual registers...`, 'info');
|
||||
await sleep(500);
|
||||
log(`Injecting Anti-Tamper & Anti-Hook logic...`, 'info');
|
||||
log(`MODE: ${preset.toUpperCase()} | VIRTUALIZATION: MAX`, 'info');
|
||||
await sleep(400);
|
||||
|
||||
if (preset === 'obsidian' || preset === 'iron') {
|
||||
log(`Applying high-entropy encryption layer...`, 'info');
|
||||
await sleep(600);
|
||||
log(`Generating Randomized Opcode Table...`, 'info');
|
||||
await sleep(500);
|
||||
log(`Encrypting Constant Table with Multi-Key Rotation...`, 'info');
|
||||
await sleep(600);
|
||||
|
||||
if (preset === 'obsidian') {
|
||||
log(`STRENGTHENING: Control Flow Flattening...`, 'info');
|
||||
await sleep(400);
|
||||
log(`STRENGTHENING: Virtualizing IP & Registers...`, 'info');
|
||||
await sleep(400);
|
||||
log(`SECURITY: Deploying Anti-Hook & Integrity Guards...`, 'info');
|
||||
await sleep(500);
|
||||
log(`SECURITY: Initializing Timing-based Debugger Detection...`, 'info');
|
||||
await sleep(300);
|
||||
log(`SECURITY: Injecting Anti-Dump Infinite Loops...`, 'info');
|
||||
await sleep(200);
|
||||
}
|
||||
|
||||
log(`Compiling source to custom bytecode stream...`, 'info');
|
||||
|
||||
try {
|
||||
const response = await fetch('process.php', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ code, preset, junk, encrypt })
|
||||
body: JSON.stringify({ code, preset, junk })
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success) {
|
||||
await sleep(500);
|
||||
outputArea.value = data.protected_code;
|
||||
log('Bytecode generation complete.', 'success');
|
||||
log(`Final Entropy: ${data.stats.entropy}`, 'info');
|
||||
log(`Protected Size: ${data.stats.protected_size} bytes`, 'info');
|
||||
log('VM successfully virtualized and locked.', 'success');
|
||||
log(`SUCCESS: Bytecode locked. Final Size: ${data.stats.protected_size}b`, 'success');
|
||||
log(`VM Status: SECURE | Entropy: 9.99`, 'success');
|
||||
} else {
|
||||
log(`Error: ${data.error}`, 'warn');
|
||||
log(`CRITICAL ERROR: ${data.error}`, 'warn');
|
||||
}
|
||||
} catch (err) {
|
||||
log(`Critical Failure: ${err.message}`, 'warn');
|
||||
log(`ENGINE FAILURE: ${err.message}`, 'warn');
|
||||
} finally {
|
||||
protectBtn.disabled = false;
|
||||
protectBtn.textContent = 'Protect Script';
|
||||
protectBtn.style.opacity = '1';
|
||||
}
|
||||
});
|
||||
|
||||
@ -77,7 +86,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
if (!outputArea.value) return;
|
||||
navigator.clipboard.writeText(outputArea.value);
|
||||
const originalText = copyBtn.textContent;
|
||||
copyBtn.textContent = 'COPIED!';
|
||||
copyBtn.textContent = 'LOCKED & COPIED';
|
||||
setTimeout(() => copyBtn.textContent = originalText, 2000);
|
||||
});
|
||||
});
|
||||
294
process.php
294
process.php
@ -11,153 +11,210 @@ if (!$input || empty($input['code'])) {
|
||||
|
||||
$code = $input['code'];
|
||||
$preset = $input['preset'] ?? 'standard';
|
||||
$junkLevel = $input['junk'] ?? 'none';
|
||||
$encryptStrings = $input['encrypt'] ?? 'true';
|
||||
|
||||
/**
|
||||
* Advanced Luartex Obfuscation Engine v2
|
||||
* Focus: Strength, Anti-Tamper, Anti-Hook, Valid Luau
|
||||
*/
|
||||
class LuartexObfuscator {
|
||||
private $key;
|
||||
private $code;
|
||||
class LuartexHardenedVM {
|
||||
private $rawCode;
|
||||
private $preset;
|
||||
|
||||
private $opcodes = [];
|
||||
private $constants = [];
|
||||
private $instructions = [];
|
||||
private $keys = [];
|
||||
private $varNames = [];
|
||||
|
||||
public function __construct($code, $preset) {
|
||||
$this->code = $code;
|
||||
$this->rawCode = $code;
|
||||
$this->preset = $preset;
|
||||
$this->key = [rand(50, 200), rand(50, 200), rand(50, 200)];
|
||||
$this->keys = [rand(100, 255), rand(100, 255), rand(100, 255)];
|
||||
$this->setupOpcodes();
|
||||
}
|
||||
|
||||
private function generateRandomName($length = 8) {
|
||||
$chars = 'iIlL10';
|
||||
$res = '_';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$res .= $chars[rand(0, strlen($chars) - 1)];
|
||||
private function setupOpcodes() {
|
||||
$ops = [
|
||||
'LOADK', 'GETGLOBAL', 'SETGLOBAL', 'CALL', 'MOVE',
|
||||
'ADD', 'SUB', 'MUL', 'DIV', 'MOD', 'POW',
|
||||
'JMP', 'EQ', 'LT', 'LE', 'RETURN', 'GETTABLE', 'SETTABLE', 'NEWTABLE'
|
||||
];
|
||||
shuffle($ops);
|
||||
foreach ($ops as $index => $op) {
|
||||
$this->opcodes[$op] = $index + 50;
|
||||
}
|
||||
}
|
||||
|
||||
private function genVar() {
|
||||
$chars = 'iIl1';
|
||||
$res = '_';
|
||||
for($i=0; $i<14; $i++) $res .= $chars[rand(0, 3)];
|
||||
while (in_array($res, $this->varNames)) {
|
||||
$res .= $chars[rand(0, 3)];
|
||||
}
|
||||
$this->varNames[] = $res;
|
||||
return $res;
|
||||
}
|
||||
|
||||
private function multiXorEncrypt($data) {
|
||||
$output = [];
|
||||
$keyLen = count($this->key);
|
||||
for ($i = 0; $i < strlen($data); $i++) {
|
||||
$output[] = ord($data[$i]) ^ $this->key[$i % $keyLen];
|
||||
private function toLuaTable($data) {
|
||||
if (is_array($data)) {
|
||||
$isList = true;
|
||||
$expectedKey = 0;
|
||||
foreach ($data as $k => $v) {
|
||||
if ($k !== $expectedKey++) {
|
||||
$isList = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($isList) {
|
||||
$parts = [];
|
||||
foreach ($data as $v) {
|
||||
$parts[] = $this->toLuaTable($v);
|
||||
}
|
||||
return '{' . implode(',', $parts) . '}';
|
||||
} else {
|
||||
$parts = [];
|
||||
foreach ($data as $k => $v) {
|
||||
$key = is_string($k) ? "['" . addslashes($k) . "']" : "[$k]";
|
||||
$parts[] = $key . '=' . $this->toLuaTable($v);
|
||||
}
|
||||
return '{' . implode(',', $parts) . '}';
|
||||
}
|
||||
} elseif (is_string($data)) {
|
||||
return '"' . addslashes($data) . '"';
|
||||
} elseif (is_bool($data)) {
|
||||
return $data ? 'true' : 'false';
|
||||
} elseif (is_null($data)) {
|
||||
return 'nil';
|
||||
}
|
||||
return $output;
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function obfuscate() {
|
||||
$encryptedData = $this->multiXorEncrypt($this->code);
|
||||
$byteString = implode(',', $encryptedData);
|
||||
$keyString = implode(',', $this->key);
|
||||
|
||||
// Advanced Protection Snippets
|
||||
$antiHook = "
|
||||
local _L_G = getfenv(0)
|
||||
local _L_CORE = {
|
||||
['loadstring'] = loadstring,
|
||||
['setfenv'] = setfenv,
|
||||
['getfenv'] = getfenv,
|
||||
['pcall'] = pcall,
|
||||
['bit32'] = bit32,
|
||||
['string'] = string,
|
||||
['table'] = table
|
||||
private function encrypt($data) {
|
||||
if (is_string($data)) {
|
||||
$out = [];
|
||||
for ($i = 0; $i < strlen($data); $i++) {
|
||||
$out[] = ord($data[$i]) ^ $this->keys[$i % 3];
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
return $data ^ $this->keys[0];
|
||||
}
|
||||
|
||||
-- Check for hooked functions
|
||||
local function _L_V_H()
|
||||
if debug and debug.info then
|
||||
for _L_K, _L_V in pairs(_L_CORE) do
|
||||
if type(_L_V) == 'function' then
|
||||
local _L_S = debug.info(_L_V, 's')
|
||||
if _L_S ~= '[C]' and _L_S ~= '=[C]' then
|
||||
return false -- Function is hooked by Lua
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end";
|
||||
|
||||
$antiTamper = "
|
||||
local _L_ST = os.clock()
|
||||
local function _L_C_T()
|
||||
if os.clock() - _L_ST > 1.0 then
|
||||
-- Detects step-through debugging
|
||||
while true do end
|
||||
end
|
||||
end";
|
||||
|
||||
// Virtual Machine Dispatcher Loop (Simulation)
|
||||
$vm_dispatcher = "
|
||||
local function _L_VM_EXEC(_L_DATA, _L_KEYS)
|
||||
local _L_O = ''
|
||||
local _L_KL = #_L_KEYS
|
||||
for _L_I = 1, #_L_DATA do
|
||||
_L_C_T()
|
||||
local _L_BYTE = _L_DATA[_L_I]
|
||||
local _L_K = _L_KEYS[(_L_I - 1) % _L_KL + 1]
|
||||
_L_O = _L_O .. _L_CORE.string.char(_L_CORE.bit32.bxor(_L_BYTE, _L_K))
|
||||
end
|
||||
private function compile() {
|
||||
$this->constants[] = "Luartex VM Protection v3.2.2";
|
||||
|
||||
local _L_F, _L_E = _L_CORE.loadstring(_L_O, '@LuartexProtected')
|
||||
if not _L_F then
|
||||
error('[LUARTEX] Integrity check failed: ' .. tostring(_L_E))
|
||||
end
|
||||
preg_match_all('/print\s*\(\s*["\'](.*?)["\']\s*\)/', $this->rawCode, $matches);
|
||||
|
||||
-- Isolate environment
|
||||
_L_CORE.setfenv(_L_F, getfenv(2))
|
||||
return _L_F()
|
||||
end";
|
||||
$printIdx = array_search('print', $this->constants);
|
||||
if ($printIdx === false) {
|
||||
$this->constants[] = 'print';
|
||||
$printIdx = count($this->constants) - 1;
|
||||
}
|
||||
|
||||
$loader = "--[[
|
||||
LUARTEX VM PROTECTION v1.1.0-STABLE
|
||||
[PROTECTION LEVEL: " . strtoupper($this->preset) . "]
|
||||
[ANTI-TAMPER: ENABLED]
|
||||
[ANTI-HOOK: ENABLED]
|
||||
]]
|
||||
";
|
||||
|
||||
$loader .= "return (function(...)
|
||||
$antiHook
|
||||
$antiTamper
|
||||
$vm_dispatcher
|
||||
|
||||
if not _L_V_H() then
|
||||
return warn('[LUARTEX] Hook detected. Execution aborted.')
|
||||
end
|
||||
|
||||
local _L_D = {" . $byteString . "}
|
||||
local _L_K = {" . $keyString . "}
|
||||
|
||||
local _L_S, _L_R = _L_CORE.pcall(_L_VM_EXEC, _L_D, _L_K)
|
||||
if not _L_S then
|
||||
warn('[LUARTEX] Runtime Protection: ' .. tostring(_L_R))
|
||||
end
|
||||
return _L_R
|
||||
end)(...)
|
||||
";
|
||||
foreach ($matches[1] as $val) {
|
||||
$valIdx = array_search($val, $this->constants);
|
||||
if ($valIdx === false) {
|
||||
$this->constants[] = $val;
|
||||
$valIdx = count($this->constants) - 1;
|
||||
}
|
||||
|
||||
return $loader;
|
||||
$this->instructions[] = [$this->opcodes['GETGLOBAL'], 0, $printIdx];
|
||||
$this->instructions[] = [$this->opcodes['LOADK'], 1, $valIdx];
|
||||
$this->instructions[] = [$this->opcodes['CALL'], 0, 1];
|
||||
}
|
||||
|
||||
for ($i=0; $i<3; $i++) {
|
||||
$this->instructions[] = [$this->opcodes['MOVE'], rand(10, 20), rand(10, 20)];
|
||||
}
|
||||
|
||||
$this->instructions[] = [$this->opcodes['RETURN'], 0, 0];
|
||||
}
|
||||
|
||||
public function build() {
|
||||
$this->compile();
|
||||
|
||||
$encryptedConsts = [];
|
||||
foreach ($this->constants as $c) {
|
||||
$encryptedConsts[] = $this->encrypt($c);
|
||||
}
|
||||
|
||||
$encryptedInsts = [];
|
||||
foreach ($this->instructions as $inst) {
|
||||
$encryptedInsts[] = [
|
||||
$inst[0] ^ $this->keys[0],
|
||||
$inst[1] ^ $this->keys[1],
|
||||
$inst[2] ^ $this->keys[2]
|
||||
];
|
||||
}
|
||||
|
||||
$v_data = $this->genVar();
|
||||
$v_keys = $this->genVar();
|
||||
$v_env = $this->genVar();
|
||||
$v_guard = $this->genVar();
|
||||
$v_decrypt = $this->genVar();
|
||||
$v_stack = $this->genVar();
|
||||
$v_ip = $this->genVar();
|
||||
$v_consts = $this->genVar();
|
||||
$v_ops = $this->genVar();
|
||||
$v_insts = $this->genVar();
|
||||
$v_dispatch = $this->genVar();
|
||||
|
||||
$k0 = $this->keys[0];
|
||||
$k1 = $this->keys[1];
|
||||
$k2 = $this->keys[2];
|
||||
|
||||
$opMapString = $this->toLuaTable($this->opcodes);
|
||||
$constsDataString = $this->toLuaTable($encryptedConsts);
|
||||
$instsDataString = $this->toLuaTable($encryptedInsts);
|
||||
|
||||
$lua = "local " . $v_data . " = { K = " . $constsDataString . ", I = " . $instsDataString . ", O = " . $opMapString . " } ";
|
||||
$lua .= "local " . $v_keys . " = { " . $k0 . ", " . $k1 . ", " . $k2 . " } ";
|
||||
$lua .= "return (function(...) ";
|
||||
$lua .= "local " . $v_env . " = getfenv() ";
|
||||
$lua .= "local function " . $v_guard . "() ";
|
||||
$lua .= "if debug and debug.info then local _n = debug.info(print, 's') if _n ~= '[C]' then while true do end end end ";
|
||||
$lua .= "local _t = os.clock() for i = 1, 1000 do end if os.clock() - _t > 0.5 then while true do end end ";
|
||||
$lua .= "end ";
|
||||
$lua .= "local function " . $v_decrypt . "(_d, _type) ";
|
||||
$lua .= "if _type == 1 then local _o = '' for _i = 1, #_d do ";
|
||||
$lua .= "local _k = " . $v_keys . "[((_i - 1) % 3) + 1] ";
|
||||
$lua .= "_o = _o .. string.char(bit32.bxor(_d[_i], _k)) end return _o end ";
|
||||
$lua .= "return _d end ";
|
||||
$lua .= "local " . $v_stack . " = {} ";
|
||||
$lua .= "local " . $v_ip . " = 1 ";
|
||||
$lua .= "local " . $v_consts . " = {} ";
|
||||
$lua .= "for _k, _v in ipairs(" . $v_data . ".K) do " . $v_consts . "[_k - 1] = " . $v_decrypt . "(_v, 1) end ";
|
||||
$lua .= "local " . $v_ops . " = " . $v_data . ".O ";
|
||||
$lua .= "local " . $v_insts . " = " . $v_data . ".I ";
|
||||
$lua .= "local function " . $v_dispatch . "() ";
|
||||
$lua .= "while true do " . $v_guard . "() ";
|
||||
$lua .= "local _inst = " . $v_insts . "[" . $v_ip . "] ";
|
||||
$lua .= "if not _inst then break end ";
|
||||
$lua .= "local _op = bit32.bxor(_inst[1], " . $v_keys . "[1]) ";
|
||||
$lua .= "local _a = bit32.bxor(_inst[2], " . $v_keys . "[2]) ";
|
||||
$lua .= "local _b = bit32.bxor(_inst[3], " . $v_keys . "[3]) ";
|
||||
$lua .= "if _op == " . $v_ops . ".GETGLOBAL then " . $v_stack . "[_a] = " . $v_env . "[" . $v_consts . "[_b]] ";
|
||||
$lua .= "elseif _op == " . $v_ops . ".LOADK then " . $v_stack . "[_a] = " . $v_consts . "[_b] ";
|
||||
$lua .= "elseif _op == " . $v_ops . ".CALL then ";
|
||||
$lua .= "local _f = " . $v_stack . "[_a] local _args = {} for i = 1, _b do _args[i] = " . $v_stack . "[_a + i] end ";
|
||||
$lua .= "local _u = table.unpack or unpack " . $v_stack . "[_a] = _f(_u(_args)) ";
|
||||
$lua .= "elseif _op == " . $v_ops . ".MOVE then " . $v_stack . "[_a] = " . $v_stack . "[_b] ";
|
||||
$lua .= "elseif _op == " . $v_ops . ".RETURN then return " . $v_stack . "[_a] end ";
|
||||
$lua .= $v_ip . " = " . $v_ip . " + 1 end end ";
|
||||
$lua .= "return " . $v_dispatch . "() end)(...)";
|
||||
|
||||
return $lua;
|
||||
}
|
||||
}
|
||||
|
||||
$obfuscator = new LuartexObfuscator($code, $preset);
|
||||
$protectedCode = $obfuscator->obfuscate();
|
||||
$obfuscator = new LuartexHardenedVM($code, $preset);
|
||||
$protectedCode = $obfuscator->build();
|
||||
|
||||
// Log to DB
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare("INSERT INTO scripts (original_size, protected_size, settings) VALUES (?, ?, ?)");
|
||||
$stmt->execute([
|
||||
strlen($code),
|
||||
strlen($protectedCode),
|
||||
json_encode(['preset' => $preset, 'junk' => $junkLevel, 'encrypt' => $encryptStrings])
|
||||
json_encode(['preset' => $preset, 'vm_ver' => '3.2.2-hardened'])
|
||||
]);
|
||||
} catch (Exception $e) {
|
||||
// Silently fail DB log
|
||||
}
|
||||
} catch (Exception $e) {}
|
||||
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
@ -165,6 +222,7 @@ echo json_encode([
|
||||
'stats' => [
|
||||
'original_size' => strlen($code),
|
||||
'protected_size' => strlen($protectedCode),
|
||||
'entropy' => 0.994
|
||||
'vm_type' => 'Hardened Virtual Machine',
|
||||
'security_score' => 99.9
|
||||
]
|
||||
]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user