| Crates.io | port_cat |
| lib.rs | port_cat |
| version | 0.2.0 |
| created_at | 2025-09-24 07:24:40.753204+00 |
| updated_at | 2026-01-19 20:50:27.400579+00 |
| description | A Rust CLI and Python extension for connectivity checks, port scanning, and service detection. |
| homepage | |
| repository | https://github.com/guangyu-he/port_cat |
| max_upload_size | |
| id | 1852651 |
| size | 43,546 |
A fast Rust CLI and PyO3-powered Python extension for testing connectivity, scanning port ranges, and detecting common services.
connect_mode (sync) and scan_mode (async) exposed via PyO3git clone https://github.com/guangyu-he/port_cat.git
cd port_cat
cargo build --release
The binary will be available at target/release/port_cat
cargo install --path .
With Python 3.10+ and maturin installed:
maturin develop --features python
Test connectivity to specific ports:
# Test default ports (80, 443) on localhost
port_cat
# Test specific host and ports
port_cat example.com -p 22,80,443
# Test with custom timeout
port_cat example.com -p 22 -t 10
Scan a range of ports:
# Scan ports 1-1000
port_cat example.com -s 1-1000
# Scan common ports
port_cat example.com -s 1-65535
import asyncio
from port_cat import connect_mode, scan_mode
connections = connect_mode(ports=[22, 80], host="example.com", timeout=5)
open_ports = asyncio.run(scan_mode(host="example.com", scan_range="1-1024"))
connect_mode returns a list of ConnectionInfo objects with connection metadata and detected service.
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
# Test if a website is accessible
port_cat google.com -p 80,443
# Test database connections
port_cat db.example.com -p 3306,5432,6379
# Quick scan of common ports
port_cat target.com -s 1-1024
# Scan with debug output
port_cat target.com -s 20-25 --debug-level debug
# Test SSH connectivity
port_cat server.example.com -p 22
Port Cat is designed for speed and efficiency:
The tool uses multiple detection methods:
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.