Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Im trying to send a DNS any request with Net::DNS::Packet. For some reason when i do this in perl: my $str = '8.8.8.8'; my $dnspacket = new Net::DNS::Packet('vmware.com'.". 86400 ANY" +$str); my $dnsdata = $dnspacket->data; Here is the request when using my script Captured with TCPDUMP:
03:34:25.238020 IP 94.102.49.168.59681 > 8.8.8.8.53: 59189+ PTR? 8.8.i +n-addr.arpa. (34) 0x0000: 0021 1b82 5000 0025 90e0 10e3 0800 4500 .!..P..%......E. 0x0010: 003e 5969 4000 4011 4128 5e66 31a8 0808 .>Yi@.@.A(^f1... 0x0020: 0808 e921 0035 002a a059 e735 0100 0001 ...!.5.*.Y.5.... 0x0030: 0000 0000 0000 0138 0138 0769 6e2d 6164 .......8.8.in-ad 0x0040: 6472 0461 7270 6100 000c 0001 dr.arpa.....
Here is the request when using Dig Captured with TCPDUMP:
03:32:27.263486 IP 94.102.49.168.38437 > 8.8.8.8.53: 17767+ [1au] ANY? + vmware.com. (39) 0x0000: 0021 1b82 5000 0025 90e0 10e3 0800 4500 .!..P..%......E. 0x0010: 0043 0000 4000 4011 9a8c 5e66 31a8 0808 .C..@.@...^f1... 0x0020: 0808 9625 0035 002f a05e 4567 0100 0001 ...%.5./.^Eg.... 0x0030: 0000 0000 0001 0676 6d77 6172 6503 636f .......vmware.co 0x0040: 6d00 00ff 0001 0000 29ff ff00 0000 0000 m.......)....... 0x0050: 00 .
How could i get the same type of request to be sent from my script?

Replies are listed 'Best First'.
Re: DNS any request
by Corion (Patriarch) on May 25, 2014 at 06:52 UTC

    You are creating a new Net::DNS::Packet, but if you want to send a question, like dig does, you will need to create a Net::DNS::Question.

    Please post the full code of your program so that we can see how you are trying to send your data. Also, it might help to learn about DNS so you know and understand the different types of packets that get sent and received.

Re: DNS any request
by AnomalousMonk (Archbishop) on May 25, 2014 at 14:54 UTC

    As Corion has written, it's vital to post actual code rather than the figment in the OP. Just looking at the evaluation of the parameters in the posted code shows it's either not real or a real problem:

    c:\@Work\Perl\monks>perl -wMstrict -le "my $str = '8.8.8.8'; my $x = ('vmware.com'.\". 86400 ANY\" +$str); print $x; " Argument "8.8.8.8" isn't numeric in addition (+) at -e line 1. Argument "vmware.com. 86400 ANY" isn't numeric in addition (+) at -e l +ine 1. 8.8