IP Blacklist Check Script


/ Published in: PHP
Save to your folder(s)

Enter any suspicious IP address that you wanted to check into the form field and press the "LOOKUP" button


Copy this code and paste it in your HTML
  1. <html>
  2. <head>
  3. <title>DNSBL Lookup Tool - IP Blacklist Check Script</title>
  4. </head>
  5. <body>
  6. <form action="" method="get">
  7. <input type="text" value="" name="ip" />
  8. <input type="submit" value="LOOKUP" />
  9. </form>
  10. <?php
  11. /***************************************************************************************
  12. This is a simple PHP script to lookup for blacklisted IP against multiple DNSBLs at once.
  13.  
  14. You are free to use the script, modify it, and/or redistribute the files as you wish.
  15.  
  16. Homepage: http://dnsbllookup.com
  17. ****************************************************************************************/
  18. function dnsbllookup($ip){
  19. $dnsbl_lookup=array("dnsbl-1.uceprotect.net","dnsbl-2.uceprotect.net","dnsbl-3.uceprotect.net","dnsbl.dronebl.org","dnsbl.sorbs.net","zen.spamhaus.org"); // Add your preferred list of DNSBL's
  20. if($ip){
  21. $reverse_ip=implode(".",array_reverse(explode(".",$ip)));
  22. foreach($dnsbl_lookup as $host){
  23. if(checkdnsrr($reverse_ip.".".$host.".","A")){
  24. $listed.=$reverse_ip.'.'.$host.' <font color="red">Listed</font><br />';
  25. }
  26. }
  27. }
  28. if($listed){
  29. echo $listed;
  30. }else{
  31. echo '"A" record was not found';
  32. }
  33. }
  34. $ip=$_GET['ip'];
  35. if(isset($_GET['ip']) && $_GET['ip']!=null){
  36. if(filter_var($ip,FILTER_VALIDATE_IP)){
  37. echo dnsbllookup($ip);
  38. }else{
  39. echo "Please enter a valid IP";
  40. }
  41. }
  42. ?>
  43. </body>
  44. </html>

URL: https://sourceforge.net/projects/dnsbllookup/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.