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 

Spam protection

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Fill
Halfop


Joined: 18 Jan 2009
Posts: 80

PostPosted: Mon Mar 23, 2009 6:26 pm    Post subject: Spam protection Reply with quote

Hey there,

I'm building an anti-spam script which is now something like this:

Code:

set varExceptions {
  "exception 1"
  "exception 2"
}

bind pubm - "$spamchan *.net*" spamfilter
bind pubm - "$spamchan *http://*" spamfilter

bind pubm - "$spamchan *www.*" spamfilter

bind pubm - "$spamchan *hotmail*" spamfilter
bind pubm - "$spamchan *mail*" spamfilter
bind pubm - "$spamchan *youtube*" spamfilter
bind pubm - "$spamchan *myspace*" spamfilter
bind pubm - "$spamchan *blog*" spamfilter
bind pubm - "$spamchan *flog*" spamfilter
bind pubm - "$spamchan *fotolog*" spamfilter
bind pubm - "$spamchan *#*" spamfilter
bind pubm - "$spamchan *.pt*" spamfilter
bind pubm - "$spamchan *.com.pt*" spamfilter
bind pubm - "$spamchan *.biz*" spamfilter
bind pubm - "$spamchan *.info*" spamfilter
bind pubm - "$spamchan *.com*" spamfilter
bind pubm - "$spamchan *.net*" spamfilter
bind pubm - "$spamchan *.org*" spamfilter
bind pubm - "$spamchan *.co.uk*" spamfilter
bind pubm - "$spamchan *.eu*" spamfilter
bind pubm - "$spamchan *.au*" spamfilter
bind pubm - "$spamchan *.com.br*" spamfilter
bind pubm - "$spamchan *.tv*" spamfilter
bind pubm - "$spamchan *.org.pt*" spamfilter
bind pubm - "$spamchan *.me*" spamfilter


proc spamfilter { nick uhost hand chan text } {
  global varExceptions spammer
  foreach site $varExceptions {
    if {[string match -nocase "*$site*" $text]} {return 0}
  }
  if {(![isop $nick $chan]) && (![ishalfop $nick $chan]) && (![isvoice $nick $chan]) } {

   set host *!*@[lindex [split $uhost @] 1]

   newchanban $chan ~q:$host RoBotX(nospam.tcl) spammer($chan) 60 sticky

   putserv "PRIVMSG $chan $nick: You're not allowed to spam on $chan. Adding temporary ~q: ban on your host. All your messages will be ignored from now on."
   }
}


The problem is that when someone says "Visit my website --> www.testsomething.net", the bot sends double message, 'cos it binds the *www.* and *.net* -.-"

However I want to bind all these wildcards because sometimes they just say "site.net", etc... and I also have to mantain my exceptions.

What's your suggestion to solve my problem?
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Tue Mar 24, 2009 6:45 am    Post subject: Reply with quote

It is a sort of byproduct of your method of dealing with spam. Specifically, seperate PUBM binds.

The norm would be to create a list of *spam* masks and, using a single PUBM bind, test each in a foreach loop. You could then output and break from the loop upon finding the first incidence of spam.

Remember also that the bot must test each PUBM bind against each IRC channel chat line. In a fast moving channel with many PUBM binds, that puts a significant strain on the bots resources.

Check out the scripts on offer on this site's Tcl achive. It's a good way to learn.

To be fair I suppose testing each chat line against many spam masks is perhaps also something of a strain too.
_________________
I must have had nothing to do
Back to top
View user's profile Send private message
Kein
Voice


Joined: 09 Apr 2008
Posts: 21

PostPosted: Tue Mar 24, 2009 12:42 pm    Post subject: Reply with quote

OMG
That is the first time when I see such big amounts of pubms >_>

As arfer already said: use general '*' pubm :P
_________________
I'm too lazy for all of this
Back to top
View user's profile Send private message
Fill
Halfop


Joined: 18 Jan 2009
Posts: 80

PostPosted: Wed Mar 25, 2009 8:13 am    Post subject: Reply with quote

arfer wrote:
It is a sort of byproduct of your method of dealing with spam. Specifically, seperate PUBM binds.

The norm would be to create a list of *spam* masks and, using a single PUBM bind, test each in a foreach loop. You could then output and break from the loop upon finding the first incidence of spam.

Remember also that the bot must test each PUBM bind against each IRC channel chat line. In a fast moving channel with many PUBM binds, that puts a significant strain on the bots resources.

Check out the scripts on offer on this site's Tcl achive. It's a good way to learn.

To be fair I suppose testing each chat line against many spam masks is perhaps also something of a strain too.


yeah I see. someone told me to use regular expressions for URL matching. But maybe your method is better, I'll try and download some sample script @ the TCL archive. anyway, how would I stop a loop upon the first matching?
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Wed Mar 25, 2009 12:45 pm    Post subject: Reply with quote

After executing whatever kick/ban/warning code simply use the Tcl command break to exit the foreach loop.

I have to say, I have a particular loathing of these scripts. They lack inbuilt intelligence (masks are generally too vague). For example, all it takes is for one user to say to another user on the channel "Are you on myspace?" and they get an immediate sticky ban.
_________________
I must have had nothing to do
Back to top
View user's profile Send private message
zerodtk
Voice


Joined: 25 Mar 2009
Posts: 20

PostPosted: Wed Mar 25, 2009 8:52 pm    Post subject: Reply with quote

or just try to add it with *www*biz*
just a quick thought
Back to top
View user's profile Send private message MSN Messenger
Fill
Halfop


Joined: 18 Jan 2009
Posts: 80

PostPosted: Thu Mar 26, 2009 3:30 pm    Post subject: Reply with quote

arfer wrote:
After executing whatever kick/ban/warning code simply use the Tcl command break to exit the foreach loop.

I have to say, I have a particular loathing of these scripts. They lack inbuilt intelligence (masks are generally too vague). For example, all it takes is for one user to say to another user on the channel "Are you on myspace?" and they get an immediate sticky ban.


Well I didn't decide the binds, someone asked me to do it with these wildcards ^^
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 -> Scripting Help 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