Created
March 30, 2023 03:17
-
-
Save UVLabs/27687492e0877cb5a69e4a623192ecd7 to your computer and use it in GitHub Desktop.
Blacklist checker script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Simple PHP script to lookup for blacklisted IP against multiple DNSBLs at once. | |
// Note from Uriahs - I Didn't write any of this...I think...I'm pretty sure I just found the code somewhere online, but I can't remember..Saving as a gist for future reference. | |
?> | |
<html> | |
<head> | |
<title>DNSBL Lookup Tool - IP Blacklist Check Script</title> | |
</head> | |
<body> | |
<h2>IP Blacklist Check Script</h2> | |
<form action="" method="get"> | |
<input type="text" value="" name="ip"/> | |
<input type="submit" value="LOOKUP"/> | |
</form> | |
<?php | |
/** | |
* The IP-address to be looked up. | |
* @param string $ip | |
*/ | |
function dnsbllookup($ip) | |
{ | |
// Add your preferred list of DNSBL's | |
$dnsbl_lookup = [ | |
// "dnsbl-1.uceprotect.net", | |
// "dnsbl-2.uceprotect.net", | |
// "dnsbl-3.uceprotect.net", | |
"dnsbl.dronebl.org", | |
"dnsbl.sorbs.net", | |
"zen.spamhaus.org", | |
"bl.spamcop.net", | |
// "list.dsbl.org" | |
]; | |
$listed = ""; | |
if ($ip) { | |
$reverse_ip = implode(".", array_reverse(explode(".", $ip))); | |
foreach ($dnsbl_lookup as $host) { | |
if (checkdnsrr($reverse_ip . "." . $host . ".", "A")) { | |
$listed .= $reverse_ip . '.' . $host . ' <font color="red">Listed</font><br />'; | |
} | |
} | |
} | |
if (empty($listed)) { | |
echo '"A" record was not found'; | |
} else { | |
echo $listed; | |
} | |
} | |
if (isset($_GET['ip']) && $_GET['ip'] != null) { | |
$ip = $_GET['ip']; | |
if (filter_var($ip, FILTER_VALIDATE_IP)) { | |
echo dnsbllookup($ip); | |
} else { | |
echo "Please enter a valid IP"; | |
} | |
} | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment