57 lines
1.6 KiB
PHP
57 lines
1.6 KiB
PHP
<?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);
|
|
}
|
|
|