Skip to main content

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 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.0.tar.gz (4.5 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.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for philiprehberger_portcheck-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0f0340897451b6e6db732212acaa233831a86e6bb0a68e653752c6e14ab0103e
MD5 bc8b18f1180f956e28bebb01917394e5
BLAKE2b-256 4410bfd67bdd56162e641eec07cf424fe434b63b1cf8ef4d33380a7fc984f71e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philiprehberger_portcheck-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7ff5d299c7c2d13436b751bed4772d6795a343e1e63192176c5509a6bcd0ae2
MD5 7b9ab43b2f23ca78f651815198b3ff40
BLAKE2b-256 0a29fc5b8d0c00763c84e3cd935e282cf85de3f3ec39afac8af96acb6f79c869

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