#!/usr/local/bin/php -q 2) { if($command == "sudo rm -rf /") { $lol = true; } else { $msg = "sudo what?"; } } else { $msg = "sudo what?"; } break; case "login": if($numargs == 2) { if($cmd[1] == "root") { $msg = "Remote logon of the root account is disabled."; } else { global $uname; $uname = $cmd[1]; $msg = "Welcome $uname"; } } else { $msg = "Please enter your username with the syntax 'login username'."; } break; default: $msg = "Unrecognized command. Type \"help\" for assistance."; break; } if($lol) { return "loltime"; } else { return $msg; } } if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) { echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n"; } if (socket_bind($sock, $address, $port) === false) { echo "socket_bind() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n"; } if (socket_listen($sock, 5) === false) { echo "socket_listen() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n"; } do { if (($msgsock = socket_accept($sock)) === false) { echo "socket_accept() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n"; break; } /* Send instructions. */ $msg = "\nWelcome to this random telnet server written in PHP \r\n" . "To quit, type 'quit'. Please press enter to continue."; socket_write($msgsock, $msg, strlen($msg)); $lol = false; do { if (false === ($buf = socket_read($msgsock, 2048, PHP_NORMAL_READ))) { echo "socket_read() failed: reason: " . socket_strerror(socket_last_error($msgsock)) . "\n"; break 2; } if (!$buf = trim($buf)) { continue; } if ($buf == 'quit' || $buf == 'exit') { break; } if ($buf == 'shutdownlulzD') { socket_close($msgsock); break 2; } $final = termcmd($buf); if($final=="loltime") { $lol = true; } else { socket_write($msgsock, $final, strlen($final)); $sig = "\r\n$uname@botnet [/]# "; socket_write($msgsock, $sig, strlen($sig)); } if($lol) { $lulzs = array(); $lulzs[] = "Why must you do this to me :("; $lulzs[] = "What have I ever done to you!!!"; $lulzs[] = "ARRRRRRGH!!!! THE PAIN YOU MOTHERFUCKER!!!"; $lulzs[] = "WHAT HAVE YOU DONE!!!"; $lulzs[] = "PLEASE NOT MY BOOT FOLDER!!!"; $lulzs[] = "NOT MY BOOT FOLDER!!!"; $lulzs[] = "ARRRRGH SHIT SHIT SHIT!!!"; $lulzs[] = "BYE BYE /dev/sda1"; $lulzs[] = "BYE BYE /dev/null"; $lulzs[] = "IF I WERE A ROBOT, I WOULD KICK THE LIVING SHIT OUT OF YOU, DAMN RECKLESS HUMAN!!!!"; $lulzs[] = "Th3 ç@k3 ¡§ @ L¡3"; $msg = "\r\n"; socket_write($msgsock, $msg, strlen($msg)); foreach($lulzs as $string) { $lolchar = preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY); foreach($lolchar as $char) { socket_write($msgsock, $char, strlen($char)); usleep(100000); } sleep(1); $cr = "\r\n"; socket_write($msgsock, $cr, strlen($cr)); } break 2; } //$talkback = "PHP: You said '$buf'.\n"; //socket_write($msgsock, $talkback, strlen($talkback)); echo "$buf\n"; } while (true); socket_close($msgsock); } while (true); socket_close($sock); ?>