rendered paste body#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket::INET;
my %irc = (server => 'irc.milw0rm.com',
port => 6667,
nickname => 'blehblah',
username => 'ftpbot ftpbot ftbot ftpbot', # Yes it has to be four times
channel => '#test',
nickserv => ''); # Nickserv password
# Mirc colors
my %colors = (white => "\x030",
red => "\x034",
green => "\x033",
gray => "\x0314",
yellow=> "\x038",
blue => "\x0312",
cyan => "\x0311",
orange=> "\x0307");
&main();
exit();
sub main {
#if (!fork) {
&irc_notify();
#}
} #end main()
sub irc_notify {
print "Starting IRC client\n";
my $con = IO::Socket::INET->new(PeerAddr=>$irc{'server'},
PeerPort=>$irc{'port'},
Proto=>'tcp',
Timeout=>'30') or die("Error: IRC handler cannot connect\n");
# Join Channel & Server
print $con "USER $irc{'username'}\r\n";
print $con "NICK $irc{'nickname'}\r\n";
sleep(5);
print $con "JOIN $irc{'channel'}\r\n";
if ($irc{'nickserv'}) {
print $con "privmsg nickserv IDENTIFY $irc{'nickserv'}\r\n";
}
while (my $answer = <$con>) {
if($answer =~ m/^PING \:(.*?)$/gi) {
print $con "PONG :".$1."\n";
}
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?)\sPRIVMSG\s(.*?) :(.*?)$/) {
my ($xnick, $xident, $xhost, $xchannel, $xtext) = ($1, $2, $3, $4, $5);
my @words = split(" ", $xtext);
if ($words[0] =~ m/^\!/) {
if($words[0] eq '!scan') { # scan for RFI
&scan($words[1]);
}
}
}
}
close $con;
sub scan() {
my $getres = IO::Socket::INET->new(PeerAddr=>'64.233.183.104',
PeerPort=>'80',
Proto=>'tcp',
Timeout=>'1') or print "Error: Connection\n";
print $getres "GET /search?num=1&hl=en&lr=lang_en&q=blah&btnG=Search HTTP/1.0\n";
print $getres "Host: www.google.com\n\n";
print $con "privmsg #test :Word: bleh\n";
my $result = <$getres>;
while($result =~ m/<a href="http:\/\/(.*?) class=l/g) {
# if($result =~ m/<a class=l href=\"?http:\/\/([^>\"]+)\"?>/g){
# if ($1 !~ m/google|cache|translate/) {
#
# }
#}
#print $con "privmsg #test :Result : $1\n";
print "$1\n";
}
}
}