Skip to content

Commit

Permalink
temp svae
Browse files Browse the repository at this point in the history
  • Loading branch information
dunkrupp committed Mar 6, 2018
1 parent 2658e28 commit 1c712e4
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions app/Classes/DnsBlacklist.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

}

0 comments on commit 1c712e4

Please sign in to comment.