Skip to content

Instantly share code, notes, and snippets.

@Nels2
Forked from tbreuss/dnsbl.php
Last active December 3, 2020 22:59
Show Gist options
  • Save Nels2/833c452e58c2bc8021050d26b29b1584 to your computer and use it in GitHub Desktop.
Save Nels2/833c452e58c2bc8021050d26b29b1584 to your computer and use it in GitHub Desktop.
IP Blacklist Check Script - This is a simple PHP script to lookup for blacklisted IP against multiple DNSBLs at once.
<?php // Simple PHP script to lookup for blacklisted IP against multiple DNSBLs at once. ?>
<html>
<head>
<title>IP Blacklist Check Script</title>
</head>
<style>
body {
background-color: #480535;
}
h2 {
text-align: center;
font-family: "Times", "Arial";
margin-bottom: -10px;
}
.ppar {
text-align: center;
padding-bottom: 50px;
font-family: "Times", "Arial";
color:
}
p {
font-family: "Times", "Arial";
}
.main {
text-align: center;
padding-bottom: 1px;
}
input {
border-radius: 5px;
}
footer {
text-align: center;
}
.main_area {
border: solid #e8e8e8 1px;
border-radius: 10px;
margin: 10%;
min-width: 50%;
margin-left: 25%;
margin-right: 25%;
background-color: #e8e8e8;
padding: 5px;
}
.creds{
border: solid #e8e8e8 1px;
border-radius: 10px;
margin-top: -9%;
min-width: 50%;
margin-left: 25%;
margin-right: 25%;
background-color: #e8e8e8;
padding: 5px;
}
a:link {
color: #e8e8e8;
}
a:visited {
color: red;
}
a:hover {
color: hotpink;
}
input:hover {
color: hotpink;
}
</style>
<body>
<div class="main_area">
<h2>IP Blacklist Check Script</h2>
<p class="ppar">A simple PHP script to lookup for blacklisted IP against multiple DNSBLs at once.</p>
<form class="main" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
<input type="text" value="" name="ip"/>
<input type="submit" value="LOOKUP"/>
</form>
</div>
<div class="creds">
<footer>
<p>Author:<a href="https://github.com/Nels2" target="_blank"> Nelson O</a><p>
</footer>
</div>
<?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",
"0spam.fusionzero.com",
"access.redhawk.org",
"all.rbl.jp",
"all.s5h.net",
"all.spamrats.com",
"b.barracudacentral.org",
"bl.blocklist.de",
"bl.emailbasura.org",
"bl.mailspike.org",
"bl.score.senderscore.com",
"bl.spamcannibal.org",
"bl.spamcop.net",
"bl.spameatingmonkey.net",
"bogons.cymru.com",
"cblplus.anti-spam.org.cn",
"cidr.bl.mcafee.com",
"combined.njabl.org",
"mdb.wpbl.info",
"dnsbl.ahbl.org",
"dnsbl.burnt-tech.com",
"dnsbl.dronebl.org",
"dnsbl.inps.de",
"dnsbl.justspam.org",
"dnsbl.kempt.net",
"dnsbl.rv-soft.info",
"dnsbl.solid.net",
"dnsbl.sorbs.net",
"dnsbl.tornevall.org",
"dnsbl.webequipped.com",
"dnsrbl.swinog.ch",
"fnrbl.fast.net",
"ip.v4bl.org",
"ips.backscatterer.org",
"ix.dnsbl.manitu.net",
"korea.services.net",
"l2.apews.org",
"l2.bbfh.ext.sorbs.net",
"list.blogspambl.com",
"lookup.dnsbl.iip.lu",
"mail-abuse.blacklist.jippg.org",
"psbl.surriel.com",
"rbl2.triumf.ca",
"rbl.choon.net",
"rbl.dns-servicios.com",
"rbl.efnetrbl.org",
"rbl.orbitrbl.com",
"rbl.polarcomm.net",
"singlebl.spamgrouper.com",
"spam.abuse.ch",
"spam.dnsbl.sorbs.net",
"spam.pedantic.org",
"spamguard.leadmon.net",
"spamrbl.imp.ch",
"spamsources.fabel.dk",
"spamtrap.trblspam.com",
"st.technovision.dk",
"tor.dan.me.uk",
"tor.dnsbl.sectoor.de",
"truncate.gbudb.net",
"ubl.unsubscore.com",
"virbl.dnsbl.bit.nl",
"work.drbl.gremlin.ru",
"zen.spamhaus.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($_POST['ip']) && $_POST['ip'] != null) {
$ip = $_POST['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