Deployment with Docker

Using asnmap with Docker provides a convenient, portable, and isolated environment for running the tool. The official image is available on Docker Hub.

Prerequisites

  • Docker installed on your system.
  • A ProjectDiscovery Cloud Platform (PDCP) API key. See Authentication.

Pulling the Image

You can pull the latest pre-built image directly from Docker Hub.

docker pull projectdiscovery/asnmap:latest

Building the Image Manually

If you prefer to build the image from the source code, you can clone the repository and use the provided Dockerfile.

# 1. Clone the repository
git clone https://github.com/projectdiscovery/asnmap.git
cd asnmap

# 2. Build the Docker image
docker build -t asnmap .

Running the Container

When running asnmap in a Docker container, you need to pass your commands and API key to it.

Verifying the Container

You can check the version to ensure the container is running correctly.

docker run --rm projectdiscovery/asnmap:latest -version

Passing the API Key

The most effective way to provide your PDCP API key to the container is by using the -e flag to set an environment variable.

docker run --rm -i -e PDCP_API_KEY="YOUR_API_KEY_HERE" projectdiscovery/asnmap:latest -org GOOGLE

Providing Input via stdin

Docker is excellent for stdin-based workflows. Use the -i flag to run the container in interactive mode and pipe data to it.

echo "hackerone.com" | docker run --rm -i -e PDCP_API_KEY="YOUR_KEY_HERE" projectdiscovery/asnmap:latest

Example: Chaining with other tools

You can even chain Docker containers together. Here is an example of finding google.com's CIDRs and then port scanning them with a Dockerized naabu.

echo "google.com" | docker run --rm -i -e PDCP_API_KEY="YOUR_API_KEY" projectdiscovery/asnmap:latest | docker run --rm -i projectdiscovery/naabu:latest -p 80,443