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 -ip [OPTIONS]
asnmap -i [OPTIONS]
asnmap -org [OPTIONS]

PARAMETERS

-ip
    Specifies a single IP address, CIDR range, or domain for which to retrieve ASN information.

-i
    Provides a path to an input file containing a list of IP addresses, CIDR ranges, or domains, one per line.

-org
    Searches for Autonomous Systems associated with the specified organization name.

-json
    Formats the output in JSON, useful for programmatic parsing and integration.

-o
    Writes the output to the specified file instead of standard output.

-silent
    Suppresses all non-result output, showing only the raw results.

-v
    Enables verbose output, displaying more detailed information during execution.

-version
    Displays the current version of the asnmap tool.

-sources
    Lists all available data sources that asnmap can query for information.

-r
    Enables hostname resolution to IP addresses before querying ASN data.

-s
    Specifies a comma-separated list of particular data sources to use, overriding the default.

-c
    Sets the maximum number of concurrent requests to be made.

-config
    Specifies the path to a custom configuration file, typically for API keys.

-proxy
    Uses the specified HTTP/SOCKS proxy for all outgoing requests.

DESCRIPTION

asnmap is a reconnaissance tool designed to retrieve Autonomous System Number (ASN), organization, and country information associated with IP addresses, CIDR ranges, or domains. It aggregates data from multiple public and passive sources like bgp.tools, cymru.com, and ipinfo.io, providing a comprehensive view of network ownership. This utility is particularly valuable for security researchers, penetration testers, and network administrators to understand the infrastructure footprint of a target, identify related assets, and enrich threat intelligence data.

It supports various input types and output formats, including plain text and JSON, making it versatile for scripting and integration into automated workflows. asnmap helps in mapping the internet's routing fabric to specific entities, aiding in incident response, vulnerability assessment, and asset discovery.

CAVEATS

Due to its reliance on external public APIs, asnmap's accuracy and performance can be affected by the availability, rate limits, and freshness of data from these sources. Some premium data sources require API keys, which must be configured. Users should also be mindful of the ethical implications and legality of conducting reconnaissance on target systems.

CONFIGURATION AND API KEYS

asnmap supports a configuration file (often located at ~/.config/asnmap/config.yaml) where users can securely store API keys for various data sources. This allows access to premium data and ensures consistent tool behavior across sessions.

INTEGRATION WITH PROJECTDISCOVERY TOOLS

As part of the ProjectDiscovery ecosystem, asnmap is designed for seamless integration with other tools like subfinder (for subdomain enumeration) and httpx (for HTTP probing). This modularity allows for powerful and automated reconnaissance workflows, where outputs from one tool can be piped as inputs to another.

HISTORY

asnmap is a modern command-line utility developed by ProjectDiscovery, an open-source initiative renowned for creating a suite of fast and efficient security and reconnaissance tools primarily written in Go. Its development is part of a broader trend in the cybersecurity community towards specialized, composable tools that facilitate automated asset discovery and threat intelligence gathering, making it a valuable addition to any security professional's toolkit.

SEE ALSO

whois(1), dig(1), nslookup(1), nmap(1)

Copied to clipboard