Hey guys,
I ran this script up recently and found it, despite being small and simple, incredibly helpful. It iterates through all your domains, and lets you know if any of them are marked as phishing or malware websites. I'm piping its output to an email every night so its alerts are proactive. Knowing who's been hacked and blacklisted before a client does is immensely helpful.
You will need to sign up for your own Google API key and insert it where shown. Otherwise, just save this content as a .pl file and chmod 700 it. Watch our for line wrapping if you paste from this site - that "get" request should be one line.
I ran this script up recently and found it, despite being small and simple, incredibly helpful. It iterates through all your domains, and lets you know if any of them are marked as phishing or malware websites. I'm piping its output to an email every night so its alerts are proactive. Knowing who's been hacked and blacklisted before a client does is immensely helpful.
You will need to sign up for your own Google API key and insert it where shown. Otherwise, just save this content as a .pl file and chmod 700 it. Watch our for line wrapping if you paste from this site - that "get" request should be one line.
Code:
#!/usr/bin/perl -w
use strict;
use LWP::Simple;
my $apikey = 'KEY HERE';
open FH, "/etc/userdomains" || die "Failed to open file";
while(my $domain = <FH>)
{
$domain = (split(':', $domain))[0];
next if ($domain =~ /\*/);
#Google Safebrowse Lookup
my $content = get("https://sb-ssl.google.com/safebrowsing/api/lookup?client=api&apikey=$apikey&appver=1.0&pver=3.0&url=http%3A%2F%2F$domain%2F");
die "Couldn't get Google lookup!" unless defined $content;
next if ($content eq '');
print "Google had this to say about $domain: $content\n";
}
close FH;
Last edited by a moderator: