Kommentar Spam

Alter Schwede,
dieser Kommentar Spam geht mir ja ganz schön auf die Nerven.

bildschirmfoto

Da ich zufaul bin alle Kommentar per Hand zu löschen, habe ich mal eben ein SQL Query abgesetzt.

UPDATE `wp_comments` 
SET `comment_approved`='spam' 
WHERE `comment_content` LIKE "%http://%" 
AND `comment_approved` = 0;

Dann habe ich das http:// mal auf die block Liste geschrieben, damit das zukünftig nicht mehr vor kommt.

Um mal einen Überblick zu bekommen, habe ich mir noch eine Statistik ausgeben lassen. Dies habe ich auch wieder die reckt mit der Datenbank:

SELECT `comment_author_IP` , 
COUNT(`comment_author_IP` )
FROM `wp_comments` 
WHERE `comment_approved` ="spam" 
GROUP BY `comment_author_IP`  
ORDER BY `COUNT( ``comment_author_IP`` )` DESC;


comment_author_IP COUNT( `comment_author_IP` )
194.8.75.239 546
194.8.74.10 530
194.8.75.245 495
194.8.75.247 363
194.8.75.214 351
194.8.75.212 333
85.17.167.196 182
193.53.87.81 180
194.8.75.103 119
200.63.42.81 111

Dann habe ich mir die IPs genommen und eine IPTabels Regel Geschreiben die alle /24 die reckt von meinem Server auf TCP Ebene fernhält.

iptables -A INPUT -s 194.8.74.0/23 -j DROP

#!/usr/bin/php5
 now() - 2678400
GROUP BY ip
ORDER BY co DESC";

$q = mysql_query($sql);
for(;$ds = mysql_fetch_array($q);)
{
	exec("iptables -D INPUT -s ". $ds['ip'] ." -j DROP");
	if($ds['co'] >= 3)
	{		
		exec("iptables -A INPUT -s ". $ds['ip'] ." -j DROP");
	}
}

?>