-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
When trying to use pywdns to read an existing .nmsg file I run into the following error on Python3.
If I set it all up on Python2, it works fine.
Using the following;
CentOS Stream
Python 3.9
Latest pywdns commit from this repo.
Latest releases for mtbl, wdns, etc.
Stack trace
$ cat nmsg_test/*.nmsg | python ~/simple_py3_test.py
Traceback (most recent call last):
File "/home/jwah/simple_py3_test.py", line 23, in <module>
test_parse_nmsg(sys.stdin)
File "/home/jwah/simple_py3_test.py", line 16, in test_parse_nmsg
base_dnsqr_response = wdns.parse_message(base_dnsqr['response'])
File "wdns.pyx", line 593, in wdns.parse_message
File "wdns.pyx", line 858, in wdns.edns.__init__
TypeError: Expected str, got bytes
Sample Script
import sys
import nmsg
import wdns
def test_parse_nmsg(input):
dnsqr = nmsg.input.open_file(input)
dnsqr.set_filter_msgtype('base', 'dnsqr')
more = True
while more:
base_dnsqr = dnsqr.read()
if not base_dnsqr:
more = False
elif (base_dnsqr['type'] == 'UDP_QUERY_RESPONSE' and 'response' in
base_dnsqr):
try:
base_dnsqr_response = wdns.parse_message(base_dnsqr['response'])
except wdns.MessageParseException:
pass
if __name__ == '__main__':
test_parse_nmsg(sys.stdin)
Metadata
Metadata
Assignees
Labels
No labels