Skip to main content

A powerful Python utility for checking port availability, monitoring port status, and diagnosing network services on your local system.

Project description

PyChkr

A powerful Python utility for checking port availability, monitoring port status, and diagnosing network services on your local system.

Features

  • Check port availability in ranges or specific ports
  • Detailed service information and port status
  • Real-time port monitoring
  • Common service ports quick check
  • Export results to JSON
  • Find available ports automatically
  • Command-line interface with rich output

Installation

# Install from PyPI
pip install pychkr

# Or install from source
git clone https://github.com/KidiXDev/port-checker.git
cd port-checker
pip install .

Quick Start

# Find first available port in default range (8000-9000)
pychkr

# Check if specific ports are available
pychkr --check 80,443,8080

# Scan a range and list all ports
pychkr --range 3000-3100 --list

# Check common service ports
pychkr --common

Usage

Basic Commands

Find first available port:

pychkr --range 8000-9000

Check specific ports:

pychkr --check 80,443,3306,5432

Check port ranges:

pychkr --check 8000-8010,9000-9005

Scanning & Listing

List all available and used ports:

pychkr --range 3000-3100 --list

Show detailed information (with service names):

pychkr --range 8000-8050 --list --detailed

Find multiple available ports:

pychkr --range 3000-4000 --count 5

Common Ports Check

Check standard service ports (HTTP, HTTPS, SSH, MySQL, PostgreSQL, Redis, etc.):

pychkr --common

Monitoring

Monitor ports for changes over time:

# Monitor ports every 5 seconds for 60 seconds
pychkr --monitor 8000,8080,3000

# Custom interval and duration
pychkr --monitor 80,443 --interval 10 --duration 300

Export Results

Save scan results to JSON:

pychkr --range 8000-9000 --list --export results.json
pychkr --common --export common-ports.json

Options

Option Description
--range START-END Port range to check (e.g., 8000-9000)
--check PORTS Check specific ports (comma-separated)
--common Check common service ports
--list List all available and used ports
--detailed Show detailed information with service names
--count N Find N available ports
--monitor PORTS Monitor ports for changes
--interval SEC Monitoring check interval (default: 5)
--duration SEC Monitoring duration (default: 60)
--host HOST Host address to bind to (default: 0.0.0.0)
--export FILE Export results to JSON file

Examples

DevOps scenario - Find ports for microservices:

pychkr --range 8000-8100 --count 10

Troubleshooting - Check if services are running:

pychkr --common --detailed

Development - Monitor port during deployment:

pychkr --monitor 3000,8080 --interval 5 --duration 120

Security audit - Scan for open ports:

pychkr --range 1-1024 --list --detailed --export scan-results.json

Quick check before starting a server:

pychkr --check 8000,8080,3000

Output Examples

Simple check:

First available port: 8000

Detailed scan:

==================================================
Available Ports (45)
==================================================
  8000
  8001
  8002
  ...

==================================================
Used Ports (5)
==================================================
  8080 (http-alt) [listening]
  3306 (mysql) [in use]
  ...

Summary: 45 available, 5 in use

Common ports check:

Port     Service              Status          Listening
============================================================
22       SSH                  ✓ available     ○
80       HTTP                 ✗ in use        ●
443      HTTPS                ✓ available     ○
3306     MySQL                ✗ listening     ●
...

Use Cases

  • Development: Find available ports for local services
  • DevOps: Verify port availability before deployments
  • Troubleshooting: Diagnose port conflicts
  • Monitoring: Track port status over time
  • Security: Audit open ports on systems
  • CI/CD: Automated port checking in pipelines

Requirements

  1. Clone the repository:

    git clone https://github.com/KidiXDev/port-checker.git
    cd port-checker
    
  2. Install in development mode:

    pip install -e .
    
  3. Run tests:

    python -m unittest discover tests
    

License

MIT License - See LICENSE for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Author

KidiXDev - @KidiXDev

Support

If you find this project useful, please consider giving it a ⭐️ on GitHub.

Version

Current version: 0.1.0

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

pychkr-0.1.1.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

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

pychkr-0.1.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file pychkr-0.1.1.tar.gz.

File metadata

  • Download URL: pychkr-0.1.1.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for pychkr-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cfb41c865e4a9144c6936f8f6322ce1990f73e1c71e34f108e67dcaf88aca8d3
MD5 bd39f261882a2d0d8ad87ef623d18de4
BLAKE2b-256 d5409b8b930088b191f887fd3575949dc6dcbaff93d824c7ce58b0bc6f9f6bac

See more details on using hashes here.

File details

Details for the file pychkr-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pychkr-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for pychkr-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c8a3e99bea761ffac7d1e580555a4f0bc4f6a34c094cdb0f23f7fb4250013468
MD5 3d936aa5ca388f707f65c50192b7a1c8
BLAKE2b-256 c4ad2592a0d68a70168e4288c7a85a6d3fcf98bbab47f04d1b196a43725a87d9

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