Port Cat 🐱
A fast Rust CLI and PyO3-powered Python extension for testing connectivity, scanning port ranges, and detecting common services.
Features
- Connection Testing: Test connectivity to specific ports
- Port Scanning: Scan port ranges with concurrent execution
- Service Detection: Detect HTTP, SSH, FTP, SMTP, POP3, IMAP, Telnet, MySQL, PostgreSQL, Redis, and MongoDB
- Python Bindings:
connect_mode(sync) andscan_mode(async) exposed via PyO3 - Rich Connection Info: Connection details including buffers, keepalive, and remote address
- Detailed Logging: Configurable log levels for debugging
Installation
Rust CLI (from source)
The binary will be available at target/release/port_cat
Using Cargo
Python bindings (from source)
With Python 3.10+ and maturin installed:
Usage
Basic Connection Testing
Test connectivity to specific ports:
# Test default ports (80, 443) on localhost
# Test specific host and ports
# Test with custom timeout
Port Range Scanning
Scan a range of ports:
# Scan ports 1-1000
# Scan common ports
Python API
=
=
connect_mode returns a list of ConnectionInfo objects with connection metadata and detected service.
Command Line Options
USAGE:
port_cat [OPTIONS] [HOST]
ARGS:
<HOST> Host to connect to [default: localhost]
OPTIONS:
-p, --port <PORT> Port numbers (comma-separated) [default: 80,443]
-s, --scan <RANGE> Scan mode with port range (e.g., 1-1000)
-t, --timeout <TIMEOUT> Timeout in seconds [default: 5]
--debug-level <LEVEL> Log level [default: info] [possible values: error, warn, info, debug, trace]
-h, --help Print help
-V, --version Print version
Examples
Test Web Services
# Test if a website is accessible
Database Connectivity
# Test database connections
Port Scanning
# Quick scan of common ports
# Scan with debug output
SSH Connection Test
# Test SSH connectivity
Performance
Port Cat is designed for speed and efficiency:
- Concurrent Scanning: Multiple ports scanned simultaneously using async/await
- Fast Service Detection: Protocol-specific probes for accurate service identification
- Configurable Timeouts: Adjust timeout values for different network conditions
- Low Resource Usage: Efficient memory and CPU utilization
Service Detection Technology
The tool uses multiple detection methods:
- Banner Reading: Captures service banners automatically sent by servers
- Protocol Probing: Sends protocol-specific requests (HTTP, database handshakes, etc.)
- Response Analysis: Analyzes server responses to identify specific services
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.