Last Updated: May 15, 2025
Version: 1.1
Welcome to the Astra User Guide! Astra is an open-source network scanning tool designed for security researchers, network administrators, and enthusiasts. Built with Python, Astra allows you to scan IP ranges, resolve domains to IPs, and identify open ports with a high degree of flexibility. Unlike many tools, Astra operates locally without third-party API dependencies, offering users control, privacy, and customization.
In a landscape filled with network scanning tools, Astra stands out by:
This guide will walk you through installing, configuring, and using Astra effectively.
requirements.txt (installs dnspython).sudo on some systems for certain port scans (ensure legal authorization).Follow these steps to set up Astra on your system:
git clone https://github.com/bhaweshchaudhary/Astra.git
cd astra
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
requirements.txt:
pip install -r requirements.txt
~/.astra/config.json to set defaults:
{
"api_token": "", // Leave empty unless using ipinfo.io (optional feature)
"default_ports": "22,80,443,8080,8443",
"default_timeout": 1.0
}
python3 astra.py -h to display the help message and confirm the tool is working.Astra is operated via the command line. Below are detailed instructions on how to use it, including command options and examples.
python3 astra.py [org] [options]
[org]: Organization name or domain (e.g., apple.com), optional if using --cidr.[options]: Customize the scan behavior (see Command-Line Options).Run python3 astra.py -h for the latest options. As of v1.1, the following are available:
org: Organization name or domain (e.g., apple or apple.com). Optional if --cidr is used.-h, --help: Display this help message and exit.--api-token API_TOKEN: ipinfo.io API token (optional, overrides config; not used for core functionality).--ports PORTS: Comma-separated ports to scan (e.g., 80,443).--first-1000: Scan the first 1,000 ports (0-999).--first-300: Scan the first 300 ports (0-299).--max-ips-per-cidr MAX_IPS_PER_CIDR: Maximum number of IPs to scan per CIDR range.--first-1-per-cidr: Scan only the first IP per CIDR range.--first-2-per-cidr: Scan only the first 2 IPs per CIDR range.--first-10-per-cidr: Scan only the first 10 IPs per CIDR range.--timeout TIMEOUT: Timeout for host/port scans in seconds (default: 1.0 from config).--max-ips MAX_IPS: Maximum total number of IPs to scan (global limit).--verbose: Enable verbose output with detailed logs.--output OUTPUT: File to save results (e.g., results.json).--output-format {json,csv}: Output format (default: json).--config CONFIG: Path to config file (default: ~/.astra/config.json).--cidr CIDR: Comma-separated CIDR ranges to scan (e.g., 192.168.1.0/24), skips domain resolution.apple.com:
python3 astra.py apple.com --verbose
facebook.com with a maximum of 100 IPs:
python3 astra.py facebook.com --first-1000 --max-ips 100 --timeout 2.0 --verbose
17.44.246.0/23 with the first 300 ports:
python3 astra.py --cidr 17.44.246.0/23 --first-300 --first-2-per-cidr --verbose
python3 astra.py --cidr 17.44.246.0/23,17.44.248.0/23 --first-300 --first-2-per-cidr --verbose
apple.com and save results in JSON:
python3 astra.py apple.com --first-1000 --output results.json --verbose
results.json for later analysis.Resolved 3 IPs for apple.com: ['17.253.144.10', ...]).Extracted 3 IPs).Found 1 open ports - 17.253.144.10:80).~/.astra/config.json if present.--timeout) override config values.python3 astra.py invalid.domain --verbose will log an error).sudo (e.g., sudo python3 astra.py apple.com --first-1000 --verbose).--timeout (e.g., --timeout 5.0) for slower networks.--first-2-per-cidr or --max-ips to limit resource usage.--verbose for minimal output.DEVELOPER.md.--max-ips and use per-CIDR flags for large networks to avoid overloading your system.--output to save scan data for analysis.USERGUIDE.md and DEVELOPER.md in the repository.Astra is released under the MIT License. See the LICENSE file for details.
dnspython for robust DNS resolution.Note: Astra is for ethical use only. Unauthorized network scanning is illegal and may result in legal consequences. Ensure compliance with all applicable laws and obtain permission before use.