mpapet has asked for the wisdom of the Perl Monks concerning the following question:
I'm working on a program that captures DNS packets via an iptables queue, then I'd like to rewrite the answer portion of the packet for undesirable URL's. (Basically, advert blocking at the firewall+kernel level)
Net::DNS::Packet doesn't work. It parses the header okay, but can't find the answer.
Net::ncap and Net::pcap listen on interfaces. I get my packets from the firewall queue.
NetPacket::UDP appears to get me the binary payload. In the payload is the Question as a variable length string and one or more answers.
I have the format of the packet in a pretty picture, http://www.firewall.cx/dns-query-format.php.
DNS RFC is here: http://www.faqs.org/rfcs/rfc1035.html
I think my question is how do I unpack the payload, then turn the RR into a string?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Disassembling DNS Packet
by NetWallah (Canon) on May 13, 2010 at 04:41 UTC | |
by mpapet (Novice) on May 13, 2010 at 15:47 UTC | |
by mpapet (Novice) on May 13, 2010 at 15:47 UTC | |
by mpapet (Novice) on May 13, 2010 at 20:43 UTC | |
by JavaFan (Canon) on May 13, 2010 at 16:12 UTC | |
by ikegami (Patriarch) on May 13, 2010 at 20:48 UTC | |
by mpapet (Novice) on May 13, 2010 at 17:23 UTC | |
by ikegami (Patriarch) on May 13, 2010 at 20:36 UTC | |
by zwon (Abbot) on May 13, 2010 at 17:51 UTC | |
by Anonymous Monk on May 14, 2010 at 06:27 UTC | |
Re: Disassembling DNS Packet
by JavaFan (Canon) on May 12, 2010 at 22:58 UTC | |
Re: Disassembling DNS Packet
by mpapet (Novice) on May 13, 2010 at 18:50 UTC |