Authentication with PDCP
asnmap utilizes the ProjectDiscovery Cloud Platform (PDCP) to fetch up-to-date ASN data. To use the tool, you must have a free API key from PDCP.
Why is an API Key Required?
The API key authenticates your requests to the PDCP backend, which hosts and serves the ASN information. This allows for reliable, scalable, and current data delivery. You can sign up for a free account to get your key.
Get your free API key from cloud.projectdiscovery.io
Configuration Methods
There are three primary ways to configure your PDCP API key for asnmap to use. They are listed below in order of precedence (the first one found will be used).
1. Interactive Configuration (Recommended for First Use)
The easiest way to set up your key for the first time is with the interactive -auth flag. This will prompt you for your key and save it to a configuration file (~/.config/projectdiscovery/pdcp.yaml) for all ProjectDiscovery tools to use.
asnmap -auth
___ _____ __
/ _ | / __/ |/ /_ _ ___ ____
/ __ |_\ \/ / ' \/ _ / _ \
/_/ |_/___/_/|_/_/_/_/\_,_/ .__/
/_/
projectdiscovery.io
[INF] Get your free api key by signing up at https://cloud.projectdiscovery.io
[*] Enter PDCP API Key (exit to abort): *************
[INF] Successfully logged in as (@user)
2. Environment Variable
For CI/CD pipelines, Docker containers, or other automated environments, setting an environment variable is the most effective method. asnmap looks for the PDCP_API_KEY variable.
export PDCP_API_KEY="YOUR_API_KEY_HERE"
asnmap -org google
To make this setting permanent, add the export command to your shell's profile file (e.g., ~/.bashrc, ~/.zshrc).
3. CLI Flag Override
You can also provide the API key directly via the -auth flag on the command line. This method is useful for quick, one-off commands but is less secure as the key may be exposed in your shell history.
asnmap -auth YOUR_API_KEY_HERE -org google
This method overrides any key found in environment variables or the configuration file for that specific command execution.
Once authentication is configured, you are ready to start using the tool. Proceed to the Quick Start Guide to run your first queries.