<?php
// Copyright Richard Boakes 2005 
// Licensed under a Creative Commons License. 
// http://creativecommons.org/licenses/by-nc-sa/2.0/
require_once('wp-config.php');
global 
$wpdb;
header("Content-type: text/plain");
$filename =  "http" . ($_SERVER['HTTPS']==on?"s":"") . "://" $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
$version "0.0.3";
$q="SELECT min(comment_date), comment_author_ip FROM wp_comments where comment_approved='spam' group by comment_author_ip order by 1 desc limit 10";
$lines $wpdb->get_results$q );
foreach (
$lines as $line) {
    echo( 
"" $line->comment_author_ip "\r\n");
}
echo(
"\r\n");
echo(
"Source: ".$filename."\r\n");
echo(
"Generator: Comment Spam Machines script (version $version) from http://boakes.org\r\n");
echo(
"Content: A list of the ".count($lines)." most recently discovered spam machines/relays/proxies, as of " .date("y/m/d H:i:s") .".\r\n");
?>