A comprehensive, cross-platform port scanning tool designed for Windows and WSL environments. Features multi-threading, service detection, banner grabbing, and both CLI and GUI interfaces.
- Multi-threaded scanning for fast performance
- Service detection and banner grabbing
- Cross-platform compatibility (Windows & WSL)
- GUI and CLI interfaces for different use cases
- Configuration profiles with YAML/JSON support
- Profile-based scanning (quick-dev, web-audit, full-tcp, local-deep)
- Hierarchical config management with auto-discovery
- Network range scanning (CIDR notation support) with bounded host concurrency
- Export results to JSON/CSV/HTML/Markdown/XLSX formats
- Optional gzip compression for large JSON exports (.json.gz)
- Real-time progress tracking
- Comprehensive logging
- Built-in common port definitions
- Special focus on development ports (3000, 8000, etc.)
- Python 3.7 or higher
- PyYAML (for configuration file support) - install with
pip install PyYAML - tkinter for GUI (included with Python on Windows)
- No other external dependencies required (uses Python standard library)
# Clone or download the files to your desired directory
cd E:\Projects\Dev\Python\Important\PortMe
# Verify Python installation
python --version
# Install required dependencies
pip install PyYAML
# Run directly (no installation required)
python port_scanner.py --help# Navigate to your project directory
cd /mnt/e/Projects/Dev/Python/Important/PortMe
# Ensure Python3 is available
python3 --version
# Install dependencies
pip3 install PyYAML
# Run directly
python3 port_scanner.py --help# List available profiles
python port_scanner.py --list-profiles
# Create a sample configuration file
python port_scanner.py --create-config config.yaml
# Use a specific profile for scanning
python port_scanner.py -P quick-dev
# Use custom configuration file
python port_scanner.py -c /path/to/config.yaml -P web-audit
# Use profile with host override
python port_scanner.py -P local-deep -H 192.168.1.100# Scan common ports on localhost
python port_scanner.py -H localhost --common
# Scan specific ports
python port_scanner.py -H 192.168.1.1 -p 80,443,22,3000
# Scan port range
python port_scanner.py -H example.com -p 1-1000
# Quick check for your development server (port 3000) with banner grabbing
python port_scanner.py -H localhost -p 3000 --banner
# Scan with custom timeout and threading
python port_scanner.py -H 127.0.0.1 -p 3000-3010 --timeout 2 -w 50# Scan network range with bounded parallelism across hosts (16 by default)
python port_scanner.py -H 192.168.1.0/24 -p 22,80,443 --host-concurrency 16
# Export results to JSON
python port_scanner.py -H localhost --common -o results.json
# Export results to Markdown
python port_scanner.py -H localhost --common -o results.md
# Export results to Excel (XLSX)
python port_scanner.py -H localhost --common -o results.xlsx
# Export gzipped JSON (either extension or --gzip flag)
python port_scanner.py -H localhost --common -o results.json.gz
# or
python port_scanner.py -H localhost --common -o results.json --gzip
# Verbose logging with banner grabbing (banners only fetched when --banner is set)
python port_scanner.py -H target.com -p 80,443,8080 --banner -v
# Show closed ports in results
python port_scanner.py -H localhost -p 3000-3005 --show-closedLaunch the GUI:
# Windows
python port_scanner_gui.py
# WSL (requires X11 forwarding)
python3 port_scanner_gui.py- Modern Interface: Beautiful dark/light theme support with smooth transitions
- Statistics Dashboard: Real-time tracking of total scans, open ports, and performance metrics
- Profile management: Dropdown to select configuration profiles
- Configuration reload: π button to refresh configuration without restart
- Target configuration: Enter hostname or IP address (auto-populated from profiles)
- Port selection: Choose common ports or specify custom ranges
- Advanced options: Adjust timeout, thread count, banner grabbing
- Quick scan buttons: One-click scans for common scenarios
- Real-time results: Color-coded output with progress tracking
- Export functionality: Save results to JSON/CSV/HTML/Markdown/XLSX (JSON supports gzip)
- Keyboard Shortcuts: Fast navigation with Ctrl+S (Start), Ctrl+Q (Stop), Ctrl+E (Export), Ctrl+T (Theme Toggle)
- Toast Notifications: Non-intrusive status updates
- Responsive Design: Adapts to window resizing with flexible layouts
The Advanced Port Scanner now supports a comprehensive configuration and profile system that allows you to save common scanning configurations and reuse them easily.
The scanner automatically searches for configuration files in this order of precedence:
- Current Directory:
./config.yamlor./config.json - User Config Directory:
- Windows:
%APPDATA%/AdvancedPortScanner/config.yaml - Linux/WSL:
~/.config/AdvancedPortScanner/config.yaml
- Windows:
The scanner comes with several predefined profiles:
| Profile | Description | Ports | Features |
|---|---|---|---|
quick-dev |
Development ports scan | 3000, 3001, 5000, 8000, 8080, 9000 | Banner grabbing enabled |
web-audit |
Web server audit | 80, 443, 8080, 8443, 8000, 3000, 22, 21, 23 | 2s timeout, banner grabbing |
full-tcp |
Complete TCP scan | 1-65535 (all ports) | Slow scan, 50 workers, 3s timeout |
local-deep |
Deep localhost scan | 1-10000 | Shows closed ports, banner grabbing |
Create a config.yaml file with:
defaults:
timeout: 1.5
workers: 200
host_concurrency: 20
enable_banner: true
show_closed: false
ping_sweep: true
output_format: json
log_level: INFO
profiles:
quick-dev:
description: "Quick scan for common development ports"
ports: [3000, 3001, 5000, 8000, 8080, 9000]
enable_banner: true
web-audit:
description: "Scan for common web server and management ports"
ports: [80, 443, 8080, 8443, 8000, 3000, 22, 21, 23]
timeout: 2.0
enable_banner: true
custom-local:
description: "Custom localhost scan"
host: "localhost"
ports: "22,80,443,3000-3010"
enable_banner: true
show_closed: trueSettings are applied in this priority order (highest to lowest):
- Command Line Arguments (highest priority)
- Profile Settings
- Configuration File Defaults
- Hard-coded Defaults (lowest priority)
This means you can set defaults in your config file, override them with a profile, and still override specific settings with command-line flags.
If you're experiencing issues with port 3000 (common development port), try these solutions:
# Windows
netstat -an | findstr :3000
# WSL/Linux
netstat -tlnp | grep :3000
# or
ss -tlnp | grep :3000# Test with the port scanner
python port_scanner.py -H localhost -p 3000 --banner --timeout 5
# Or use the GUI "Scan Port 3000" button- Service not running: Start your development server
- Firewall blocking: Check Windows Firewall/WSL firewall rules
- Binding issues: Service might be bound to 127.0.0.1 vs 0.0.0.0
- Port already in use: Another process might be using port 3000
# Check WSL port forwarding (Windows 11)
netsh interface portproxy show all
# Add port forwarding if needed (run as Administrator in Windows)
netsh interface portproxy add v4tov4 listenport=3000 listenaddress=0.0.0.0 connectport=3000 connectaddress=127.0.0.1python port_scanner.py -H localhost -p 3000,3001,8000,8080,5000 --bannerpython port_scanner.py -H 192.168.1.0/24 --common -o network_audit.jsonpython port_scanner.py -H target.com -p 80,443,22,21,25 --banner -v================================================================================
SCAN RESULTS FOR localhost
================================================================================
PORT STATUS SERVICE BANNER
--------------------------------------------------------------------------------
22 OPEN SSH SSH-2.0-OpenSSH_8.2p1
80 OPEN HTTP HTTP/1.1 200 OK
3000 OPEN Node.js/Development HTTP/1.1 200 OK
443 FILTERED HTTPS
Summary: 3 open ports found out of 4 scanned
[
{
"host": "localhost",
"port": 3000,
"status": "OPEN",
"service": "Node.js/Development",
"banner": "HTTP/1.1 200 OK",
"response_time": 0.023
}
]# Scan Results
_Generated: 2025-01-01 12:34:56_
Made with loveee <3 :3
| Host | Port | Proto | Status | Service | ServiceVersion | Conf | Banner | RespTime | PID | Process | LocalAddr | WSL | Docker |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| localhost | 3000 | TCP | OPEN | Node.js/Development | | 0.90 | HTTP/1.1 200 OK | 0.023 | 12345 | node | 127.0.0.1 | no | |- Produces a
Resultsworksheet with a bold, centered title: βScan Results - Made with loveee <3 :3β. - Columns include: Host, Port, Protocol, Status, Service, ServiceVersion, Confidence, Banner, ResponseTime, PID, Process, ProcessPath, LocalAddress, IsWSL, WSLDistro, WSLProcess, WSLPath, DockerContainer, DockerImage, DockerContainerID.
- Columns are auto-sized (capped) and headers are frozen for easy scrolling.
- Use a filename ending with
.json.gz(or.gz) or pass--gzipwith a.jsonfilename. - Useful for reducing file size for large scans.
| Parameter | Description | Default |
|---|---|---|
-c, --config |
Path to configuration file | Auto-detect |
-P, --profile |
Configuration profile to use | None |
--list-profiles |
List available profiles and exit | - |
--create-config |
Create sample configuration file and exit | - |
| Parameter | Description | Default |
|---|---|---|
-H, --host |
Target host or network | Required (or from profile) |
-p, --ports |
Ports to scan | Common ports |
--common |
Scan common ports only | False |
-t, --timeout |
Socket timeout (seconds) | 1.0 (or from config) |
-w, --workers |
Max worker threads | 100 (or from config) |
--host-concurrency |
Max concurrent host scans for network ranges | 16 (or from config) |
--banner |
Enable banner grabbing | False (or from config) |
--show-closed |
Show closed/filtered ports in results | False (or from config) |
--no-ping |
Skip ping sweep for network scans | False (or from config) |
--udp |
Enable UDP scanning in addition to TCP | False (or from config) |
-o, --output |
Export file (supports .json, .json.gz, .csv, .html, .md, .xlsx) | None |
--gzip |
Compress JSON output (implied when -o ends with .gz) |
False |
-v, --verbose |
Enable verbose logging | False |
--async |
Use async I/O for better performance | False |
- Banners are fetched only when
--banneris specified (CLI) or the "Enable Banner Grabbing" checkbox is checked (GUI). This avoids unnecessary I/O when disabled. - The GUI features a real Stop Scan button that cooperatively cancels ongoing scans. Scans halt shortly after pressing stop and the UI returns to an idle state.
- Network range scans are parallelized across hosts with a bounded level of concurrency to avoid overwhelming the system. Use
--host-concurrencyto tune. - Total concurrency during network scans is approximately
host_concurrency * workers(per-host threads). Choose balanced values to keep CPU and the target stable. - macOS (Darwin) ping sweep uses
-Win milliseconds; Linux uses seconds; Windows uses-win milliseconds. Ifpingis not available, hosts are treated as offline without crashing. - CSV exports open files with
newline=''to prevent extra blank lines on Windows.
- This tool is for legitimate network analysis and debugging
- Always obtain proper authorization before scanning networks
- Be mindful of thread count to avoid overwhelming target systems
- Logs are created in the current directory (
port_scanner.log)
- Run as Administrator on Windows if scanning privileged ports (< 1024)
- Use
sudoon Linux/WSL for privileged operations
- Reduce worker thread count (
-w 50) for slower systems - Increase timeout (
-t 2.0) for slow networks
- Ensure X11 forwarding is enabled
- Install X server on Windows (like VcXsrv)
- Set DISPLAY environment variable
Logs are automatically created as port_scanner.log with:
- Scan start/end times
- Error messages
- Debug information (with
-vflag)
Feel free to enhance this tool with:
- Additional service detection
- More export formats
- Enhanced GUI features
- Performance optimizations
This project is provided as-is for educational and legitimate network analysis purposes.