Sendmail::AbuseIPDB - API access for IP address abuse database
use Sendmail::AbuseIPDB; my $db = Sendmail::AbuseIPDB->new(Key => '** your API key here **'); my $ip = '31.210.35.146'; # IP of sender my @all_data = $db->get( $ip ); foreach my $d ( @all_data ) { foreach my $c ( @{$d->{category}} ) { print "DATE:$d->{created} CATEGORY:" . $db->catg( $c ) . "\n"; } }
Convenient toolbox for API access to https://www.abuseipdb.com/ Potentially for other sites with compatible API if you want to change the BaseURL.
Additional parameters are: BaseURL, Days, Debug
Do a query to check an IP address. Returns array of hash references, looking similar to this: { 'created' => 'Sun, 17 Sep 2017 04:53:45 +0000', 'country' => 'Turkey', 'isoCode' => 'TR', 'ip' => '31.210.35.146', 'category' => [ 14 ] }
Convert the category from integer to printable string.
Return an array of those members in @data that match the given category. The format of @data is same as the return array from get() so see above. The $category can be either a number, or a printable string.
Report an abusive IP address back to the database. The comment can be "" empty string or any other brief comment to explain why you believe this IP has done something wrong. One or more categories must be included, these can be numbers or printable string categories. e.g. : $db->report( '111.119.210.10', 'Very annoying IP address', 'Brute-Force', 'Port Scan' );
https://www.abuseipdb.com/api.html https://www.abuseipdb.com/categories Sendmail::PMilter Example program abuseipdb_milter.pl for a simple way to block suspicious senders.
<ttndy@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.
To install Sendmail::AbuseIPDB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sendmail::AbuseIPDB
CPAN shell
perl -MCPAN -e shell install Sendmail::AbuseIPDB
For more information on module installation, please visit the detailed CPAN module installation guide.