Check if a port is open on a host
Project description
philiprehberger-portcheck
Check if a port is open on a host.
Installation
pip install philiprehberger-portcheck
Usage
from philiprehberger_portcheck import is_open, scan, wait_for
# Single port check
is_open("localhost", 8080) # True/False
is_open("192.168.1.1", 22, timeout=2.0) # True/False
# Scan multiple ports
results = scan("localhost", ports=[80, 443, 8080, 5432])
for port, result in results.items():
if result.is_open:
print(f"Port {port}: open ({result.service})")
# Scan common ports
results = scan("localhost", ports="common")
# Wait for a port to become available
wait_for("localhost", 5432, timeout=30)
API
is_open(host, port, timeout=2.0)— Check if port is openscan(host, ports, timeout=1.0, max_workers=50)— Scan multiple ports concurrentlywait_for(host, port, timeout=30, interval=1.0)— Block until port opens
Development
pip install -e .
python -m pytest tests/ -v
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file philiprehberger_portcheck-0.1.5.tar.gz.
File metadata
- Download URL: philiprehberger_portcheck-0.1.5.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd43e8389616db67d1a6e8b283a3607e79d719c2a0483aaad243dfb116914638
|
|
| MD5 |
74ff980f77bd92f66733e6b36bae3d08
|
|
| BLAKE2b-256 |
f2cf83a3adfba40053b0d6ed85179dffe2fec13d2c8cb7bb1346170d9f0b98a0
|
File details
Details for the file philiprehberger_portcheck-0.1.5-py3-none-any.whl.
File metadata
- Download URL: philiprehberger_portcheck-0.1.5-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
325f349193946250c003aec71508ab4a9f4432bddad12deaf6ac4cbfb74e4579
|
|
| MD5 |
9c08a74c3297acde5b7b490736ca9b6b
|
|
| BLAKE2b-256 |
5320c030eb07e39ed8d64583d3a4063e51f0dcb27e6c0203000122b3b643b53c
|