I've modified the code that was originally posted by
Smurf_Minions to the StopForumSpam forums, to additionally allow it to;
1. Check the fSpamList databases (IP, username and e-mail)
2. Check the SFS database for the username
You can see this in action at;
http://temp.it-mate.co.uk/NOTE: There's a new version of this code a little further downThe code for this, if you'd like to use it yourself, is below.
Code:
<?php
// Modified from the script found at:
// http://guildwarsholland.nl/phphulp/testspambot.php
//
// Modified by: MysteryFCM
// Date: 21-09-2008
//
// Modification corrected by my friend SysAdMini at MalwareDomainList (cheers dude :))
// .... well, it is only my second PHP script, and I didn't write all of this myself hehe.
function checkSpambots($mail,$ip,$name){
$sfsspambot = false;
$fslspambot = false;
$spambot = false;
echo 'Checking fSpamList ....<br />';
//check the e-mail address against fSpamlist
$xml_string = file_get_contents('http://www.fspamlist.com/xml.php?email='.$mail);
$xml = new SimpleXMLElement($xml_string);
if($xml->Email == 'True'){
$fslspambot = true;
echo '<span style="color: #ff0000">E-mail found in: fSpamList</span><br />';
}elseif($fslspambot != true){
//e-mail not found in the database, now check the ip
$xml_string = file_get_contents('http://www.fspamlist.com/xml.php?ip='.$ip);
$xml = new SimpleXMLElement($xml_string);
if($xml->IP == 'True'){
$fslspambot = true;
echo '<span style="color: #ff0000">IP found in: fSpamList</span><br />';
}elseif($fslspambot != true){
// IP not found, lets check the username
$xml_string = file_get_contents('http://www.fspamlist.com/xml.php?username='.$name);
$xml = new SimpleXMLElement($xml_string);
if($xml->Username == 'True'){
$fslspambot = true;
echo '<span style="color: #ff0000">Username found in: fSpamList</span><br />';
}
}
}
echo 'fSpamList checked....<br />';
echo 'Checking StopForumSpam ....<br />';
//check the e-mail address against StopForumSpam
$sfsxml_string = file_get_contents('http://www.stopforumspam.com/api?email='.$mail);
$sfsxml = new SimpleXMLElement($sfsxml_string);
// Used for debugging
//$sfsxml_string = str_replace("<", "<", $sfsxml_string);
//$sfsxml_string = str_replace(">", ">", $sfsxml_string);
//echo $sfsxml_string;
//echo '<br />';
// END Used for debugging
if($sfsxml->appears == 'yes'){
$sfsspambot = true;
echo '<span style="color: #ff0000">E-mail found in: StopForumSpam</span><br />';
}elseif($sfsspambot != true){
//e-mail not found in the database, now check the ip
$sfsxml_string = file_get_contents('http://www.stopforumspam.com/api?ip='.$ip);
$sfsxml = new SimpleXMLElement($sfsxml_string);
if($sfsxml->appears == 'yes'){
$sfsspambot = true;
echo '<span style="color: #ff0000">IP found in: StopForumSpam</span><br />';
}elseif($sfsspambot != true){
// IP not found, lets check the username
$sfsxml_string = file_get_contents('http://www.stopforumspam.com/api?username='.$name);
$sfsxml = new SimpleXMLElement($sfsxml_string);
if($sfsxml->appears == 'yes'){
$sfsspambot = true;
echo '<span style="color: #ff0000">Username found in: StopForumSpam</span><br />';
}
}
}
echo 'StopForumSpam Checked ....<br />';
// create a .txt file with the info of the spambot, if this one already exists, increase its amount of try's
if($sfsspambot == true){
$spambot = true;
$file = str_replace("*", "", $mail);
if(file_exists('spambots/sfs_'.$file.'.txt')){
$spambot_old_info = file_get_contents('spambots/sfs_'.$file.'.txt');
$spambot_old_info = explode(',',$spambot_old_info);
$spambot_old_info[2] = $spambot_old_info[2]+1;
$spambot_old_info = implode(',',$spambot_old_info);
file_put_contents('spambots/sfs_'.$file.'.txt',$spambot_old_info);
}else{
$spambot_info = $ip.','.$name.',1';
file_put_contents('spambots/sfs_'.$file.'.txt',$spambot_info);
}
}
if($fslspambot == true){
$spambot = true;
$file = str_replace("*", "", $mail);
if(file_exists('spambots/fsl_'.$file.'.txt')){
$spambot_old_info = file_get_contents('spambots/fsl_'.$file.'.txt');
$spambot_old_info = explode(',',$spambot_old_info);
$spambot_old_info[2] = $spambot_old_info[2]+1;
$spambot_old_info = implode(',',$spambot_old_info);
file_put_contents('spambots/fsl_'.$file.'.txt',$spambot_old_info);
}else{
$spambot_info = $ip.','.$name.',1';
file_put_contents('spambots/fsl_'.$file.'.txt',$spambot_info);
}
}
return $spambot;
}
if(isset($_GET['email'])){
$spambot = checkSpambots($_GET['email'],$_GET['ip'],$_GET['name']);
if($spambot == true){
echo '<span style="color: #ff0000">Spammer identified!</span>';
}else{
echo 'Nope, it\'s not a spammer';
}
}else{
echo 'Enter the e-mail AND username (or IP) you\'d like to check (only the e-mail is mandatory)';
}
?>
<form method='GET' name='checkspamdb'>
Name: <input type='text' name='name' value='<?php if(isset($_GET['name'])){echo $_GET['name'];} ?>'><br>
E-mail: <input type='text' name='email' value='<?php if(isset($_GET['email'])){echo $_GET['email'];} ?>'><br>
IP: <input type='text' name='ip' value='<?php if(isset($_GET['ip'])){echo $_GET['ip'];} ?>'><br>
<input type='submit' name='submit' value='check'>
</form>