Skip to content

Garuda8887/PortScout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PortScout TUI

A fast, interactive terminal UI for scanning ports, identifying what's in use, and reserving free ports for your projects.
Built with Textual — runs entirely in your terminal with no browser required.


Banner


Features

  • 🔍 Port Scanning: Scans any range of ports (1–65535) to find what's free and what's occupied
  • 🖥️ Process Info: Shows the PID and process name for every used port (requires psutil)
  • 📦 Range Compression: Free ports are displayed as grouped ranges (e.g. 8080–8095) for easy reading
  • Parallel Scanning: 300-thread concurrent scanning — a full range scan completes in seconds
  • 🎯 Smart Recommendations: Suggests the best available ports, with optional contiguous-block preference
  • 🚫 Port Exclusions: Exclude specific ports or ranges from results (e.g. 22,80,8000-8010)
  • 💾 Reservations: Save ports to ~/.portscout/reservations.yaml with an optional note
  • ⌨️ Keyboard Driven: Full keyboard control, no mouse required

Demo & Usage

1. Launch PortScout

python portscout.py

2. Two-column view

The left column shows used ports with their PID and process name.
The right column shows free ports grouped into contiguous ranges.

Main View

3. Change the scan range

Press g to open the range dialog and enter your start and end ports.

Range Dialog

4. Set exclusions

Press x to exclude specific ports or ranges from the scan. Useful for skipping well-known ports you'll never use.

Exclusions

5. Recommendations

The bottom panel always shows your best available ports. Press c to switch to contiguous-block mode — useful when your app needs several ports in sequence.

Recommendations

6. Reserve a port

Press v to reserve the top recommended port with an optional note. Saved to disk so you don't forget which port you earmarked for which project.


Installation

Requirements

  • Python 3.10+
  • pip

Install Dependencies

pip install -r requirements.txt

requirements.txt:

textual
psutil
pyyaml

psutil is optional but strongly recommended — without it, used ports won't show process names or PIDs.


Keyboard Shortcuts

Key Action
r Rescan the current port range
g Change the scan range
x Set port exclusions
c Toggle contiguous-block preference
v Reserve the top recommended port
h Show help
q Quit

Usage Tips

  • Default scan range is 1024–9999. You can widen it to 1–65535 but scans take longer.
  • Use exclusions to skip ports you know are always occupied on your machine (e.g. 22,5432,6379).
  • Contiguous mode is handy for apps that need a block of ports in sequence (e.g. a cluster of microservices).
  • Reservations are stored in ~/.portscout/reservations.yaml — they're a personal record, not an OS-level lock.
  • Works on Windows, Linux, and macOS.

How Scanning Works

PortScout attempts to bind a TCP socket to each port in the range. A successful bind means the port is free; a failure means something is already listening there. All binds run concurrently across a thread pool, so even large ranges finish in a few seconds.

Note: There is a small gap between scanning and actual use — a port that shows as free could be taken by the time you start your server. Always handle address already in use in your own code.


License

MIT License


Credits

  • Built with Textual by Textualize
  • Process info powered by psutil
  • Reservations stored with PyYAML

Disclaimer

  • This tool only scans ports on your own machine (binds to 0.0.0.0 locally).
  • It does not perform network reconnaissance or scan remote hosts.
  • The author is not responsible for any misuse.

About

Interactive terminal UI for scanning ports, identifying what's in use, and reserving free ports — built with Textual.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages