Reduce the exception noise with queries that we dont parse correctly

This commit is contained in:
2023-10-03 20:58:23 +11:00
parent 2a50a1d795
commit 073d95f605
3 changed files with 14 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Classes\Protocol\DNS;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use App\Classes\Protocol\DNS;
@@ -26,8 +27,15 @@ final class RR
$domain = strstr($buf,"\x00",TRUE);
$i += strlen($domain)+1;
$this->type = Arr::get(unpack('n',substr($buf,$i,2)),1);
$this->class = Arr::get(unpack('n',substr($buf,$i+2,2)),1);
try {
$this->type = Arr::get(unpack('n',substr($buf,$i,2)),1);
$this->class = Arr::get(unpack('n',substr($buf,$i+2,2)),1);
} catch (\ErrorException $e) {
Log::error(sprintf('%s:! Error unpacking buffer [%s]',self::LOGKEY,$buf),['buf'=>hex_dump($buf)]);
return;
}
$i += 4;
switch ($this->type) {