Certainly look at the Net::Frame suite of modules. You'll see there exists a Net::Frame::Layer::DNS (I wrote it).

You'll need to get Net::Pcap working - which on Windows has some caveats (see Re: Net::Pcap installation help (and not with the library)).

After that, check out the Perl Packet Crafter at:

Download: http://www.vinsworld.com/software/ppc.zip

POD: http://www.vinsworld.com/software/ppc.html

If you're using *nix, it should be easily ported with Net::Libdnet (which I couldn't get working on Windows). That will give you a scapy-like interface for Perl packet crafting.

UPDATE: A minor glitch in Net::Frame::Layer::DNS was just fixed to address rdlength = 0. Version 1.04 should appear on CPAN in short order.

Using PPC, this is the "recipe". Note you can use Net::DNS and you don't even need Net::Frame::Layer::DNS unless you want a pretty decode:

VinsWorldcom@C:\Users\VinsWorldcom\tmp\> ppc.pl -i "Wireless Network C +onnection" Welcome to Perl Packet Crafter (PPC) Copyright (C) Michael Vincent 2012 Wireless Network Connection ppc> use Net::DNS; ppc> use Net::Frame::Layer::DNS qw(:consts); ppc> $update = Net::DNS::Update->new('evil.zz'); ppc> $update->push(prerequisite => nxrrset('hacker11.evil.zz. A')); ppc> $update->push(update => rr_add('hacker11.evil.zz. 86400 A 127.0.0 +.1')); ppc> $res = Net::DNS::Resolver->new; ppc> $res->nameservers('192.168.200.113'); ppc> $dnsdata = $res->make_query_packet($update); ppc> $ether = ETHER; ppc> $ipv4 = IPv4(src=>'1.1.1.1',dst=>'192.168.200.113',protocol=>NF_I +Pv4_PROTOCOL_UDP); ppc> $udp = UDP(dst=>53,payload=>$dnsdata->data); ppc> $packet = packet $ether,$ipv4,$udp; ppc> decode $packet; ETH: dst:58:6d:8f:78:ad:40 src:c0:cb:38:08:46:76 type:0x0800 IPv4: version:4 hlen:5 tos:0x00 length:90 id:23417 IPv4: flags:0x00 offset:0 ttl:128 protocol:0x11 checksum:0x53fe IPv4: src:1.1.1.1 dst:192.168.200.113 UDP: src:50281 dst:53 length:70 checksum:0x5661 DNS: id:5329 qr:0 opcode:5 flags:0x00 rcode:0 DNS: qdCount:1 anCount:1 DNS: nsCount:1 arCount:0 DNS::Question: name:evil.zz DNS::Question: type:6 class:1 DNS::RR: name:hacker11.[@12(evil.zz)] DNS::RR: type:1 class:254 ttl:0 rdlength:0 DNS::RR: name:[@25(hacker11.[@12(evil.zz)])] DNS::RR: type:1 class:1 ttl:86400 rdlength:4 DNS::RR::A: address:127.0.0.1 ppc> hexdump $packet; 0x00000: 58 6d 8f 78 ad 40 c0 cb 38 08 46 76 08 00 45 00 Xm.x.@..8.F +v..E. 0x00010: 00 5a 5b 79 00 00 80 11 53 fe 01 01 01 01 c0 a8 .Z[y....S.. +..... 0x00020: c8 71 c4 69 00 35 00 46 56 61 14 d1 28 00 00 01 .q.i.5.FVa. +.(... 0x00030: 00 01 00 01 00 00 04 65 76 69 6c 02 7a 7a 00 00 .......evil +.zz.. 0x00040: 06 00 01 08 68 61 63 6b 65 72 31 31 c0 0c 00 01 ....hacker1 +1.... 0x00050: 00 fe 00 00 00 00 00 00 c0 19 00 01 00 01 00 01 ........... +..... 0x00060: 51 80 00 04 7f 00 00 01 Q....... ppc> sendp $packet; . Sent 1 packet ppc>

In reply to Re: How to use Net::DNS:: Update with Net::Frame::Simple by VinsWorldcom
in thread How to use Net::DNS:: Update with Net::Frame::Simple by sagarkha

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.