Maps IP addresses to autonomous system (AS) numbers.
The script works by sending DNS TXT queries to a DNS server which in turn queries a third-party service provided by Team Cymru (https://www.team-cymru.org/Services/ip-to-asn.html) using an in-addr.arpa style zone set up especially for use by Nmap. The responses to these queries contain both Origin and Peer ASNs and their descriptions, displayed along with the BGP Prefix and Country Code. The script caches results to reduce the number of queries and should perform a single query for all scanned targets in a BGP Prefix present in Team Cymru's database.
Be aware that any targets against which this script is run will be sent
to and potentially recorded by one or more DNS servers and Team Cymru.
In addition your IP address will be sent along with the ASN to a DNS
server (your default DNS server, or whichever one you specified with the
dns script argument).
The address of a recursive nameserver to use (optional).
nmap --script asn-query [--script-args dns=<DNS server>] <target>
Host script results: | asn-query: | BGP: 184.108.40.206/21 | Country: US | Origin AS: 10565 SVCOLO-AS - Silicon Valley Colocation, Inc. | Peer AS: 3561 6461 | BGP: 220.127.116.11/18 | Country: US | Origin AS: 10565 SVCOLO-AS - Silicon Valley Colocation, Inc. |_ Peer AS: 174 2914 6461
License: Same as Nmap--See https://nmap.org/book/man-legal.html
- action (host)
Cached results are checked before sending a query for the target and extracting the relevant information from the response. Mutual exclusion is used so that results can be cached and so a single thread will be active at any time.
- host: Host table.
Return value:Formatted answers or