Skip to main content

Check if a port is open on a host

Project description

philiprehberger-portcheck

Tests PyPI version License

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 open
  • scan(host, ports, timeout=1.0, max_workers=50) — Scan multiple ports concurrently
  • wait_for(host, port, timeout=30, interval=1.0) — Block until port opens

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

philiprehberger_portcheck-0.1.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

philiprehberger_portcheck-0.1.3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file philiprehberger_portcheck-0.1.3.tar.gz.

File metadata

File hashes

Hashes for philiprehberger_portcheck-0.1.3.tar.gz
Algorithm Hash digest
SHA256 fcbe1225fcee02e230cb772478983bd84619ab6be6cc1a830e05d5a91ff3f949
MD5 35598332c9ee0e2a6f6b3ced38da99f6
BLAKE2b-256 bc3ac9e4643d21e436c3051bfa13344e70ac14a7ddcc05f6344b64c4c7859f95

See more details on using hashes here.

File details

Details for the file philiprehberger_portcheck-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for philiprehberger_portcheck-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5e01dbfabc2fbe83a18f4ad524bbe978dc016ea55b8ebf4ae1a3e5f5fb55d30e
MD5 8687f7817a433bbeccca1dacd4e9e1bc
BLAKE2b-256 01eb575e9aa864581a5aa6a796d4ae5632d5a6c9319b62fe7c146b40cc7550fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page