You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DNS normalizer fails when an option is present. For example the following DNS data:
RESOLVER: 1.1.1.1
id 24462
opcode QUERY
rcode NOERROR
flags QR RD RA
edns 0
payload 1232
option Generic 15
;QUESTION
example.com. IN SOA
;ANSWER
example.com.
The problem seems to be that dnspython to_text generates the option Generic 15, but the from_text method isn't able to parse option.
Traceback (most recent call last):
File "/app/boefjes/boefjes/app.py", line 247, in _start_working
handler.handle(p_item.data)
File "/app/boefjes/boefjes/job_handler.py", line 198, in handle
results = self.job_runner.run(normalizer_meta, raw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/boefjes/boefjes/local.py", line 76, in run
return self._parse_results(normalizer_meta, results)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/boefjes/boefjes/local.py", line 79, in _parse_results
parsed: list[NormalizerResult] = [self._parse(result) for result in results]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/boefjes/boefjes/local.py", line 79, in <listcomp>
parsed: list[NormalizerResult] = [self._parse(result) for result in results]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/boefjes/boefjes/plugins/kat_dns/normalize.py", line 50, in run
responses.append(from_text("\n".join(lines[1:])))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/dns/message.py", line 1352, in from_text
return reader.read()
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/dns/message.py", line 1308, in read
line_method(section_number)
File "/usr/local/lib/python3.11/site-packages/dns/message.py", line 1159, in _header_line
raise UnknownHeaderField
dns.message.UnknownHeaderField: The header field name was not recognized when converting from text
into a message.
As far as I can see there are two ways to solve this:
Add support for parsing option to dnspython from_text
Change our raw files to use the format used by to_wire and from_wire. This saves the queries in the binary DNS protocol wire format. We can use prepend_length to save multiple queries/answers to a single file.
If we change to the new format, we should probably create a new raw file type and keep the old normalizer so we can still parse old raw files.
The text was updated successfully, but these errors were encountered:
I agree, we should just move to the Wire protocol for this. it's better fitting to the OpenKAT philosophy and might fix these issues, as dnspython clearly Can parse these records from the underlying wire data directly.
The DNS normalizer fails when an option is present. For example the following DNS data:
The problem seems to be that dnspython
to_text
generates theoption Generic 15
, but thefrom_text
method isn't able to parseoption
.As far as I can see there are two ways to solve this:
option
to dnspythonfrom_text
to_wire
andfrom_wire
. This saves the queries in the binary DNS protocol wire format. We can useprepend_length
to save multiple queries/answers to a single file.If we change to the new format, we should probably create a new raw file type and keep the old normalizer so we can still parse old raw files.
The text was updated successfully, but these errors were encountered: