<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Deny on Evan Hoffman</title><link>https://evan.wtf/tags/deny/</link><description>Recent content in Deny on Evan Hoffman</description><generator>Hugo</generator><language>en-US</language><copyright>Evan Hoffman</copyright><lastBuildDate>Fri, 13 Aug 2010 11:59:27 +0000</lastBuildDate><atom:link href="https://evan.wtf/tags/deny/index.xml" rel="self" type="application/rss+xml"/><item><title>Blocking comment spammers by IP</title><link>https://evan.wtf/2010/08/13/blocking-comment-spammers-by-ip/</link><pubDate>Fri, 13 Aug 2010 11:59:27 +0000</pubDate><guid>https://evan.wtf/2010/08/13/blocking-comment-spammers-by-ip/</guid><description>&lt;p&gt;I use &lt;a href="http://akismet.com/"&gt;Akismet&lt;/a&gt; to block comment spam, but it still annoys me that it even exists. Last night I put a simple IP ban into my httpd config. But who to block?&lt;/p&gt;&#10;&lt;p&gt;I used a grep &amp;amp; Perl to get a rough guess of which IPs were submitting the most comments (working on the assumption that one IP address submits many spam comments) It took me about 20 minutes to write this mess but it does what I wanted to do:&#10;&lt;code&gt;[root@lunix ~]# zgrep POST /var/log/httpd/evanhoffman-access_log-201008??.gz | grep comment | perl -ne 'chomp; $_ =~ m/(?:\d{1,3}\.){3}\d{1,3}/; print &amp;quot;$&amp;amp;\n&amp;quot;;' | perl -e '%a = (); while (&amp;lt;&amp;gt;) { chomp; $a{$_} += 1; } while (my ($key, $value) = each (%a)) { if ($value &amp;gt; 1) { print &amp;quot;$value\t=&amp;gt;\t$key\n&amp;quot;;}}' 2 =&amp;gt; 218.6.9.140 180 =&amp;gt; 91.201.66.34 2 =&amp;gt; 213.5.67.41 2 =&amp;gt; 188.187.102.74 [root@lunix ~]#&lt;/code&gt;&lt;/p&gt;</description></item></channel></rss>