Skip to main content

Bug Tracker

Side navigation

#209 closed bug (fixed)

Opened September 22, 2006 04:50PM UTC

Closed February 05, 2010 09:04PM UTC

How can I help fighting comment spams ?

Reported by: gilles.vincent@gmail Owned by:
Priority: undecided Milestone:
Component: site Version:
Keywords: comment spams Cc: ""
Blocked by: Blocking:
Description

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

Attachments (0)
Change History (3)

Changed September 22, 2006 04:54PM UTC by gilles.vince comment:1

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.

Changed October 11, 2009 02:14PM UTC by dmethvin comment:2

component: → site
description: Comment spams are the worst to manage in Trac (cf. Ticket !#12 :'( ). \ [[BR]]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 :\ [[BR]]In my case, every projects are stored under a unique root : trac/\ [[BR]]The first parameter indicates the directory name of this project (under Trac/)\ [[BR]]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..)\ [[BR]]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 ?\ [[BR]]PPS.: have you upgraded to Trac1.0 ? There is an antispam plugin which looks quite good : \ http://trac.edgewall.org/wiki/SpamFilterComment spams are the worst to manage in Trac (cf. Ticket !#12 :'( ). \ [[BR]]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 : \ [[BR]]In my case, every projects are stored under a unique root : trac/ \ [[BR]]The first parameter indicates the directory name of this project (under Trac/) \ [[BR]]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..) \ [[BR]]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 ? \ [[BR]]PPS.: have you upgraded to Trac1.0 ? There is an antispam plugin which looks quite good : \ http://trac.edgewall.org/wiki/SpamFilter
need: → Review
priority: → blocker
type: → bug

Changed February 05, 2010 09:04PM UTC by john comment:3

resolution: → fixed
status: newclosed

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