diff --git a/app/Classes/DnsBlacklist.php b/app/Classes/DnsBlacklist.php index 60cd5ee..6a94f25 100644 --- a/app/Classes/DnsBlacklist.php +++ b/app/Classes/DnsBlacklist.php @@ -39,13 +39,25 @@ public function __construct($string) { $this->ip = $ip; } - public function isBlacklisted($string) { - + public function isBlacklisted() { + $reverse_ip = implode(".", array_reverse(explode(".", $this->ip))); + if ($this->checkBlacklists($reverse_ip)) { + return $this->blacklisted; + } + return false; } protected function checkBlacklists() { - + $blacklisted = []; + + foreach ($this->dnsbl as $bl) { + $lookup = $reverse_ip . "." . $bl; + $result = gethostbyname($lookup) + if ($result == $lookup) { + $blacklisted[] = $bl; + } + } } }