LinuxCommandLibrary

asnmap

Map IP addresses to Autonomous System Numbers

TLDR

Lookup CIDR ranges for an ASN

$ asnmap [[-a|-asn]] [AS5650] -silent
copy

Lookup CIDR ranges for an IP address
$ asnmap [[-i|-ip]] [100.19.12.21] -silent
copy

Lookup CIDR ranges for a domain
$ asnmap [[-d|-domain]] [example.com] -silent
copy

Lookup CIDR ranges for an organization
$ asnmap -org [GOOGLE] -silent
copy

Lookup CIDR ranges from a file of targets
$ asnmap [[-f|-file]] [targets.txt] -silent
copy

Output results in JSON format
$ asnmap [[-d|-domain]] [facebook.com] [[-j|-json]] -silent
copy

Output results in CSV format
$ asnmap [[-a|-asn]] [AS394161] [[-c|-csv]] -silent
copy

Update asnmap to the latest version
$ asnmap [[-up|-update]]
copy

SYNOPSIS

asnmap [-6dejlmPrsS] [-f poolfile] [-o outputfile] [-p asnfile] [-t threads] [cidr...]

PARAMETERS

-6
    Enable IPv6 mode

-d
    Debug mode (verbose output)

-e
    Enumerate ASNs in range

-j
    JSON output format

-l
    Lookup mode (default, IP to ASN)

-m
    Map mode (detailed prefix info)

-P
    Print prefixes only

-r
    Reverse lookup (IPs in ASN)

-s
    Silent mode (no progress)

-S
    CSV output format

-f poolfile
    Load pre-built pool file

-o outputfile
    Output to file

-p asnfile
    ASN data file path

-t threads
    Number of threads (default: cores)

DESCRIPTION

asnmap is a high-performance utility for mapping IP addresses or CIDR ranges to their corresponding Autonomous System Numbers (ASNs), organizations, and prefixes. Developed by NCC Group, it excels in speed by pre-loading BGP-derived ASN data into memory pools, enabling rapid lookups without real-time queries.

Ideal for network reconnaissance, security audits, and large-scale scans (e.g., with masscan or zmap), asnmap processes millions of IPs per second on multi-core systems. It supports both IPv4 and IPv6, with output formats like JSON, CSV, or plain text.

Key workflow: Download/update ASN data via asnmap-getasn, load into pools, then scan ranges. Modes include lookup (default), mapping (per-prefix details), enumeration (ASNs per range), and reverse (IPs from ASN). Its efficiency stems from radix trees and thread-parallelism, minimizing latency for bulk operations.

CAVEATS

Requires asnmap-getasn for data; high memory use for large pools; IPv6 support experimental; not for real-time whois.

INSTALLATION

Compile from source: git clone https://github.com/nccgroup/asnmap.git; make. Install asnmap-getasn for data.

DATA UPDATE

Run asnmap-getasn daily: fetches RouteViews BGP dumps, builds asn.mmap pools.

HISTORY

Released by NCC Group in 2017; active on GitHub (nccgroup/asnmap). Evolved from need for fast ASN resolution in scanning tools; regular updates for BGP data formats.

SEE ALSO

masscan(1), zmap(1), whois(1), bgpdump(8)

Copied to clipboard