Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: How to use Net::DNS:: Update with Net::Frame::Simple

by VinsWorldcom (Priest)
on Mar 04, 2013 at 02:16 UTC ( #1021563=note: print w/ replies, xml ) Need Help??


in reply to How to use Net::DNS:: Update with Net::Frame::Simple

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>


Comment on Re: How to use Net::DNS:: Update with Net::Frame::Simple
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1021563]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2014-08-30 17:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls