1

I'm using Python2 to implement a server which provides NAPTR DNS answers using dnslib.

The forged answers are in the following format:

0.0.0.0.0.0.0.e164.arpa. 60 IN NAPTR  20 20 "u" "SIP+E2U" "!^.*$!SIP:0000@whatever.0.0.e164!" .

I use dig in order to perform the queries by using the following syntax:

dig NAPTR 0.0.0.0.0.0.0.e164.arpa @<server_ip>

The issue is that whenever the regexp part of the NAPTR record contains a circumflex (^), dig flags the retrieved packet as malformed:

;; Got bad packet: syntax error

If I remove the circumflex from the string, the query answer gets retrieved properly. So it seems that the circumflex is being somehow misintepreted. I tried to specify regexp.encode('utf-8'), but that didn't solve the issue. Any ideas?

Andrea
  • 53
  • 1
  • 6
  • Please reduce your program to the smallest possible program that demonstrates the error, and copy-paste that entire short program into your question. For example, [My server](http://ideone.com/TlMGnu), built from your description, works just fine on my PC. See [mcve] for more info. – Robᵩ Jan 03 '17 at 20:23

0 Answers0