All pastes #748571 Raw Edit

bot

public text v1 · immutable
#748571 ·published 2007-10-24 22:21 UTC
rendered paste body
#!/usr/bin/perl

####################################################################################################
#Ircbot - by Preddy
#Commands: 
#
#!bitch (info about the owner of the bot)
#!crack (to lookup an md5 hash and get the plain text format of it..(4 website's))
#!md5gen (to generate an md5 hash)
#!quote (to view a quote from a list of famous computer quotes)
#!changenick (to change the bot's name to a random name from the list..)
#!inject (to inject the user with an injectable object eg: a toothbrush)
#!proxy (to get a list of proxies from nntime.com)
#!advisories (to get a list of advisories from secunia.com)
#!exploits (to get a list of exploits from milw0rm.com)
#!securitynews (to get the latest securitynews from addict3d.org)
#!technews (to get the latest technews from addict3d.org)
#!gewgle (search for something at google)
#
#Other Features:
#
#Bot greets with: Good morning sir... (if string: morning is detected)
#Bot auto-rejoins after a kick with a newly changed name
#Bot replies to PING requests from the server
####################################################################################################

use IO::Socket;
use Switch;
use Digest::MD5 qw(md5_hex);

$server = '209.9.226.188';
$port = '6667';
$user = 'P01 P02 P03 :P___';
$nick = 'P01';
$chan = '#testing';
$logfile = 'irc-log.txt';
$owner = '|Preddy|';


$con = IO::Socket::INET->new(PeerAddr=>$server,
                             PeerPort=>$port,
                             Proto=>'tcp',
                             Timeout=>'30') || print "Error: Connection\n";

print $con "USER $user\r\n";
print $con "NICK $nick\r\n";
print $con "JOIN $chan\r\n";

while($answer = <$con>)
{



open(LOG,">>$logfile");
print LOG "$answer";
close(LOG);

#who's yo daddy?
if($answer =~ m/\!bitch/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

print $con "privmsg $xchannel :I am tha bitch of $owner..\n";

}
}

if($answer =~ m/\!gewgle/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

@words = split(" ",$xtext);

$word = $words[1];

$getres = IO::Socket::INET->new(PeerAddr=>'64.233.183.104',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";

print $getres "GET /search?num=1&hl=en&lr=lang_en&q=$word&btnG=Search HTTP/1.0\n";
print $getres "Host: www.google.com\n\n";

print $con "privmsg $xchannel :Word: $word\n";

while($res = <$getres>)
{
$res =~ m/<a class=l href="(.*?)">/ && print $con "privmsg $xchannel :Result : $1\n";

}
}
}

if($answer =~ m/\!crack/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

@parts = split(" ",$xtext);

$hash = $parts[1];

$gethash = IO::Socket::INET->new(PeerAddr=>'80.190.251.212',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";

print $gethash "GET /?q=$hash&b=MD5-Search HTTP/1.0\n";
print $gethash "Host: md5.rednoize.com\n\n";

$gethash2 = IO::Socket::INET->new(PeerAddr=>'203.118.181.177',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";
print $gethash2 "GET /find?md5=$hash HTTP/1.0\n";
print $gethash2 "Host: nz.md5.crysm.net\n\n";

$gethash3 = IO::Socket::INET->new(PeerAddr=>'67.18.64.178',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";
print $gethash3 "GET /find?md5=$hash HTTP/1.0\n";
print $gethash3 "Host: us.md5.crysm.net\n\n";

$gethash4 = IO::Socket::INET->new(PeerAddr=>'67.15.126.34',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";
print $gethash4 "POST / HTTP/1.1\n";

print $gethash4 "Host: www.md5decrypt.com\n";

print $gethash4 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5\n";

print $gethash4 "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\n";

print $gethash4 "Accept-Language: en-us,en;q=0.5\n";

print $gethash4 "Accept-Encoding: gzip,deflate\n";

print $gethash4 "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\n";

print $gethash4 "Keep-Alive: 300\n";

print $gethash4 "Connection: keep-alive\n";

print $gethash4 "Referer: http://www.md5decrypt.com/\n";

print $gethash4 "Content-Type: application/x-www-form-urlencoded\n";

print $gethash4 "Content-Length: 43\n";
print $gethash4 "\n";
print $gethash4 "h=$hash&s=Search\n";


print $con "privmsg $xchannel :Hash: $hash\n";

while($ghash = <$gethash>)
{
$ghash =~ m/<h3>(.*?)&nbsp/ && print $con "privmsg $xchannel :md5.rednoize.com : $1\n";

}

while($ghash2 = <$gethash2>)
{
$ghash2 =~ m/<li>(.*?)<\/li>/ && print $con "privmsg $xchannel :nz.md5.crysm.net : $1\n";
}

while($ghash3 = <$gethash3>)
{
$ghash3 =~ m/<li>(.*?)<\/li>/ && print $con "privmsg $xchannel :us.md5.crysm.net : $1\n";
}

while($ghash4 = <$gethash4>)
{
$ghash4 =~ m/<br \/><b>(.*?)<\/b>/ && print $con "privmsg $xchannel :md5decrypt.com : $1\n";
}

}
}

#generate an md5 hash..
if($answer =~ m/\!md5gen/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

@strpart = split(" ",$xtext);

$str = $strpart[1];

$md5hash = md5_hex($str);

print $con "privmsg $xchannel :String : $str\n";
print $con "privmsg $xchannel :Result : $md5hash\n";

}
}

if($answer =~ m/\!quote/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;


$ran = int(rand(42));

switch($ran){

case 0 { print $con "privmsg $xchannel : I do not fear computers. I fear the lack of them. - Isaac Asimov -\n"}
case 1 { print $con "privmsg $xchannel : Computer science is no more about computers than astronomy is about telescopes. - Edsger Dijkstra -\n"}
case 2 { print $con "privmsg $xchannel : The computer is a moron. - Peter Drucker -\n"}
case 3 { print $con "privmsg $xchannel : Computers are so badly designed! - Brian Eno -\n"}
case 4 { print $con "privmsg $xchannel : Computers are magnificent tools for the realization of our dreams, but no machine can replace the human spark of spirit, compassion, love, and understanding. - Louis Gerstner -\n"}
case 5 { print $con "privmsg $xchannel : The real danger is not that computers will begin to think like men, but that men will begin to think like computers. - Sydney J. Harris -\n"}
case 6 { print $con "privmsg $xchannel : Supercomputers will achieve one human brain capacity by 2010, and personal computers will do so by about 2020. - Ray Kurzweil -\n"}
case 7 { print $con "privmsg $xchannel : Home computers are being called upon to perform many new functions, including the consumption of homework formerly eaten by the dog. - Doug Larson -\n"}
case 8 { print $con "privmsg $xchannel : What do we want our kids to do? Sweep up around Japanese computers? - Walter F. Mondale -\n"}
case 9 { print $con "privmsg $xchannel : Computing is not about computers any more. It is about living. - Nicholas Negroponte -\n"}
case 10 { print $con "privmsg $xchannel : The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. - Ted Nelson -\n"}
case 11 { print $con "privmsg $xchannel : To err is human - and to blame it on a computer is even more so. - Robert Orben -\n"}
case 12 { print $con "privmsg $xchannel : People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster. - Adam Osborne -\n"}
case 13 { print $con "privmsg $xchannel : They have computers, and they may have other weapons of mass destruction. - Janet Reno -\n"}
case 14 { print $con "privmsg $xchannel : Computers are useless. They can only give you answers. - Pablo Picasso -\n"}
case 15 { print $con "privmsg $xchannel : Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done. - Andy Rooney -\n"}
case 16 { print $con "privmsg $xchannel : Think? Why think! We have computers to do that for us. - Jean Rostand -\n"}
case 17 { print $con "privmsg $xchannel : Treat your password like your toothbrush. Don't let anybody else use it, and get a new one every six months. - Clifford Stoll -\n"}
case 18 { print $con "privmsg $xchannel : Users, collective term for those who use computers. Users are divided into three types: novice, intermediate and expert.Novice Users: people who are afraid that simply pressing a key might break their computer.
Intermediate Users: people who don't know how to fix their computer after they've just pressed a key that broke it.
Expert Users: people who break other people's computers. - From the Jargon File. -\n"}
case 19 { print $con "privmsg $xchannel : Artificial intelligence ? No thank you, I don't need crutches. - Szylowicz (my former assembler teacher) -\n"}
case 20 { print $con "privmsg $xchannel : Science is supposedly the method by which we stand on the shoulders of those who came before us. In computer science, we all are standing on each others feet. - G. Popek. -\n"}
case 21 { print $con "privmsg $xchannel : Press CTRL-ALT-DEL now for an IQ test. - At the time of Win95/98/ME -\n"}
case 22 { print $con "privmsg $xchannel : Artificial Intelligence usually beats natural stupidity.\n"}
case 23 { print $con "privmsg $xchannel : This manual says what our product actually does, no matter what the salesman may have told you it does. - In a californian graphic board manual, 1985. -\n"}
case 24 { print $con "privmsg $xchannel : I sit looking at this damn computer screen all day long, day in and day out, week after week, and think: Man, if I could just find the 'on' switch... - Zachary Good -\n"}
case 25 { print $con "privmsg $xchannel : Build a system that even a fool can use, and only a fool will want to use it\n"}
case 26 { print $con "privmsg $xchannel : Making fun of AOL users is like making fun of the kid in the wheel chair.\n"}
case 27 { print $con "privmsg $xchannel : Dude, I hate to be the bearer of bad news, but I'm afraid you've been hacked — the FTP server at 127.0.0.1 has all your personal files. See for yourself; just log in with your normal id.... - Classic joke on new Unix users. -\n"}
case 28 { print $con "privmsg $xchannel : Relax, its only ONES and ZEROS !\n"}
case 29 { print $con "privmsg $xchannel : I have NOT lost my mind — I have it backed up on tape somewhere.\n"}
case 30 { print $con "privmsg $xchannel : INSERT DISK THREE' ? But I can only get two in the drive !\n"}
case 31 { print $con "privmsg $xchannel : Daddy, why doesn't this magnet pick up this floppy disk ?\n"}
case 32 { print $con "privmsg $xchannel : Daddy, what does FORMATTING DRIVE C mean ?\n"}
case 33 { print $con "privmsg $xchannel : See daddy ? All the keys are in alphabetical order now.\n"}
case 34 { print $con "privmsg $xchannel : Q- What is the difference between a computer and a woman ?
A- A woman won't accept a 3 and 1/2-inch floppy !\n"}
case 35 { print $con "privmsg $xchannel : When I was a teenager, Mom said I'd go blind if I didn't quit doing *that*. Maybe she was right — since the invention of internet porn, computer monitors keep getting bigger and bigger. ! - Bill Ervin. -\n"}
case 36 { print $con "privmsg $xchannel : Smash forehead on keyboard to continue...\n"}
case 37 { print $con "privmsg $xchannel : Where a calculator on the ENIAC is equipped with 18 000 vacuum tubes and weighs 30 tons, computers of the future may have only 1 000 vacuum tubes and perhaps weigh 1? tons. - Popular Mechanics, March 1949. -\n"}
case 38 { print $con "privmsg $xchannel : But what... is it good for ? - An engineer at the Advanced Computing Systems Division of IBM, commenting on the microchip in 1968. -\n"}
case 39 { print $con "privmsg $xchannel : There is no reason anyone would want a computer in their home. - Ken Olson, president/founder of Digital Equipment Corp., 1977. -\n"}
case 40 { print $con "privmsg $xchannel : There's no problem so large it can't be solved by killing the user off, deleting their files, closing their account and reporting their REAL earnings to the IRS. - The B.O.F.H.. - \n"}
case 41 { print $con "privmsg $xchannel : In the future, airplanes will be flown by a dog and a pilot. And the dog's job will be to make sure that if the pilot tries to touch any of the buttons, the dog bites him. - Scott Adams (author of Dilbert). -\n"}
else{ print $ran}

}

}
}

if($answer =~ m/\morning/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

print $con "privmsg $xchannel :good morning sir..\n";

}
}



if($answer =~ m/\!changenick/)
{

my @array = qw/fish2fish akira alazreal alexander andy andycapp anxieties anxiety bailey batman bd beetle beetlebailey billcat billthecat binkley blondie bloom bloomcounty brown capp catwoman caucas cerebus charlie charliebrown clint commissioner cookie county cutter cutterjohn dagwood darkknight darknight davis dopey duke feivel fievel flamingcarrot fritz fritzthecat garfield gepetto greenarrow greenlantern
grinch grumpy hulk iest jaka jdavis jimdavis jiminy jiminycricket joanie joaniecaucas john joker julius kal-el kalel linus liz lucy lyman
marvin melblanc mike milo mousekevitz mousekewitz mouskevitz mouskewitz mscaucas nermal nimh odie oliver onefishtwofish opus ororo outland palnu papa papagepetteo peanuts penguin peterpan pigpen pinhead pinnocchio pinnoccio pinocchio pinoccio pinochio popus riddler robin roz rumpelstiltzkin rumplestiltzkin sally sarge schroder schroeder scrooge shoe smurf sneezey sneezy snoopy snowhite snowwhite spiderman spike superman thething tinkerbell tinkerbelle twoface vanpelt watershipdown wolverine wolveroach woodstock xmen ziggy zippy zonker
/; 
my $draw = @array[rand @array]; 
print $con "NICK $draw\r\n";
}

#give sexual pleassure
if($answer =~ m/\!inject/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;


$ran = int(rand(12));

switch($ran){

case 0 { print $con "privmsg $xchannel : injected $name with an MS keyboard.....\n"}
case 1 { print $con "privmsg $xchannel : injected $name with http://img91.imageshack.us/img91/2033/03zd9.jpg\n"}
case 2 { print $con "privmsg $xchannel : injected $name with http://img135.imageshack.us/img135/6393/02ms6.jpg\n"}
case 3 { print $con "privmsg $xchannel : injected $name with a NASA space-shuttle.....\n"}
case 4 { print $con "privmsg $xchannel : injected $name with http://img91.imageshack.us/img91/6918/lewllq5.jpg\n"}
case 5 { print $con "privmsg $xchannel : injected $name with a toothbrush.....\n"}
case 6 { print $con "privmsg $xchannel : injected $name with a pen.....\n"}
case 7 { print $con "privmsg $xchannel : injected $name with http://www.servut.us/ssakari/kuvat/two_girls_kissing.jpg\n"}
case 8 { print $con "privmsg $xchannel : injected $name with http://la.gg/upl/6541c6b7.gif\n"}
case 9 { print $con "privmsg $xchannel : injected $name with a chair.....\n"}
case 10 { print $con "privmsg $xchannel : injected $name with a midget.....\n"}
case 11 { print $con "privmsg $xchannel : injected $name with a spoon.....\n"}
case 12 { print $con "privmsg $xchannel : injected $name with a fork.....\n"}

else{ print $ran}

}

}
}

#get proxies from nntime.com
if($answer =~ m/\!proxy/)
{

if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;



$getproxy = IO::Socket::INET->new(PeerAddr=>'66.29.36.40',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";

print $getproxy "GET /index.php HTTP/1.0\n";
print $getproxy "Host: www.nntime.com\n\n";

while($proxy = <$getproxy>)
{
$proxy =~ m/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?):([0-9][0-9][0-9][0-9])/ && print $con "privmsg $xnick :$1.$2.$3.$4:$5\n";


}
}
}



#auto rejoin after kick
if($answer =~ m/KICK $chan/)
{

my @array = qw/fish2fish akira alazreal alexander andy andycapp anxieties anxiety bailey batman bd beetle beetlebailey billcat billthecat binkley blondie bloom bloomcounty brown capp catwoman caucas cerebus charlie charliebrown clint commissioner cookie county cutter cutterjohn dagwood darkknight darknight davis dopey duke feivel fievel flamingcarrot fritz fritzthecat garfield gepetto greenarrow greenlantern
grinch grumpy hulk iest jaka jdavis jimdavis jiminy jiminycricket joanie joaniecaucas john joker julius kal-el kalel linus liz lucy lyman
marvin melblanc mike milo mousekevitz mousekewitz mouskevitz mouskewitz mscaucas nermal nimh odie oliver onefishtwofish opus ororo outland palnu papa papagepetteo peanuts penguin peterpan pigpen pinhead pinnocchio pinnoccio pinocchio pinoccio pinochio popus riddler robin roz rumpelstiltzkin rumplestiltzkin sally sarge schroder schroeder scrooge shoe smurf sneezey sneezy snoopy snowhite snowwhite spiderman spike superman thething tinkerbell tinkerbelle twoface vanpelt watershipdown wolverine wolveroach woodstock xmen ziggy zippy zonker
/; 
my $draw = @array[rand @array]; 


print $con "NICK $draw\r\n";
print $con "JOIN $chan\r\n";
}

#get advisory news from secunia.com
if($answer =~ m/\!advisories/)
{

if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

$getadv = IO::Socket::INET->new(PeerAddr=>'213.150.41.226',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";

print $getadv "GET /information_partner/anonymous/o.rss HTTP/1.0\n";
print $getadv "Host: secunia.com\n\n";

while($adv = <$getadv>)
{
$adv =~ m/CDATA(.*?)><\/title>/ && print $con "privmsg $xnick :$1$2$3\n";

$adv =~ m/<link>(.*?)<\/link>/ && print $con "privmsg $xnick :$1$2$3\n";
}
}
}

#securitynews from addict3d.org
if($answer =~ m/\!securitynews/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

$gen = IO::Socket::INET->new(PeerAddr=>'84.95.245.150',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";

print $getsecn "GET /backend_security.php HTTP/1.0\n";
print $getsecn "Host: addict3d.org\n\n";

while($secn = <$getsecn>)
{
$secn =~ m/<title>(.*?)<\/title>/ && print $con "privmsg $xnick :$1$2$3\n";

$secn =~ m/<link>(.*?)<\/link>/ && print $con "privmsg $xnick :$1$2$3\n";
}
}
}

if($answer =~ m/\!technews/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

$gettechn = IO::Socket::INET->new(PeerAddr=>'84.95.245.150',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";

print $gettechn "GET /backend_news.php HTTP/1.0\n";
print $gettechn "Host: addict3d.org\n\n";

while($techn = <$gettechn>)
{
$techn =~ m/<title>(.*?)<\/title>/ && print $con "privmsg $xnick :$1$2$3\n";

$techn =~ m/<link>(.*?)<\/link>/ && print $con "privmsg $xnick :$1$2$3\n";
}
}
}


#get exploit news from milw0rm.com
if($answer =~ m/\!exploits/)
{

if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

$getexp = IO::Socket::INET->new(PeerAddr=>'213.150.45.196',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";

print $getexp "GET /rss.php HTTP/1.0\n";
print $getexp "Host: www.milw0rm.com\n\n";

while($exp = <$getexp>)
{
$exp =~ m/<title>(.*?)<\/title>/ && print $con "privmsg $xnick :$1$2$3\n";

$exp =~ m/<guid>(.*?)<\/guid>/ && print $con "privmsg $xnick :$1$2$3\n";

}
}
}

#answer to ping requests
if($answer =~ m/^PING (.*?)$/gi)
{

print $con "PONG ".$1."\n";

}

print $answer;


}

--------------------------------------------------------------------------------------------

Update: thisone allows the botowner to execute commands and kill the bot.
#!/usr/bin/perl

####################################################################################################
#Ircbot - by Preddy
#Commands: 
#
#!bitch (info about the owner of the bot)
#!crack (to lookup an md5 hash and get the plain text format of it..(4 website's))
#!md5gen (to generate an md5 hash)
#!quote (to view a quote from a list of famous computer quotes)
#!changenick (to change the bot's name to a random name from the list..)
#!inject (to inject the user with an injectable object eg: a toothbrush)
#!proxy (to get a list of proxies from nntime.com)
#!advisories (to get a list of advisories from secunia.com)
#!exploits (to get a list of exploits from milw0rm.com)
#!securitynews (to get the latest securitynews from addict3d.org)
#!technews (to get the latest technews from addict3d.org)
#!gewgle (search for something at google)
#!exec (executes a command,requires the owners password.. usage: !exec <pass> <command>)
#!suicide (kill the bot..usage: !suicide <pass>
#
#Other Features:
#
#Bot greets with: Good morning sir... (if string: morning is detected)
#Bot auto-rejoins after a kick with a newly changed name
#Bot replies to PING requests from the server
####################################################################################################

use IO::Socket;
use Switch;
use Digest::MD5 qw(md5_hex);

$server = 'ABS.lcirc.net';
$port = '6667';
$user = 'P02 P03 P04 :P___';
$nick = 'P02';
$chan = '#milw0rm';
$logfile = 'irc-log.txt';
$owner = '|Preddy|';
$pass = '01e49cacc09c8f1aee35b8f1f38f3e60'; #preddybot123


$con = IO::Socket::INET->new(PeerAddr=>$server,
                             PeerPort=>$port,
                             Proto=>'tcp',
                             Timeout=>'30') || print "Error: Connection\n";

print $con "USER $user\r\n";
print $con "NICK $nick\r\n";
print $con "JOIN $chan\r\n";

while($answer = <$con>)
{



open(LOG,">>$logfile");
print LOG "$answer";
close(LOG);


#who's yo daddy?
if($answer =~ m/\!bitch/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

print $con "privmsg $xchannel :I am tha bitch of $owner..\n";

}
}

if($answer =~ m/\!suicide/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

@strpart = split(" ",$xtext);

$p = $strpart[1];

$encpw = md5_hex($p);

if($encpw == $pass)
{

exit;

}
}
}



if($answer =~ m/\!exec/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

@strpart = split(" ",$xtext);

$p = $strpart[1];

$encpw = md5_hex($p);

if($encpw == $pass)
{
$cmd = "$strpart[2] $strpart[3] $strpart[4] $strpart[5] $strpart[6] $strpart[7] $strpart[8] $strpart[9] $strpart[10] $strpart[11] $strpart[12] $strpart[13] $strpart[14] $strpart[15] $strpart[16] $strpart[17] $strpart[18] $strpart[19] $strpart[20] $strpart[21] $strpart[22] $strpart[23] $strpart[24] $strpart[25]";
@output = qx($cmd);
foreach $command (@output)
{
print $con "privmsg $xnick :$command\n";
}

}
}
}

if($answer =~ m/\!gewgle/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

@words = split(" ",$xtext);

$word = $words[1];

$getres = IO::Socket::INET->new(PeerAddr=>'64.233.183.104',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";

print $getres "GET /search?num=1&hl=en&lr=lang_en&q=$word&btnG=Search HTTP/1.0\n";
print $getres "Host: www.google.com\n\n";

print $con "privmsg $xchannel :Word: $word\n";

while($res = <$getres>)
{
$res =~ m/<a class=l href="(.*?)">/ && print $con "privmsg $xchannel :Result : $1\n";

}
}
}

if($answer =~ m/\!crack/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

@parts = split(" ",$xtext);

$hash = $parts[1];

$gethash = IO::Socket::INET->new(PeerAddr=>'80.190.251.212',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";

print $gethash "GET /?q=$hash&b=MD5-Search HTTP/1.0\n";
print $gethash "Host: md5.rednoize.com\n\n";

$gethash3 = IO::Socket::INET->new(PeerAddr=>'67.18.64.178',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";
print $gethash3 "GET /find?md5=$hash HTTP/1.0\n";
print $gethash3 "Host: us.md5.crysm.net\n\n";

$gethash4 = IO::Socket::INET->new(PeerAddr=>'67.15.126.34',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";
print $gethash4 "POST / HTTP/1.1\n";
print $gethash4 "Host: www.md5decrypt.com\n";
print $gethash4 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5\n";
print $gethash4 "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\n";
print $gethash4 "Accept-Language: en-us,en;q=0.5\n";
print $gethash4 "Accept-Encoding: gzip,deflate\n";
print $gethash4 "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\n";
print $gethash4 "Keep-Alive: 300\n";
print $gethash4 "Connection: keep-alive\n";
print $gethash4 "Referer: http://www.md5decrypt.com/\n";
print $gethash4 "Content-Type: application/x-www-form-urlencoded\n";
print $gethash4 "Content-Length: 43\n";
print $gethash4 "\n";
print $gethash4 "h=$hash&s=Search\n";


print $con "privmsg $xchannel :Hash: $hash\n";

while($ghash = <$gethash>)
{
$ghash =~ m/<h3>(.*?)&nbsp/ && print $con "privmsg $xchannel :md5.rednoize.com : $1\n";

}

while($ghash3 = <$gethash3>)
{
$ghash3 =~ m/<li>(.*?)<\/li>/ && print $con "privmsg $xchannel :us.md5.crysm.net : $1\n";
}

while($ghash4 = <$gethash4>)
{
$ghash4 =~ m/<br \/><b>(.*?)<\/b>/ && print $con "privmsg $xchannel :md5decrypt.com : $1\n";
}

}
}

#generate an md5 hash..
if($answer =~ m/\!md5gen/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

@strpart = split(" ",$xtext);

$str = $strpart[1];

$md5hash = md5_hex($str);

print $con "privmsg $xchannel :String : $str\n";
print $con "privmsg $xchannel :Result : $md5hash\n";

}
}

if($answer =~ m/\!quote/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;


$ran = int(rand(44));

switch($ran){

case 0 { print $con "privmsg $xchannel : I do not fear computers. I fear the lack of them. - Isaac Asimov -\n"}
case 1 { print $con "privmsg $xchannel : Computer science is no more about computers than astronomy is about telescopes. - Edsger Dijkstra -\n"}
case 2 { print $con "privmsg $xchannel : The computer is a moron. - Peter Drucker -\n"}
case 3 { print $con "privmsg $xchannel : Computers are so badly designed! - Brian Eno -\n"}
case 4 { print $con "privmsg $xchannel : Computers are magnificent tools for the realization of our dreams, but no machine can replace the human spark of spirit, compassion, love, and understanding. - Louis Gerstner -\n"}
case 5 { print $con "privmsg $xchannel : The real danger is not that computers will begin to think like men, but that men will begin to think like computers. - Sydney J. Harris -\n"}
case 6 { print $con "privmsg $xchannel : Supercomputers will achieve one human brain capacity by 2010, and personal computers will do so by about 2020. - Ray Kurzweil -\n"}
case 7 { print $con "privmsg $xchannel : Home computers are being called upon to perform many new functions, including the consumption of homework formerly eaten by the dog. - Doug Larson -\n"}
case 8 { print $con "privmsg $xchannel : What do we want our kids to do? Sweep up around Japanese computers? - Walter F. Mondale -\n"}
case 9 { print $con "privmsg $xchannel : Computing is not about computers any more. It is about living. - Nicholas Negroponte -\n"}
case 10 { print $con "privmsg $xchannel : The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. - Ted Nelson -\n"}
case 11 { print $con "privmsg $xchannel : To err is human - and to blame it on a computer is even more so. - Robert Orben -\n"}
case 12 { print $con "privmsg $xchannel : People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster. - Adam Osborne -\n"}
case 13 { print $con "privmsg $xchannel : They have computers, and they may have other weapons of mass destruction. - Janet Reno -\n"}
case 14 { print $con "privmsg $xchannel : Computers are useless. They can only give you answers. - Pablo Picasso -\n"}
case 15 { print $con "privmsg $xchannel : Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done. - Andy Rooney -\n"}
case 16 { print $con "privmsg $xchannel : Think? Why think! We have computers to do that for us. - Jean Rostand -\n"}
case 17 { print $con "privmsg $xchannel : Treat your password like your toothbrush. Don't let anybody else use it, and get a new one every six months. - Clifford Stoll -\n"}
case 18 { print $con "privmsg $xchannel : Users, collective term for those who use computers. Users are divided into three types: novice, intermediate and expert.Novice Users: people who are afraid that simply pressing a key might break their computer.
Intermediate Users: people who don't know how to fix their computer after they've just pressed a key that broke it.
Expert Users: people who break other people's computers. - From the Jargon File. -\n"}
case 19 { print $con "privmsg $xchannel : Artificial intelligence ? No thank you, I don't need crutches. - Szylowicz (my former assembler teacher) -\n"}
case 20 { print $con "privmsg $xchannel : Science is supposedly the method by which we stand on the shoulders of those who came before us. In computer science, we all are standing on each others feet. - G. Popek. -\n"}
case 21 { print $con "privmsg $xchannel : Press CTRL-ALT-DEL now for an IQ test. - At the time of Win95/98/ME -\n"}
case 22 { print $con "privmsg $xchannel : Artificial Intelligence usually beats natural stupidity.\n"}
case 23 { print $con "privmsg $xchannel : This manual says what our product actually does, no matter what the salesman may have told you it does. - In a californian graphic board manual, 1985. -\n"}
case 24 { print $con "privmsg $xchannel : I sit looking at this damn computer screen all day long, day in and day out, week after week, and think: Man, if I could just find the 'on' switch... - Zachary Good -\n"}
case 25 { print $con "privmsg $xchannel : Build a system that even a fool can use, and only a fool will want to use it\n"}
case 26 { print $con "privmsg $xchannel : Making fun of AOL users is like making fun of the kid in the wheel chair.\n"}
case 27 { print $con "privmsg $xchannel : Dude, I hate to be the bearer of bad news, but I'm afraid you've been hacked — the FTP server at 127.0.0.1 has all your personal files. See for yourself; just log in with your normal id.... - Classic joke on new Unix users. -\n"}
case 28 { print $con "privmsg $xchannel : Relax, its only ONES and ZEROS !\n"}
case 29 { print $con "privmsg $xchannel : I have NOT lost my mind — I have it backed up on tape somewhere.\n"}
case 30 { print $con "privmsg $xchannel : INSERT DISK THREE' ? But I can only get two in the drive !\n"}
case 31 { print $con "privmsg $xchannel : Daddy, why doesn't this magnet pick up this floppy disk ?\n"}
case 32 { print $con "privmsg $xchannel : Daddy, what does FORMATTING DRIVE C mean ?\n"}
case 33 { print $con "privmsg $xchannel : See daddy ? All the keys are in alphabetical order now.\n"}
case 34 { print $con "privmsg $xchannel : Q- What is the difference between a computer and a woman ?
A- A woman won't accept a 3 and 1/2-inch floppy !\n"}
case 35 { print $con "privmsg $xchannel : When I was a teenager, Mom said I'd go blind if I didn't quit doing *that*. Maybe she was right — since the invention of internet porn, computer monitors keep getting bigger and bigger. ! - Bill Ervin. -\n"}
case 36 { print $con "privmsg $xchannel : Smash forehead on keyboard to continue...\n"}
case 37 { print $con "privmsg $xchannel : Where a calculator on the ENIAC is equipped with 18 000 vacuum tubes and weighs 30 tons, computers of the future may have only 1 000 vacuum tubes and perhaps weigh 1? tons. - Popular Mechanics, March 1949. -\n"}
case 38 { print $con "privmsg $xchannel : But what... is it good for ? - An engineer at the Advanced Computing Systems Division of IBM, commenting on the microchip in 1968. -\n"}
case 39 { print $con "privmsg $xchannel : There is no reason anyone would want a computer in their home. - Ken Olson, president/founder of Digital Equipment Corp., 1977. -\n"}
case 40 { print $con "privmsg $xchannel : There's no problem so large it can't be solved by killing the user off, deleting their files, closing their account and reporting their REAL earnings to the IRS. - The B.O.F.H.. - \n"}
case 41 { print $con "privmsg $xchannel : In the future, airplanes will be flown by a dog and a pilot. And the dog's job will be to make sure that if the pilot tries to touch any of the buttons, the dog bites him. - Scott Adams (author of Dilbert). -\n"}
case 42 { print $con "privmsg $xchannel : go shave ya mommy XD - Dj_Asim - milw0rm forums 2006 - http://forum.milw0rm.com/viewtopic.php?t=1595\n"}
else{ print $ran}

}

}
}

if($answer =~ m/\morning/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

print $con "privmsg $xchannel :good morning sir..\n";

}
}



if($answer =~ m/\!changenick/)
{

my @array = qw/fish2fish akira alazreal alexander andy andycapp anxieties anxiety bailey batman bd beetle beetlebailey billcat billthecat binkley blondie bloom bloomcounty brown capp catwoman caucas cerebus charlie charliebrown clint commissioner cookie county cutter cutterjohn dagwood darkknight darknight davis dopey duke feivel fievel flamingcarrot fritz fritzthecat garfield gepetto greenarrow greenlantern
grinch grumpy hulk iest jaka jdavis jimdavis jiminy jiminycricket joanie joaniecaucas john joker julius kal-el kalel linus liz lucy lyman
marvin melblanc mike milo mousekevitz mousekewitz mouskevitz mouskewitz mscaucas nermal nimh odie oliver onefishtwofish opus ororo outland palnu papa papagepetteo peanuts penguin peterpan pigpen pinhead pinnocchio pinnoccio pinocchio pinoccio pinochio popus riddler robin roz rumpelstiltzkin rumplestiltzkin sally sarge schroder schroeder scrooge shoe smurf sneezey sneezy snoopy snowhite snowwhite spiderman spike superman thething tinkerbell tinkerbelle twoface vanpelt watershipdown wolverine wolveroach woodstock xmen ziggy zippy zonker
/; 
my $draw = @array[rand @array]; 
print $con "NICK $draw\r\n";
}

#give sexual pleassure
if($answer =~ m/\!inject/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;


$ran = int(rand(12));

switch($ran){

case 0 { print $con "privmsg $xchannel : injected $name with an MS keyboard.....\n"}
case 1 { print $con "privmsg $xchannel : injected $name with http://img91.imageshack.us/img91/2033/03zd9.jpg\n"}
case 2 { print $con "privmsg $xchannel : injected $name with http://img135.imageshack.us/img135/6393/02ms6.jpg\n"}
case 3 { print $con "privmsg $xchannel : injected $name with a NASA space-shuttle.....\n"}
case 4 { print $con "privmsg $xchannel : injected $name with http://img91.imageshack.us/img91/6918/lewllq5.jpg\n"}
case 5 { print $con "privmsg $xchannel : injected $name with a toothbrush.....\n"}
case 6 { print $con "privmsg $xchannel : injected $name with a pen.....\n"}
case 7 { print $con "privmsg $xchannel : injected $name with http://www.servut.us/ssakari/kuvat/two_girls_kissing.jpg\n"}
case 8 { print $con "privmsg $xchannel : injected $name with http://la.gg/upl/6541c6b7.gif\n"}
case 9 { print $con "privmsg $xchannel : injected $name with a chair.....\n"}
case 10 { print $con "privmsg $xchannel : injected $name with a midget.....\n"}
case 11 { print $con "privmsg $xchannel : injected $name with a spoon.....\n"}
case 12 { print $con "privmsg $xchannel : injected $name with a fork.....\n"}

else{ print $ran}

}

}
}

#get proxies from nntime.com
if($answer =~ m/\!proxy/)
{

if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;



$getproxy = IO::Socket::INET->new(PeerAddr=>'66.29.36.40',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";

print $getproxy "GET /index.php HTTP/1.0\n";
print $getproxy "Host: www.nntime.com\n\n";

while($proxy = <$getproxy>)
{
$proxy =~ m/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?):([0-9][0-9][0-9][0-9])/ && print $con "privmsg $xnick :$1.$2.$3.$4:$5\n";


}
}
}



#auto rejoin after kick
if($answer =~ m/KICK $chan/)
{

my @array = qw/fish2fish akira alazreal alexander andy andycapp anxieties anxiety bailey batman bd beetle beetlebailey billcat billthecat binkley blondie bloom bloomcounty brown capp catwoman caucas cerebus charlie charliebrown clint commissioner cookie county cutter cutterjohn dagwood darkknight darknight davis dopey duke feivel fievel flamingcarrot fritz fritzthecat garfield gepetto greenarrow greenlantern
grinch grumpy hulk iest jaka jdavis jimdavis jiminy jiminycricket joanie joaniecaucas john joker julius kal-el kalel linus liz lucy lyman
marvin melblanc mike milo mousekevitz mousekewitz mouskevitz mouskewitz mscaucas nermal nimh odie oliver onefishtwofish opus ororo outland palnu papa papagepetteo peanuts penguin peterpan pigpen pinhead pinnocchio pinnoccio pinocchio pinoccio pinochio popus riddler robin roz rumpelstiltzkin rumplestiltzkin sally sarge schroder schroeder scrooge shoe smurf sneezey sneezy snoopy snowhite snowwhite spiderman spike superman thething tinkerbell tinkerbelle twoface vanpelt watershipdown wolverine wolveroach woodstock xmen ziggy zippy zonker
/; 
my $draw = @array[rand @array]; 


print $con "NICK $draw\r\n";
print $con "JOIN $chan\r\n";
}

#get advisory news from secunia.com
if($answer =~ m/\!advisories/)
{

if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

$getadv = IO::Socket::INET->new(PeerAddr=>'213.150.41.226',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";

print $getadv "GET /information_partner/anonymous/o.rss HTTP/1.0\n";
print $getadv "Host: secunia.com\n\n";

while($adv = <$getadv>)
{
$adv =~ m/CDATA(.*?)><\/title>/ && print $con "privmsg $xnick :$1$2$3\n";

$adv =~ m/<link>(.*?)<\/link>/ && print $con "privmsg $xnick :$1$2$3\n";
}
}
}

#securitynews from addict3d.org
if($answer =~ m/\!securitynews/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

$gen = IO::Socket::INET->new(PeerAddr=>'84.95.245.150',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";

print $getsecn "GET /backend_security.php HTTP/1.0\n";
print $getsecn "Host: addict3d.org\n\n";

while($secn = <$getsecn>)
{
$secn =~ m/<title>(.*?)<\/title>/ && print $con "privmsg $xnick :$1$2$3\n";

$secn =~ m/<link>(.*?)<\/link>/ && print $con "privmsg $xnick :$1$2$3\n";
}
}
}

if($answer =~ m/\!technews/)
{
if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

$gettechn = IO::Socket::INET->new(PeerAddr=>'84.95.245.150',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";

print $gettechn "GET /backend_news.php HTTP/1.0\n";
print $gettechn "Host: addict3d.org\n\n";

while($techn = <$gettechn>)
{
$techn =~ m/<title>(.*?)<\/title>/ && print $con "privmsg $xnick :$1$2$3\n";

$techn =~ m/<link>(.*?)<\/link>/ && print $con "privmsg $xnick :$1$2$3\n";
}
}
}


#get exploit news from milw0rm.com
if($answer =~ m/\!exploits/)
{

if($answer =~ m/^\:(.*?)\!(.*?)\@(.*?) PRIVMSG (.*?) :(.*?)$/)
{
$xnick = $1;
$xident = $2;
$xhost = $3;
$xchannel = $4;
$xtext = $5;

$getexp = IO::Socket::INET->new(PeerAddr=>'213.150.45.196',PeerPort=>'80',Proto=>'tcp',Timeout=>'1') || print "Error: Connection\n";

print $getexp "GET /rss.php HTTP/1.0\n";
print $getexp "Host: www.milw0rm.com\n\n";

while($exp = <$getexp>)
{
$exp =~ m/<title>(.*?)<\/title>/ && print $con "privmsg $xnick :$1$2$3\n";

$exp =~ m/<guid>(.*?)<\/guid>/ && print $con "privmsg $xnick :$1$2$3\n";

}
}
}

#answer to ping requests
if($answer =~ m/^PING (.*?)$/gi)
{

print $con "PONG ".$1."\n";

}

print $answer;


}