Reply
Highlighted

WAPI GET for hostnames in IPAM records

jpolache
Techie
Posts: 3
2394     0

I was able to dump all subnets using the following perl GET;

 

my $rest = REST::Client->new( { host => "https://$master/wapi/$REST_REV",} );

# GET the data from Infoblox
$rest->GET( '/network?_max_results=' . $max_results_number . '&_return_fields%2B=extattrs' , $headers );

# convert the data to JSON
my $res_data = decode_json( $rest->responseContent() );

I then enumerated all the IP addresses in those subnets;

 

 

    # set up for enumerate
    my $phys_list_var = Net::Netmask->new2( $line->{network} ) or die $Net::Netmask::error;

    # get IPs in subnet
    @phys_ip_list = $phys_list_var->enumerate();

 

I then dumpted the host records;

 

$rest->GET( '/record:host?_max_results=' . $max_results_number, $headers );

my $host_data = decode_json( $rest->responseContent() );

 

Next I ran through the IP addresses I enumerated to match the hostnames from "record:host";

 

for my $hostline ( keys %hosts ) {
    my $net_count = 0;
    my $match = 0;
    for my $netline (@networks) {
        1;
        if ($hostline eq $netline->{ip}) {
            1;
            $networks[$net_count]{hostname} = $hosts{$hostline};
            $match = 1;
            last;
        } 
        $net_count++;
        1;
    }
    #unless ($match) {
    #    print "no match; $hostline $hosts{$hostline}\n";
    #    1;
    #}

But I am winding up wth several unmatched host records and IP addresses from the network enumeration that do not have matching hostnames.

 

 

Is there a WAPI way to get the hostnames from the IPAM records?

Re: WAPI GET for hostnames in IPAM records

jpolache
Techie
Posts: 3
2395     0

It turns out at least some of the missing host names are of the Type "IP Resvervation" rather than type "Host".  Is there an API to pull IP Reservation records?

Re: WAPI GET for hostnames in IPAM records

jpolache
Techie
Posts: 3
2395     0

"fixedaddress" is getting some, but not all of the additional host names.  Any other objects I can try?

Showing results for 
Search instead for 
Do you mean 

Recommended for You

Businesses are investing heavily into securing company resources from cyber-attacks form cybercrimin