Go CLI and Library for quickly mapping organization network ranges using ASN information.

FeaturesInstallationUsageRunning asnmapJoin Discord



  • ASN to CIDR Lookup
  • ORG to CIDR Lookup
  • DNS to CIDR Lookup
  • IP to CIDR Lookup
  • ASN/DNS/IP/ORG input
  • JSON/CSV/TEXT output
  • STD IN/OUT support


asnmap requires Go 1.18 to install successfully. To install, just run the below command or download pre-compiled binary from release page.

go install


asnmap -h

This will display help for the tool. Here are all the flag it supports.

  ./asnmap [flags]

   -a, -asn string[]      target asn to lookup, example: -a AS5650
   -i, -ip string[]       target ip to lookup, example: -i, -i 2a10:ad40:: 
   -d, -domain string[]   target domain to lookup, example: -d, -d
   -org string[]          target organization to lookup, example: -org GOOGLE

   -config string           path to the asnmap configuration file
   -r, -resolvers string[]  list of resolvers to use

   -o, -output string  file to write output to
   -j, -json           display json format output
   -c, -csv            display csv format output
   -v6                 display ipv6 cidr ranges in cli output
   -v, -verbose        display verbose output
   -silent             display silent output
   -version            show version of the project

Running asnmap

Input for asnmap

asnmap support multiple inputs including ASN, IP, DNS and ORG name to query ASN/CIDR information.

Example AS14421 GOOGLE

Input can be provided either using specific options or STDIN which accepts all the supported formats. Single, multiple (comma-separated) and file input is supported for all the options.

echo GOOGLE | ./asnmap -silent

Example input for asnmap:

asnmap -a AS45596 -silent
asnmap -i -silent
asnmap -d -silent
asnmap -o GOOGLE -silent

Default Run

asnmap by default returns the CIDR range for given input.

echo GOOGLE | ./asnmap

   ___   _____  __              
  / _ | / __/ |/ /_ _  ___ ____ 
 / __ |_\ \/    /  ' \/ _  / _ \
/_/ |_/___/_/|_/_/_/_/\_,_/ .__/
                         /_/    v0.0.1

Use with caution. You are responsible for your actions
Developers assume no liability and are not responsible for any misuse or damage.

JSON Output

asnmap by default displays CIDR range, and all the information is always available in JSON format, for automation and post processing using -json output is most convenient option to use.

echo | ./asnmap -json -silent | jq

  "timestamp": "2022-09-19 12:14:33.267339314 +0530 IST",
  "input": "",
  "as_number": "AS13335",
  "as_name": "CLOUDFLARENET",
  "as_country": "US",
  "as_range": [
  "timestamp": "2022-09-19 12:14:33.457401266 +0530 IST",
  "input": "",
  "as_number": "AS13335",
  "as_name": "CLOUDFLARENET",
  "as_country": "US",
  "as_range": [

CSV Output

asnmap also support csv format output which has all the information just like JSON output

echo | ./asnmap -csv -silent

2022-09-19 12:15:04.906664007 +0530 IST||AS13335|CLOUDFLARENET|US|,,
2022-09-19 12:15:05.201328136 +0530 IST||AS13335|CLOUDFLARENET|US|2606:4700:9760::/44

Using with other PD projects

Output of asnmap can be directly piped into other projects in workflow accepting stdin as input, for example:

  • echo AS54115 | asnmap | tlsx
  • echo AS54115 | asnmap | asnmap -ptr
  • echo AS54115 | asnmap | naabu -p 443
  • echo AS54115 | asnmap | naabu -p 443 | httpx
  • echo AS54115 | asnmap | naabu -p 443 | httpx | nuclei -id tech-detect

Use asnmap as a library

It’s possible to use the library directly in your go programs. The following code snippets outline how to get cidr ranges from given input

package main

import (

func main() {
	client := asnmap.NewClient()

	// Query based on ASN
	asn := "14421"
	ASN := asnmap.ASN(asn)
	results := asnmap.GetFormattedDataInJson(client.GetData(ASN))

	// Query based on IP
	ip := ""
	IP := asnmap.IP(ip)
	results = asnmap.GetFormattedDataInJson(client.GetData(IP))

	// Query based on Organization
	org := "pplinknet"
	ORG := asnmap.Org(org)
	results = asnmap.GetFormattedDataInJson(client.GetData(ORG))

	// Query based on domain
	domain := ""
	resolvedIps := asnmap.ResolveDomain(domain)
	for _, ip := range resolvedIps {
		results = asnmap.GetFormattedDataInJson(client.GetData(asnmap.IP(ip), asnmap.Domain(domain)))


team and distributed under MIT License.

Join Discord


View Github