Bug Tracker

Opened 13 years ago

Closed 10 years ago

#209 closed bug (fixed)

How can I help fighting comment spams ?

Reported by: gilles.vincent@… 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 
#!/bin/bash 
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 
#!/bin/bash
# auteur: Gilles Vincent : gilles.vincent@gmail.com"
# 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 

nbargs=$#

if [ $nbargs -lt 2 ]
then
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 " 
else

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

fi

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 !

.Gilles

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 13 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 10 years ago by dmethvin

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

comment:3 Changed 10 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.