Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- To check if a domain is using cloudflare (perl code):
- my $whoiscmd = "/usr/bin/whois";
- sub uses_cloudflare_dns
- {
- my $domain = shift;
- my $retval = system("$whoiscmd '$domain' |grep -i 'cloudflare' > /dev/null");
- return (($retval >> 8) == 0);
- }
- To check blacklists:
- my $score = 0;
- my $reason = "";
- my $hostcmd = "/usr/bin/host";
- sub check_blacklists
- {
- my $ip = shift;
- # Do a sorbs lookup (determine if it is a dynamic ip)
- my ($a, $b, $c, $d) = split('\.', $ip);
- my $ret = `$hostcmd $d.$c.$b.$a.dul.dnsbl.sorbs.net|grep 'has address'|head -n 1`;
- if ($ret =~ /has address ([0-9\.]+)/)
- {
- if ($reason ne "")
- {
- $reason .= ", ";
- }
- $reason .= "your outgoing mail server is listed in SORBS";
- $score += 100;
- if ($debug eq "true")
- {
- print "mail server $ip listed in sorbs: 100 added to score (total score=$score)\n";
- }
- }
- # Do a spamhaus lookup
- $ret = `$hostcmd $d.$c.$b.$a.zen.spamhaus.org|grep 'has address'|head -n 1`;
- if ($ret =~ /has address ([0-9\.]+)/)
- {
- if ($reason ne "")
- {
- $reason .= ", ";
- }
- $reason .= "your outgoing mail server is listed in SPAMHAUS";
- $score += 100;
- if ($debug eq "true")
- {
- print "mail server listed in spamhaus: 100 added to score (total score=$score)\n";
- }
- }
- # Do a barracuda lookup
- $ret = `$hostcmd $d.$c.$b.$a.b.barracudacentral.org|grep 'has address'|head -n 1`;
- if ($ret =~ /has address ([0-9\.]+)/)
- {
- if ($reason ne "")
- {
- $reason .= ", ";
- }
- $reason .= "your outgoing mail server is listed in Barracuda";
- $score += 100;
- if ($debug eq "true")
- {
- print "mail server listed in barracuda: 100 added to score (total score=$score)\n";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment