egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Tcl Ban-Spammer only for host

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
simonetto
Voice


Joined: 04 Mar 2010
Posts: 11

PostPosted: Tue Aug 24, 2010 12:34 am    Post subject: Tcl Ban-Spammer only for host Reply with quote

Hello. I Use the following tcl with satisfaction, but there is a point I would change: simply the way to ban.

Currently bans like this: *!*Tiscali@*.retail.telecomitalia.it

I would like to ban in that way: *!*@host221-206-dynamic.9-79-r.retail.telecomitalia.it
In short I want cha ban only the host.

I place the tcl, hoping you can help me.
Thanks in advance.
Simone


Code:
# ban-spammers.tcl v1.0 by FireEgl@EFNet <FireEgl@LinuxFan.com> - 4-19-00

# Description:
# Bans anyone not known to the bot if they join a channel
# and the first thing they say contains a web link.
#
# It could be done better I guess..

# Words that it checks for:
set spamwords {
 http://
 www.
 .com
 .net
 .org
 .nu
 .ca
 .uk
 .edu
 .it
 {web page}
 site
}

# Time, in minutes that the ban will last:
# (43200 = 1 month)
set spambantime 43200

# Set Global ban (1), or Channel ban (2), or just a kick (3)?
set spambantype 1


bind join - * join:banspam
proc join:banspam {nick host hand chan} { global banspam
   if {![validuser $hand]} { set banspam($nick) 0 }
}

bind pubm - * pubm:banspam
proc pubm:banspam {nick host hand chan msg} { global banspam spamwords spambantime spambantype
   if {[info exists banspam($nick)]} {
      if {(([getchanidle $nick $chan] == 0) && ($banspam($nick) == 0))} {
         foreach s $spamwords {
            if {[lsearch -glob "$msg" "*$s*"] != -1} {
               switch $spambantype {
                  "1" { putserv "KICK $chan $nick :No Spam!"
                        newban [string trimleft [maskhost [getchanhost $nick $chan]] ~] Ban-Spam "$msg" $spambantime
                  }
                  "2" { putserv "KICK $chan $nick :No Spam!"
                        newchanban $chan [string trimleft [maskhost [getchanhost $nick $chan]] ~] Ban-Spam "$msg" $spambantime
                  }
                  "3" { puthelp "KICK $chan $nick :No Spam!" }
                  "default" { putlog "$nick@$chan Just spammed the channel with: $msg" }
               }
               break
            }
         }
      }
      unset banspam($nick)
   }
}


# unset the var when they leave:
bind kick - * kick:banspam
proc kick:banspam {nick host hand chan target reason} { global banspam
   catch { unset banspam($nick) }
}
bind part - * part:banspam
proc part:banspam {nick host hand chan {reason ""}} { global banspam
   catch { unset banspam($nick) }
}
bind sign - * sign:banspam
proc sign:banspam {nick host hand chan reason} { global banspam
   catch { unset banspam($nick) }
}
bind splt - * splt:banspam
proc splt:banspam {nick host hand chan} { global banspam
   catch { unset banspam($nick) }
}

putlog "\002Ban-Spammers.tcl\002 v 1.0 by FireEgl@EFNet caricata con successo!"

_________________
Simonetto
Back to top
View user's profile Send private message
Luminous
Op


Joined: 12 Feb 2010
Posts: 146

PostPosted: Tue Aug 24, 2010 1:30 pm    Post subject: Reply with quote

Enjoy Smile

Code:

# ban-spammers.tcl v1.0 by FireEgl@EFNet <FireEgl@LinuxFan.com> - 4-19-00

# Description:
# Bans anyone not known to the bot if they join a channel
# and the first thing they say contains a web link.
#
# It could be done better I guess..

# Words that it checks for:
set spamwords {
 http://
 www.
 .com
 .net
 .org
 .nu
 .ca
 .uk
 .edu
 .it
 {web page}
 site
}

# Time, in minutes that the ban will last:
# (43200 = 1 month)
set spambantime 43200

# Set Global ban (1), or Channel ban (2), or just a kick (3)?
set spambantype 1


bind join - * join:banspam
proc join:banspam {nick host hand chan} { global banspam
   if {![validuser $hand]} { set banspam($nick) 0 }
}

bind pubm - * pubm:banspam
proc pubm:banspam {nick host hand chan msg} { global banspam spamwords spambantime spambantype
   if {[info exists banspam($nick)]} {
      if {(([getchanidle $nick $chan] == 0) && ($banspam($nick) == 0))} {
         foreach s $spamwords {
            if {[lsearch -glob "$msg" "*$s*"] != -1} {
              set host [getchanhost $nick $chan]
               switch $spambantype {
                  "1" { putserv "KICK $chan $nick :No Spam!"
                        newban *!*@[lrange [split $host @] 1 end] Ban-Spam "$msg" $spambantime
                  }
                  "2" { putserv "KICK $chan $nick :No Spam!"
                        newchanban $chan  *!*@[lrange [split $host @] 1 end]  Ban-Spam "$msg" $spambantime
                  }
                  "3" { puthelp "KICK $chan $nick :No Spam!" }
                  "default" { putlog "$nick@$chan Just spammed the channel with: $msg" }
               }
               break
            }
         }
      }
      unset banspam($nick)
   }
}
Back to top
View user's profile Send private message
simonetto
Voice


Joined: 04 Mar 2010
Posts: 11

PostPosted: Tue Aug 24, 2010 2:01 pm    Post subject: Reply with quote

Thank you.
I just tried and it works wonderfully.
Thank you very much really Smile
_________________
Simonetto
Back to top
View user's profile Send private message
Luminous
Op


Joined: 12 Feb 2010
Posts: 146

PostPosted: Tue Aug 24, 2010 6:27 pm    Post subject: Reply with quote

You're very welcome. Smile
Back to top
View user's profile Send private message
simonetto
Voice


Joined: 04 Mar 2010
Posts: 11

PostPosted: Tue Sep 07, 2010 10:27 am    Post subject: Reply with quote

Hello. The script is good but I would improve it even more to my needs.

You can do so that I can decide on which chan enable it?
I hope this is possible. Thanks Smile
_________________
Simonetto
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Tue Sep 07, 2010 11:03 am    Post subject: Reply with quote

A simple 'setudef flag spamwords' and
Code:

if {![channel get $chan spamwords]} return

at join and pubm processes, then '.chanset #channel +spamwords' from party-line should do the trick.

PS: You can replace 'spamwords' with whatever you wish, as long as isn't already used. But if you do want to use an existing channel flag then don't add the 'setudef' part.
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
simonetto
Voice


Joined: 04 Mar 2010
Posts: 11

PostPosted: Tue Sep 07, 2010 11:27 am    Post subject: Reply with quote

ah thanks, but what position I put the string?
_________________
Simonetto
Back to top
View user's profile Send private message
simonetto
Voice


Joined: 04 Mar 2010
Posts: 11

PostPosted: Wed Sep 08, 2010 12:05 pm    Post subject: Reply with quote

no, I do not work Sad
_________________
Simonetto
Back to top
View user's profile Send private message
simonetto
Voice


Joined: 04 Mar 2010
Posts: 11

PostPosted: Wed Sep 15, 2010 6:39 pm    Post subject: Reply with quote

Nobody can help me? Sad
_________________
Simonetto
Back to top
View user's profile Send private message
Luminous
Op


Joined: 12 Feb 2010
Posts: 146

PostPosted: Fri Sep 17, 2010 9:52 am    Post subject: Re: Tcl Ban-Spammer only for host Reply with quote

Code:

bind join - * join:banspam
proc join:banspam {nick host hand chan} {
 setudef flag spamwords
 if {![channel get $chan +spamwords]} {return}
          <snip>
}

bind pubm - * pubm:banspan
proc pubm:banspam {nick host hand chan text} {
 setudef flag spamwords
 if {![channel get $chan +spamwords]} {return}
          <snip>

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber