Bug Tracker

Opened 16 years ago

Closed 13 years ago

#209 closed bug (fixed)

How can I help fighting comment spams ?

Reported by: [email protected] Owned by:
Priority: undecided Milestone:
Component: site Version:
Keywords: comment spams Cc: ""
Blocked by: Blocking:

Description (last modified by dmethvin)

Comment spams are the worst to manage in Trac (cf. Ticket #12 :'( ).
I've written two small shell scripts which enable to detect comment spams and clear them easily.

Here are these scripts :

:~$ cat ./check_comments.sh 
echo "select * from ticket_change where time in 
(select time from ticket_change where newvalue like 
'%http:%');" | ./sqlite3 trac/$1/db/trac.db

:~$ cat ./erase_bad_comments.sh 
# auteur: Gilles Vincent : [email protected]"
# simple comment spam cleaner v.1.0
# It's based on keywords that can be found in spams 
# The keywords can be detected with the  script : 
# check_comments.sh 


if [ $nbargs -lt 2 ]
echo "simple comment spam cleaner v.1.0"
echo " It's based on keywords that found in spams" 
echo "(take care to choose you keywords cautiously)"
echo "parameters : $0 tracName [keyword1] [keyword2].."
echo "'tracName' is mandatory " 

for x in $*
if [ "$x" != "$1" ]
echo "delete from ticket_change where time in 
(select time from ticket_change where newvalue like 
'%$x%');" | ./sqlite3 trac/$1/db/trac.db 


This script must be adapted to your configuration :
In my case, every projects are stored under a unique root : trac/
The first parameter indicates the directory name of this project (under Trac/)
The second parameter of this script is the keyword of the comments to remove.

It's possible to clear spams automatically with some keywords that have nothing to do with jQuery (Vi*gr* etc..)
Personnaly, a daily report (with check_comments.sh) is sent to me with crontab, and in my case it's enought. Additionaly, erase_bad_comments.sh is executed repeatly with some predefined keywords.

Hope it helps !


PS.: I've implemented also a simple solution to fight ticket spams. Does it interess you ?
PPS.: have you upgraded to Trac1.0 ? There is an antispam plugin which looks quite good : http://trac.edgewall.org/wiki/SpamFilter

Change History (3)

comment:1 Changed 16 years ago by gilles.vince

You should also change the permission properties of Trac : with the version 1.0 it's possible to separate the "add comment" and the "change properties" functionalities.

comment:2 Changed 13 years ago by dmethvin

Component: site
Description: modified (diff)
need: Review
Priority: blocker
Type: bug

comment:3 Changed 13 years ago by john

Resolution: fixed
Status: newclosed

This will be going away with the move to the new bug tracker.

Note: See TracTickets for help on using tickets.