A Bash script for efficient credentials-based attack surface enumeration and general reconnaissance of massive external network ranges. ScanCannon handles the enumeration of extremely large networks (such as The Internet) at high of speeds as the infrastructure can handle, specifically looking for credentials-based attack surfaces and APIs. It uses ScanCannon focuses on these high-value services for security assessment: TCP Services: UDP Services (with -u flag): This focused approach dramatically reduces scan time while ensuring all high-value attack surface services are discovered. At least one Options: Both The main configuration is handled through Edit ScanCannon automatically prompts for network adapter configuration every time you run it. This ensures optimal performance by helping masscan achieve maximum scanning speed. The script will: If you prefer manual configuration or need to customize settings, you can edit Why These Settings Matter: When These Settings Help: Manual Detection Commands: Important: Masscan requires MAC addresses in dash format (aa-bb-cc-dd-ee-ff), not colon format (aa:bb:cc:dd:ee:ff). The automatic configuration handles this conversion, but if configuring manually, ensure you use dashes. ScanCannon creates organized output in the ScanCannon can easily cause Denial of Service conditions, even from a single source. "ERROR: masscan is not installed" "ERROR: This script must be run as root" "No IPs are up; skipping nmap" Scan seems to hang or is very slow "bad MAC address" error from masscan Masscan sacrifices accuracy for speed and may miss responses due to its aggressive scanning approach. ScanCannon uses masscan to quickly identify which IP addresses have listening services, then uses nmap's more reliable scanning against only those responsive hosts. This gives you both speed and accuracy. Most enumeration tools try to be comprehensive "one-stop shops" but end up being mediocre at everything. ScanCannon focuses on doing network enumeration exceptionally well and outputs to standard, widely-compatible file formats that work with other specialized tools. When the Tier 1 (Passive): During nmap TCP enumeration, lightweight NSE scripts ( Tier 2 (Active): For each discovered HTTP/HTTPS host, Results are written to Both masscan and nmap require raw socket access for SYN scanning and OS detection, which requires root privileges on Unix systems. Currently, ScanCannon doesn't support pause/resume functionality. For large scans, consider breaking them into smaller CIDR ranges. ScanCannon currently focuses on IPv4 networks. For IPv6 scanning, use nmap directly or consider other specialized tools. This project is released under the Creative Commons Attribution-NonCommercial 3.0 Unported License. You are free to: Under the following terms: For the full license text, see LICENSE. ScanCannon v1.5 by J0hnnyXm4s "Efficient credential attack surface enumeration and general reconnaissance of massive network ranges"masscan to quickly identify open ports, then calls nmap to gain detailed information on the systems and services listening on those ports, thus compensating for the lack of acureacy in masscan. Final artifact is an array of flat text files full of IPs, hostnames, and interesting services that you can easily load up into the next tool in your killchain.-a flag)whois for CIDR + ASN, then discovers ALL prefixes announced by the ASN via RADB. Works for both -d (domain) and -c (CIDR) inputs with interactive range selection.dig, whois, wget, awk, sed-a flag)sudo ./scancannon.sh [-u] [-a] <-d domain | -c CIDR> [...]
-d or -c flag is required. Both flags are repeatable and can be combined.-d domain : Discover all networks for a domain (resolves all A records → whois → ASN → RADB prefix lookup; repeatable; accepts URLs too)-c CIDR : Discover all networks related to a CIDR (whois → ASN → RADB prefix lookup; repeatable)-u : Perform UDP scan on common ports (53, 161, 500) using nmap (significantly slower)-a : Perform API endpoint detection on HTTP/HTTPS services (requires curl)-d and -c run full ASN-based network discovery and present an interactive selection menu where you choose which discovered ranges to scan.# Scan a network by CIDR (includes ASN discovery of related networks)
sudo ./scancannon.sh -c 203.0.113.0/24
# Discover all networks for a domain (resolves all IPs → ASN → all announced prefixes)
sudo ./scancannon.sh -d example.com
# Combine domain + CIDR (both are scanned)
sudo ./scancannon.sh -d example.com -c 10.0.0.0/24
# Include UDP scanning (slower but more comprehensive)
sudo ./scancannon.sh -u -d example.com
# Include API endpoint detection
sudo ./scancannon.sh -a -c 203.0.113.0/24
# Combine all flags
sudo ./scancannon.sh -ua -d example.com -c 10.0.0.0/24
scancannon.conf:# Key settings you may want to adjust:
rate = 5000.00 # Packets per second (start low!)
excludefile = exclude.txt # Networks to exclude from scanning
# Only scan ports that ScanCannon actually uses - much more efficient!
ports = 21,22,23,53,80,135,139,443,445,990,1701,1723
exclude.txt to add networks you want to skip:# Add networks to exclude (one per line)
192.168.0.0/16 # Private networks
10.0.0.0/8 # Private networks
172.16.0.0/12 # Private networks
127.0.0.0/8 # Loopback
# Every time you run ScanCannon:
sudo ./scancannon.sh -c 192.168.1.0/24
# You'll always see:
=== Network Adapter Configuration ===
For optimal performance, ScanCannon can automatically configure your network adapter settings.
This helps masscan achieve maximum scanning speed by bypassing the kernel network stack.
Would you like to automatically configure network adapter settings? [y/N]: y
# If multiple interfaces exist:
Multiple network interfaces found:
[1] eth0 - IP: 192.168.1.100, MAC: aa:bb:cc:dd:ee:ff
[2] wlan0 - IP: 10.0.0.50, MAC: 11:22:33:44:55:66
Select interface [1-2]: 1
# Configuration is automatically applied to scancannon.conf
# Answer 'N' if you want to keep existing settings or configure manually
scancannon.conf directly:# Network adapter settings for maximum performance:
adapter-ip = 192.168.1.100 # Your machine's IP address
adapter-mac = aa:bb:cc:dd:ee:ff # Your network card's MAC address
router-mac = 11:22:33:44:55:66 # Your router's MAC address
adapter-ip: Your machine's IP address on the scanning interfaceadapter-mac: Your network card's MAC addressrouter-mac: Your default gateway's MAC address# Linux - Get IP, MAC, and gateway:
ip addr show # Your IP and MAC
ip route show # Default gateway IP
arp -a | grep $(ip route | grep default | awk '{print $3}') # Gateway MAC
# macOS - Get IP, MAC, and gateway:
ifconfig # Your IP and MAC
netstat -rn # Default gateway IP
arp -a | grep $(netstat -rn | grep default | awk '{print $2}') # Gateway MAC
results/ directory:results/
├── 203_0_113_0_24/ # Per-network results
│ ├── masscan_output.bin # Binary masscan results
│ ├── masscan_output.txt # Text masscan results
│ ├── hosts_and_ports.txt # Discovered hosts:ports
│ ├── nmap_files/ # Individual nmap scans
│ ├── gnmap_files/ # Greppable nmap output
│ ├── nmap_xml_files/ # XML nmap output
│ ├── interesting_servers/ # Categorized services
│ │ ├── ssh_servers.txt # SSH servers found
│ │ ├── http_servers.txt # Web servers found
│ │ ├── ftp_servers.txt # FTP servers found
│ │ ├── api_servers.txt # API endpoints found (with -a)
│ │ ├── api_details.txt # API detection details (with -a)
│ │ └── ... # Other services
│ ├── resolved_subdomains.txt # Discovered domains
│ └── resolved_root_domains.csv # Domain details with WHOIS
├── all_interesting_servers/ # Combined results
│ ├── all_ssh_servers.txt # All SSH servers
│ ├── all_http_servers.txt # All web servers
│ ├── all_api_servers.txt # All API endpoints (with -a)
│ └── ... # Other combined lists
├── all_subdomains.txt # All discovered domains
├── all_root_domains.csv # All domain details
└── dead_networks.txt # Unresponsive networks
Network Type Recommended Rate Notes Home/SOHO 1,000-5,000 pps May crash consumer routers Small Business 5,000-10,000 pps Monitor for connectivity issues Enterprise 10,000-20,000 pps Test incrementally ISP/Large Scale 20,000+ pps Can damage infrastructure rate = 1000 and increase gradually# Install masscan using your package manager
sudo apt install masscan # Ubuntu/Debian
# Run with sudo
sudo ./scancannon.sh -c 192.168.1.0/24scancannon.confrate setting in scancannon.confaa:bb:cc:dd:ee:ff → aa-bb-cc-dd-ee-ff-a flag is used, ScanCannon employs a two-tier detection approach:http-headers, http-title, http-robots.txt, http-server-header) are added for HTTP ports. The resulting XML output is then parsed for API framework fingerprints (Express, Django, Flask, FastAPI, Spring, etc.), API-related response headers (CORS, X-API-Version, JSON content types), and documentation page titles (Swagger UI, GraphQL Playground, etc.).curl probes 14 well-known API paths including /api, /api/v1, /swagger.json, /openapi.json, /graphql, and others. Responses are classified as API endpoints based on JSON content types, known API path patterns, and authentication-required responses (401/403).api_servers.txt (clean endpoint list) and api_details.txt (full detection log with tier indicators).
