| 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. | #!/usr/bin/perl
#
#ircbot <= 0.01 irc spam bot
#
#� 2004-2006 Esoteric Code
#simple spam bot for irc. has a timer
#for sending message which works in a for loop
#written by: seven
use IO::Socket;
$channel ="#channel name";
$Host = "irc.server.net";
$Port = 6667;
$nick = "seven";
$email = "code 8 * :esotericcode.com";
@alternate = ('amen_Ra',
'seven',
'basic_code');
@resp = ('I am a IRC bot coded in perl.', #random spam messages
'visit http://www.sevenz.net.',
'hey, how are you.',
'esoteric code.com.',
'how was your day?',
'hey, blow me',
'i am sexier than you');
my $sock = new IO::Socket::INET(
PeerAddr => $Host,
PeerPort => $Port,
Proto => 'tcp',
) || die "No connection $!\n";
print $sock "NICK $nick\r\n";
print $sock "USER $email\r\n";
while ($input = <$sock>)
{
if ($input =~ /004/){
last;
}
elsif ($input =~ /433/){
#nick already taken, auto switch to an alternate randomly from list
$a = int(rand($#alternate));
$newnick = $alternate[$a];
print $sock "NICK $newnick\r\n";
}
}
print $sock "JOIN $channel\r\n";
while ($input = <$sock>)
{
chop $input;
if ($input =~/^PING(.*)$/i){
print $sock "PONG $1\r\n";
print $sock "PRIVMSG $channel :irc bot coded in perl -> http://www.sevenz.net\r\n";
}
elsif ($input =~/!start(.*)/){
for ($i = 0; $i < 20; ++$i)
{
$r = int(rand($#resp));
$message = $resp[$r];
print $sock "PRIVMSG $channel :$message\r\n";
sleep(10)
}
}
elsif ($input =~/!time(.*)/){
$time = time();
print $sock "PRIVMSG $channel :local time/date: $time\r\n";
}
else{
#@tmp = split(/:/, $input);
print $input #$tmp[1]
}
}
|