This repository contains a Python wrapper around nmap that runs parallel scans and logs results to src/logs.
Why Dockerize?
- Reproducible environment: same Python version and nmap binary across machines.
- Keeps your Kali system cleaner when trying different versions of nmap or dependencies.
- Easier to run from different OS (but see networking notes below).
Important: nmap SYN scans (-sS) require raw socket capabilities. Inside a container you must either run the container as root with the appropriate capabilities and networking settings or use TCP connect (-sT).
Build the image
docker build -t nmap-port-mc .Run (recommended on Linux when you need SYN scans)
The easiest and most reliable way on Linux is to give the container the raw socket capability and use host networking. This example mounts the src/logs folder so scan outputs persist on the host.
sudo docker run --rm -it \
--cap-add=NET_RAW --cap-add=NET_ADMIN \
--network host \
-v "$(pwd)/src/logs":/app/src/logs \
nmap-port-mcNotes:
--cap-add=NET_RAW --cap-add=NET_ADMINis required for SYN scans (-sS). Without capabilities, nmap will fall back or fail.--network hostlets the container use the host network stack; this is the most predictable mode for network scanning on Linux. On macOS/Windows--network hostbehaves differently; consider running nmap directly on those hosts or use TCP connect scans (-sT).- If you don't want SYN scans, you can still run the container without extra capabilities and choose TCP connect scans inside the interactive prompt.
Examples (non-SYN, no special capabilities)
docker run --rm -it -v "$(pwd)/src/logs":/app/src/logs nmap-port-mc
# then choose TCP Connect in the script or respond 'n' to the SYN promptSecurity and legal reminder
- Only scan hosts/networks you own or have explicit permission to scan. Scanning hostile/unauthorized networks may be illegal.
Troubleshooting
- If you see many TIMEOUT results: try enabling
--host-timeoutwhen prompted by the script (e.g.2m) or allow the script to run without a Python timeout (it may take a long time if the target drops packets). - If you want non-interactive runs, we can add CLI flags to the script (e.g.,
--target,--timeout,--sV,--host-timeout). Ask and I can add them.
A high-performance, multi-threaded port scanner built with Python that leverages nmap for comprehensive network reconnaissance. Designed for cybersecurity professionals and penetration testers.
- Parallel Scanning: Multi-threaded execution for faster scan completion
- Domain Resolution: Automatic DNS resolution for domain names
- Multiple Scan Types: Fast, full, and custom port range options
- Real-time Progress: Live timer and completion tracking
- Comprehensive Logging: Detailed scan results saved to timestamped files
- Privilege Detection: Automatic administrator privilege checking
- Input Validation: Robust IP address and domain name validation
- Error Handling: Timeout protection and error recovery
- Python 3.6+
- nmap installed and accessible from command line
- Administrator privileges (recommended for SYN scans)
Windows:
# Download from https://nmap.org/download.html
# Or using chocolatey
choco install nmapLinux:
sudo apt-get install nmap # Ubuntu/Debian
sudo yum install nmap # CentOS/RHEL- Clone or download the script
- Run with Python:
python script.py- Follow the interactive prompts:
- Enter target IP address or domain name
- Select scan type (Fast/Full/Custom)
- Wait for results
- Port Range: 1-1000
- Use Case: Quick reconnaissance of common services
- Duration: ~30 seconds to 2 minutes
- Port Range: 1-30,000 (divided into 6 parallel chunks)
- Use Case: Comprehensive port discovery
- Duration: 5-30 minutes depending on target
- Port Range: User-defined
- Use Case: Targeted scanning of specific port ranges
- Duration: Varies based on range size
- SYN Scan (
-sS): Default for privileged users (faster, stealthier) - TCP Connect (
-sT): Fallback for non-privileged users - Service Detection (
-sV): Identifies service versions - No Ping (
-Pn): Bypasses host discovery - Timing (
-T4): Aggressive timing for faster scans - Retries (
--max-retries 2): Limited retries for efficiency
- Thread Pool: Up to 6 concurrent nmap processes
- Chunk Size: 5,000 ports per thread maximum
- Timeout: 5-minute timeout per port range
- Dynamic Workers: Adjusts worker count based on port ranges
=== Parallel Nmap Port Scanner ===
Enter IP address or domain to scan: example.com
Domain example.com resolved to IP: 93.184.216.34
Select scan type:
1. Fast (common ports: 1-1000)
2. Full (ports 1-30000)
3. Custom
Option (1-3): 1
Saving logs to: src/logs/nmap_scan_93_184_216_34_20250809_143022.txt
Starting scan with 1 parallel threads...
Elapsed time: 00:15 | Completed: 0/1
Scanning ports 1-1000...
--- Result for ports 1-1000 ---
Starting Nmap 7.94 ( https://nmap.org )
Nmap scan report for example.com (93.184.216.34)
Host is up (0.12s latency).
PORT STATE SERVICE VERSION
80/tcp open http nginx
443/tcp open https nginx
Scan completed in: 00:45
Logs saved to: src/logs/nmap_scan_93_184_216_34_20250809_143022.txt
- Location:
src/logs/ - Format:
nmap_scan_[IP]_[TIMESTAMP].txt - Content: Complete nmap output with metadata
- Only scan networks you own or have explicit permission to test
- Respect rate limits and terms of service
- Use responsibly for legitimate security testing
- Ensure compliance with local laws and regulations
- Obtain proper authorization before scanning external networks
- Consider using in isolated lab environments
- Network reconnaissance phase
- Service enumeration
- Attack surface identification
- Finding non-standard ports (beyond 25565)
- Identifying server software versions
- Discovering auxiliary services (web panels, databases)
- Port exposure assessment
- Service inventory
- Vulnerability identification preparation
# Run as administrator (Windows)
# Run with sudo (Linux)
sudo python script.py# Verify nmap installation
nmap --version
# Add nmap to PATH if necessary- Check network connectivity
- Reduce port ranges for faster results
- Ensure target host is responsive
- Increase timeout value in
run_nmap()function - Check firewall settings on target
- Verify network stability
Edit the run_nmap() function to customize:
- Scan techniques (
-sS,-sT,-sU) - Timing templates (
-T1to-T5) - Additional options (
--script,-A,-O)
For Minecraft-specific scanning:
minecraft_ports = [25565, 25566, 25567, 19132, 19133, 8123]- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This tool is provided for educational and authorized security testing purposes only. Users are responsible for compliance with applicable laws and regulations.
This software is intended for legitimate security testing and educational purposes. The authors are not responsible for any misuse or damage caused by this tool. Always ensure you have proper authorization before scanning any network