Twitter is a great platform for expressing ideas and keeping up with what is going on in the world, but there is also a downside and thats spam. There seems to be alot of twitter users which are just spam bots they just keep following people hopeing to sell you viagra. I think I have found away to name and shame them.
Enter Honeybot
Honeybot is my counter defense to this, what it does is constantly posts to the public time line a warning not to follow it. Now I believe that spambots constantly scrape the public timeline and follow whoevers on there. So they should in theory follow Honeybot automaticly.The second thing it does is keeps a record of its followers, allowing me to create a public blacklist of it's followers.
Creating a Blacklist of Spambots
What I intend to do is post the list of followers on my website where people can see if they are being followed by spammers. It's basicly a copy of the xml file of followers you can obtain from the twitter API, but I am going to parse it into a more readable format.Source Code
below is a copy of the source code so you can see how it works:#!/usr/bin/perl -w
## Honeybot - This bot attempts to attract spam bots and creates a spambot blacklist
## James Januszka, 2008, http://blog.jamesjanuszka.com
##
use strict;
use LWP;
use LWP::Simple;
use URI;
my $agent ='Honeybot/0.1';my $statusurl = 'http://twitter.com/statuses/update.xml';
my $followerurl = 'http://twitter.com/statuses/followers.xml?lite=true';
my $server ='twitter.com:80';
my $realm ="Twitter API";
my $username = "enteryourusername";
my $password ="enteryourpassword";
my $file="followers.xml";
my $string ="Please do not follow this bot as any followers will be added to the blacklist. See http://tinyurl.com/5bomg4 for more details.".int(rand(100000));
my $browser = LWP::UserAgent->new(agent =>$agent);
$browser->credentials($server,$realm,$username=>$password);
print "Content-type: text/html\n\n";
&updatestatus();
&getfollowers();
sub updatestatus {
my $response =$browser->post($statusurl,['status'=>$string]);
die "OMG, WTF: ",$response->header('WWW-Authenticate'), $response->status_line unless $response->is_success;
}
sub getfollowers {
system("wget --http-user=$username --http-passwd=$password -O $file -U $agent $followerurl");
}
I hope that this will be a useful service for twitter users, if you have any comments about how I can improve Honeybot let me know.