]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/todo/commandline_comment_moderation.mdwn
429c11536c9335af7fd50a6cd56643514ab09fbd
[git.ikiwiki.info.git] / doc / todo / commandline_comment_moderation.mdwn
1 So I have enabled the [[moderatedcomments]] plugin on my wiki. and good thing that! around 1000 spammy comments showed up in the last 3 months! Awful!
3 It's pretty hard to figure out the ham and the spam in there. One thing I was hoping was to use the power of the commandline to filter through all that stuff. Now, it seems there's only a "ikiwiki-comment" tool now, and nothing to examine the moderated comments.
5 It seems to me it would be great to have some tool to filter through that...
8 So it turns out it was over 3000 comments. The vast majority of those (every one but 42 comments) were from the IP `46.161.41.34` which i recommend null-routing everywhere. I used the following shell magic to figure that out:
10 <pre>
11 #!/bin/sh
13 set -e
15 cd .ikiwiki/transient || {
16     echo could not find comments, make sure you are in a ikiwiki source directory.
17     exit 1
18     }
19 # count the number of comments
20 echo found $(find . -name '*._comment_pending' | wc -l) pending comments
21 # number of comments per IP
22 echo IP distribution:
23 find . -name '*._comment_pending' | xargs grep -h ip= | sort | uniq -c | sort -n
24 # generate a banlist for insertion in `banusers`, assuming all the
25 # pending comments are spam
26 echo banlist would look like:
27 find . -name '*._comment_pending' | xargs grep -h ip= | sort -u| sed 's/ ip="//;s/"//;s/^/- ip(/;s/$/)/'
29 echo to remove comments from a specific IP, use one of those:
30 find . -name '*._comment_pending' | xargs grep -h ip= | sort -u \
31     | sed 's/ ip="//;s/"//;' \
32     | while read ip; do
33           echo "find . -name '*._comment_pending' | xargs grep -l 'ip=\"$ip\"'| xargs rm"
34       done
35 echo to flush all pending comments, use:
36 echo "find . -name '*._comment_pending' -delete"
37 </pre>
39 The remaining 42 comments I reviewed throught the web interface, then flushed using the above command. My final addition to the banlist is:
41 <pre>
42 - ip(159.224.160.225)
43 - ip(176.10.104.227)
44 - ip(176.10.104.234)
45 - ip(188.143.233.211)
46 - ip(193.201.227.41)
47 - ip(195.154.181.152)
48 - ip(213.238.175.29)
49 - ip(31.184.238.11)
50 - ip(37.57.231.112)
51 - ip(37.57.231.204)
52 - ip(46.161.41.34)
53 - ip(46.161.41.199)
54 - ip(95.130.13.111)
55 - ip(95.181.178.142)
56 </pre>
58  --[[anarcat]]
60 Update: i made a script, above. And the banlist is much larger now so the above list is pretty much out of date now... --[[anarcat]]