aboutsummaryrefslogtreecommitdiff
path: root/doc/todo/commandline_comment_moderation.mdwn
blob: 429c11536c9335af7fd50a6cd56643514ab09fbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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!

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.

It seems to me it would be great to have some tool to filter through that...


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:

<pre>
#!/bin/sh

set -e

cd .ikiwiki/transient || {
    echo could not find comments, make sure you are in a ikiwiki source directory.
    exit 1
    }
# count the number of comments
echo found $(find . -name '*._comment_pending' | wc -l) pending comments
# number of comments per IP
echo IP distribution:
find . -name '*._comment_pending' | xargs grep -h ip= | sort | uniq -c | sort -n
# generate a banlist for insertion in `banusers`, assuming all the
# pending comments are spam
echo banlist would look like:
find . -name '*._comment_pending' | xargs grep -h ip= | sort -u| sed 's/ ip="//;s/"//;s/^/- ip(/;s/$/)/'

echo to remove comments from a specific IP, use one of those:
find . -name '*._comment_pending' | xargs grep -h ip= | sort -u \
    | sed 's/ ip="//;s/"//;' \
    | while read ip; do
          echo "find . -name '*._comment_pending' | xargs grep -l 'ip=\"$ip\"'| xargs rm"
      done
echo to flush all pending comments, use:
echo "find . -name '*._comment_pending' -delete"
</pre>

The remaining 42 comments I reviewed throught the web interface, then flushed using the above command. My final addition to the banlist is:

<pre>
- ip(159.224.160.225)
- ip(176.10.104.227)
- ip(176.10.104.234)
- ip(188.143.233.211)
- ip(193.201.227.41)
- ip(195.154.181.152)
- ip(213.238.175.29)
- ip(31.184.238.11)
- ip(37.57.231.112)
- ip(37.57.231.204)
- ip(46.161.41.34)
- ip(46.161.41.199)
- ip(95.130.13.111)
- ip(95.181.178.142)
</pre>

 --[[anarcat]]

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]]