nsinfo - get info from last name lookup


<nsinfo $name [$which]>

The nsinfo function obtains information about the most recently completed nslookup (here). It can be called after a single nslookup or within an nslookup loop. The $name argument is one of the following:

  • addrs Returns the list of IP addresses given in the reply.

  • name Returns the canonical host name.

  • aliases Returns any aliases known for the host.

  • errnum Returns the error code (not a protocol code) from the last lookup. 0 indicates a successful reply. See below for other numbers.

  • errmsg Returns the error message from the last lookup. The possible errnum codes and their corresponding errmsg messages are:

    • 0 Ok

    • 1 No recovery

    • 2 Try again

    • 3 Cannot open hosts file

    • 4 Cannot connect to nameserver

    • 5 Nameserver connection refused

    • 6 Nameserver query timeout

    • 7 Host not found

    • 8 Bad IP address

    • 9 Incorrect usage

    • 10 Out of memory

    • 11 Bad service

    • 12 No data

    • 13 Internal error

    • 14 Unknown error

  • replyheader Returns text information about the reply header, including id, flags, opcode, and response code. Added in version 3.01.989630000 20010511.

  • replyrecords Returns text information about the reply's records. An optional second argument can be one of query, answer, authority, additional or all to return records from just a particular section (or all sections). Each value returned is a space-separated list of name, TTL, class, type, and data (answer). Added in version 3.01.989630000 20010511.

  • rawreply Returns the raw packet data from the last reply, as a varbyte field. Largely superseded by replyheader and replyrecords options.

nsinfo returns the requested information from the last nslookup completed.


<nslookup $host>
IP address: $ret
<nsinfo aliases>
Aliases: <LOOP $ret> $ret </LOOP>

The nsinfo function was added in version 3.0.951800000 20000228.

If <urlcp dnsmode sys> is set, less information may be available from the reply.

urlcp, nslookup

Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.