Author: J.Struebig (18 Jan 09 5:36pm)
I just wrote an Perl Modul for doin a request (before I found this thread), which is also translate the information.
Save this to a file named: Honeypot.pm
package Honeypot;
use Socket qw/inet_ntoa/;
my $dns = 'dnsbl.httpbl.org';
my %types = (
0 => 'Search Engine',
1 => 'Suspicious',
2 => 'Harvester',
4 => 'Comment Spammer'
);
sub query {
my $key = shift || die 'You need a key for this, you get one at http://www.projecthoneypot.org';
my $ip = shift || do {
warn 'no IP for request in Honeypot::query().';
return;
};
my @parts = reverse split /\./, $ip;
my $lookup_name = join'.', $key, @parts, $dns;
my $answer = gethostbyname ($lookup_name);
return unless $answer;
$answer = inet_ntoa($answer);
my(undef, $days, $threat, $type) = split /\./, $answer;
my @types;
while(my($bit, $typename) = each %types) {
push @types, $typename if $bit & $type;
}
return {
days => $days,
threat => $threat,
type => join ',', @types
};
}
1;
The usage is simple:
use Honeypot;
my $key = 'XXXXXXX'; # your key
my $ip = '....'; the IP you want to check
my $q = Honeypot::query($key, $ip);
use Data::Dumper;
print Dumper $q;
Post Edited (18 Jan 09 6:11pm)
|