Usage Guide
This guide provides an in-depth look at how to use asnmap's features, including different input methods, output formats, and integration capabilities.
Input Methods
asnmap is highly flexible and accepts input in several ways.
Input Types
You can query data based on four primary identifiers:
- ASN (
-a,-asn):asnmap -a AS15169 - IP Address (
-i,-ip):asnmap -i 8.8.8.8 - Domain Name (
-d,-domain):asnmap -d example.com - Organization Name (
-org):asnmap -org "Cloudflare, Inc."
Providing Input from a File
For bulk lookups, you can provide a list of targets in a file using the -f or -file flag. Each target should be on a new line.
targets.txt
google.com
AS15169
1.1.1.1
GitHub, Inc.
asnmap -f targets.txt
Providing Input from stdin
asnmap seamlessly integrates into command-line workflows by accepting input from stdin. This is perfect for piping data from other tools.
echo "GOOGLE" | asnmap
Output Formats
Control how you view and use the output data with these flags.
Default (CIDR List)
By default, asnmap prints a list of the discovered CIDR ranges, which is ideal for quick inspection or for piping to other network tools.
To include IPv6 ranges in the default output, use the -v6 flag.
asnmap -org GOOGLE -v6
JSON Output (-j, -json)
For structured data, the JSON format provides detailed information about the query. This is the best option for automation and scripting.
asnmap -d hackerone.com -json -silent
{
"timestamp": "2022-09-19 12:14:33.267339314 +0530 IST",
"input": "hackerone.com",
"as_number": "AS13335",
"as_name": "CLOUDFLARENET",
"as_country": "US",
"as_range": [
"104.16.0.0/14",
"104.20.0.0/16",
"104.21.0.0/17"
]
}
CSV Output (-c, -csv)
For analysis in spreadsheets or data processing tools, asnmap can output in CSV format, using | as a delimiter.
asnmap -d hackerone.com -csv -silent
timestamp|input|as_number|as_name|as_country|as_range
2022-09-19 12:15:04.906664007 +0530 IST|hackerone.com|AS13335|CLOUDFLARENET|US|104.16.0.0/14,104.20.0.0/16,104.21.0.0/17
Saving to a File (-o, -output)
To save the results to a file instead of printing to the screen, use the -o flag.
asnmap -org "GitHub, Inc." -o github_cidrs.txt
Integration with Other Tools
The power of asnmap is amplified when combined with other tools from the ProjectDiscovery suite. Since it outputs CIDRs to stdout by default, you can create powerful one-liner workflows.
-
Port scan all ranges for an organization:
echo AS54115 | asnmap | naabu -p 443 -
Discover live web servers on an organization's network:
echo AS54115 | asnmap | naabu -p 443 -silent | httpx -title -
Run Nuclei scans on discovered web servers:
echo AS54115 | asnmap | naabu -p 443 -silent | httpx -silent | nuclei -id cve-less-info