/var/www/www.irssi.org-old/scripts/html/spambot.pl
1 # This script was originally written by Mike McDonald of
2 # FoxChat.Net for the X-Chat Client to be used by Opers
3 # to Kline/kill spam bots that message you or say in
4 # open channel -
5 # "Come watch me on my webcam and chat /w me :-) http://some.domain.com/me.mpg".
6 #
7 # This is my first script so I'm sure there is a more
8 # efficient way of doing this.
9 #
10 # --------[ Note ]-------------------------------------------------------------
11 # I symlink this to my ~/.irssi/scripts/autorun
12 # Just know that it will not work if you are not op'd.
13 #
14 #------------------------------------------------------------------------------
15
16 use Irssi;
17 use strict;
18 use vars qw($VERSION %IRSSI $SCRIPT_NAME);
19
20 %IRSSI = (
21 authors => 'Daemon @ ircd.foxchat.net',
22 name => 'Spam Bot Killer',
23 description => 'Oper script to kill Spam Bots.',
24 license => 'Public Domain'
25 );
26 ($VERSION) = '$Revision: 1.2 $' =~ / (\d+\.\d+) /;
27
28 $SCRIPT_NAME = 'Spam Bot Killer';
29
30 # ======[ Credits ]============================================================
31 #
32 # Thanks to:
33 #
34 # Mike - For letting me use parts of his bot_killer.pl which was written for
35 # the X-Chat client.
36 #
37 # Garion - Let me use parts of his "ho_easykline" to make this work with
38 # Irssi and gave me -
39 # return unless $server->{server_operator};
40 # so the script won't try to run if you aren't oper'd.
41 #
42 # mannix and lestefer of ircd.foxchat.net for letting me kline them :)
43 #
44 #------------------------------------------------------------------------------
45 sub event_privmsg
46 {
47 # $data = "nick/#channel :text"
48 my ($server, $data, $nick, $host, $user, $address) = @_;
49
50
51 # Set Temp K-Line time here in minutes.
52 my $klinetime = 1440;
53 my $msg = "Spamming is lame ... go spam somewhere else.";
54 my ($target, $text) = split(/ :/, $data, 2);
55
56 if ($text =~ /chat \/w me/ || / \/me.mpg/)
57 {
58 # --------[ Notice ]-----------------------------------------------------------
59 # Uncomment this line if you don't want to use temp klines
60 # and comment the following line.
61
62 # $server->command("quote kline $host :$msg");
63
64 $server->command("quote kline $klinetime $host :$msg");
65
66 #------------------------------------------------------------------------------
67
68 Irssi::print("K-lined $nick :$msg");
69
70 # Do a Kill in case they are on another server
71 # and the local Kline doesn't get them.
72
73 $server->command("quote kill $nick :$msg");
74 }
75 }
76
77 Irssi::signal_add("event privmsg", "event_privmsg");
78
79 Irssi::print("\00311:: Spam Bot Killer loaded ::\003\n");
80 Irssi::print("\00311::You can only use this script if you are Oper. ::\003\n");