I would like to convert a blob holding ip address(es) (it's the dnsrecord attribute of the MS AD ldap dnsnode objectclass.

It looks like this (ldif format):

dnsRecord:: BAABAAXwAACkAAAAAAABLAAAAAAAAAAArBQEKA==

This is the format of the dnsRecord string: https://msdn.microsoft.com/en-us/library/ee898781.aspx

I am really not a Perl guru, so I would really appreciate some handholding ;-) with unpacking this. Any help greatly appreciated. I will look into perlpacktut but I am a bit over my head with it right now.

update: I have tried this:

my $blob = "BAABAAXwAACGAAAAAAABLAAAAAAAAAAArBQEKA=="; my ( $dataLength, # 2 bytes $type, # 2 bytes $version, # 1 byte $rank, # 1 byte $flags, # 2 bytes $serial, # 4 bytes $ttl, # 4 bytes $reserved, # 4 bytes $timestamp, # 4 bytes $data ) = unpack( 'S S C C S L N L L a*', $blob ); print $dataLength, "\n"; print "$type\n"; print "$version\n"; print "$rank\n"; print "$flags\n"; print "$serial\n"; print "$ttl\n"; print "$reserved\n"; print "$timestamp\n"; print "$data\n"; $ perl /tmp/kkk.pl 16706 16961 65 65 30552 1195589953 1094795585 1111572801 1094795596 AAAAAAAArBQEKA==
Obviously not what I expected.

Thanks in advance.


In reply to unpack blob by natxo

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.