{"id":1365,"date":"2014-09-23T16:32:18","date_gmt":"2014-09-23T14:32:18","guid":{"rendered":"https:\/\/www.npcglib.org\/~stathis\/blog\/?p=1365"},"modified":"2014-09-23T16:38:14","modified_gmt":"2014-09-23T14:38:14","slug":"wordpress-tip-get-list-ips-leaving-spam-comments-blog","status":"publish","type":"post","link":"https:\/\/www.npcglib.org\/~stathis\/blog\/2014\/09\/23\/wordpress-tip-get-list-ips-leaving-spam-comments-blog\/","title":{"rendered":"wordpress tip: Get list of IPs leaving spam comments on my blog"},"content":{"rendered":"<p>I use <a href=\"http:\/\/akismet.com\" target=\"_blank\">Akismet<\/a> on my blog and it catches 99% of all spam comments. However lately I noticed I get more than 2000 spam messages and I decided I&#8217;d rather ban those IPs. Chances are they are virus infected or zombie machines that potentially not only leave spam messages, but may also engage into other activities.<\/p>\n<p>Before cleaning my spam comments, I first obtain a list of all those IPs from the wordpress table stored in my SQL server:<\/p>\n<pre>\r\nSELECT DISTINCT `comment_author_IP` FROM `wp_comments` WHERE `comment_approved` = \"spam\" ORDER BY `comment_author_IP` DESC\r\n<\/pre>\n<p>I then add those on to my firewall rules to block those IPs completely. Of course there can be proxies of large networks on the list, I know, which may in turn prevent legitimate users from accessing this blog, but lets see if my spam goes down.<\/p>\n<p>Another way people may find useful is to ban them only on their blog using a plugin. One that works pretty well for this purpose is <a href=\"http:\/\/wordpress.org\/plugins\/wp-ban\/\" target=\"_blank\">WP Ban<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I use Akismet on my blog and it catches 99% of all spam comments. However lately I noticed I get more than 2000 spam messages and I decided I&#8217;d rather ban those IPs. Chances are they are virus infected or zombie machines that potentially not only leave spam messages, but may also engage into other [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[48],"tags":[72,71,73],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<meta name=\"description\" content=\"SQL code to get a list of spamming IPs from your wordpress comments. Happy banning.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.npcglib.org\/~stathis\/blog\/2014\/09\/23\/wordpress-tip-get-list-ips-leaving-spam-comments-blog\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"stathis\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#website\",\"url\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/\",\"name\":\"sigmoid\",\"description\":\"..oo..oo..oo..oo..oo..oo..\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2014\/09\/23\/wordpress-tip-get-list-ips-leaving-spam-comments-blog\/#webpage\",\"url\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2014\/09\/23\/wordpress-tip-get-list-ips-leaving-spam-comments-blog\/\",\"name\":\"wordpress tip: Get list of IPs leaving spam comments on my blog - sigmoid\",\"isPartOf\":{\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#website\"},\"datePublished\":\"2014-09-23T14:32:18+00:00\",\"dateModified\":\"2014-09-23T14:38:14+00:00\",\"author\":{\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#\/schema\/person\/508363c4ebd1fd6066edf00c94e37e41\"},\"description\":\"SQL code to get a list of spamming IPs from your wordpress comments. Happy banning.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2014\/09\/23\/wordpress-tip-get-list-ips-leaving-spam-comments-blog\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.npcglib.org\/~stathis\/blog\/2014\/09\/23\/wordpress-tip-get-list-ips-leaving-spam-comments-blog\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2014\/09\/23\/wordpress-tip-get-list-ips-leaving-spam-comments-blog\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"wordpress tip: Get list of IPs leaving spam comments on my blog\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#\/schema\/person\/508363c4ebd1fd6066edf00c94e37e41\",\"name\":\"stathis\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/2.gravatar.com\/avatar\/214f29f604ec7d8d2f1345c5fa617c09?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/2.gravatar.com\/avatar\/214f29f604ec7d8d2f1345c5fa617c09?s=96&d=mm&r=g\",\"caption\":\"stathis\"},\"url\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/author\/stathis\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"description":"SQL code to get a list of spamming IPs from your wordpress comments. Happy banning.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.npcglib.org\/~stathis\/blog\/2014\/09\/23\/wordpress-tip-get-list-ips-leaving-spam-comments-blog\/","twitter_misc":{"Written by":"stathis","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#website","url":"https:\/\/www.npcglib.org\/~stathis\/blog\/","name":"sigmoid","description":"..oo..oo..oo..oo..oo..oo..","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.npcglib.org\/~stathis\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/2014\/09\/23\/wordpress-tip-get-list-ips-leaving-spam-comments-blog\/#webpage","url":"https:\/\/www.npcglib.org\/~stathis\/blog\/2014\/09\/23\/wordpress-tip-get-list-ips-leaving-spam-comments-blog\/","name":"wordpress tip: Get list of IPs leaving spam comments on my blog - sigmoid","isPartOf":{"@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#website"},"datePublished":"2014-09-23T14:32:18+00:00","dateModified":"2014-09-23T14:38:14+00:00","author":{"@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#\/schema\/person\/508363c4ebd1fd6066edf00c94e37e41"},"description":"SQL code to get a list of spamming IPs from your wordpress comments. Happy banning.","breadcrumb":{"@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/2014\/09\/23\/wordpress-tip-get-list-ips-leaving-spam-comments-blog\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.npcglib.org\/~stathis\/blog\/2014\/09\/23\/wordpress-tip-get-list-ips-leaving-spam-comments-blog\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/2014\/09\/23\/wordpress-tip-get-list-ips-leaving-spam-comments-blog\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.npcglib.org\/~stathis\/blog\/"},{"@type":"ListItem","position":2,"name":"wordpress tip: Get list of IPs leaving spam comments on my blog"}]},{"@type":"Person","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#\/schema\/person\/508363c4ebd1fd6066edf00c94e37e41","name":"stathis","image":{"@type":"ImageObject","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#personlogo","inLanguage":"en-US","url":"http:\/\/2.gravatar.com\/avatar\/214f29f604ec7d8d2f1345c5fa617c09?s=96&d=mm&r=g","contentUrl":"http:\/\/2.gravatar.com\/avatar\/214f29f604ec7d8d2f1345c5fa617c09?s=96&d=mm&r=g","caption":"stathis"},"url":"https:\/\/www.npcglib.org\/~stathis\/blog\/author\/stathis\/"}]}},"_links":{"self":[{"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/posts\/1365"}],"collection":[{"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/comments?post=1365"}],"version-history":[{"count":4,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/posts\/1365\/revisions"}],"predecessor-version":[{"id":1369,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/posts\/1365\/revisions\/1369"}],"wp:attachment":[{"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/media?parent=1365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/categories?post=1365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/tags?post=1365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}