dsgnr / portchecker

Python package to query the ports for a given hostname or IP address. Back-end script used at https://portchecker.io

Home Page:https://portchecker.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Welcome to portcheckerio πŸ‘‹

PyPI PyPI - Python Version GitHub license Pytest CodeQL

This repository is the counterpart script which ports portchecker.io

This package is a nice alternative way to using tools like nc to query the port connectivity. The main benefits is that it will work with hostnames, IPv4 and IPv6 addresses (if your client has IPv6 of course). You can also query multiple ports at the same time and receive a sweet JSON response.

Installation

Portchecker can be installed from PyPI using pip or your package manager of choice:

pip install portcheckerio

Usage

CLI

You can use Portchecker as a CLI tool using the portcheck command.

Example:

$ portcheck --host google.com --ports 443
{
    "2a00:1450:4009:815::200e": {
        "type": "ipv6",
        "results": [
            {
                "port": 443,
                "connectable": true
            }
        ]
    },
    "172.217.16.238": {
        "type": "ipv4",
        "results": [
            {
                "port": 443,
                "connectable": true
            }
        ]
    }
}

You can query multiple ports for a given host in the same command:

$ portcheck --host google.com --ports 443 22
{
    "172.217.16.238": {
        "type": "ipv4",
        "results": [
            {
                "port": 443,
                "connectable": true
            },
            {
                "port": 22,
                "connectable": false
            }
        ]
    },
    "2a00:1450:4009:815::200e": {
        "type": "ipv6",
        "results": [
            {
                "port": 443,
                "connectable": true
            },
            {
                "port": 22,
                "connectable": false
            }
        ]
    }
}

πŸ“ To Do

  • Add more tests
  • Add the option to query RFC1918 addresses
  • Add the option to increase the timeout limit

🏠 Homepage

✨ Demo

Author

πŸ‘€ Dan Hand

🀝 Contributing

Contributions, issues and feature requests are welcome.
Feel free to check issues page if you want to contribute.

Show your support

Give a ⭐️ if this project helped you!

Any donations to help the running of the site is hugely appreciated!

πŸ“ License

Copyright Β© 2019 Dan Hand.
This project is MIT licensed.



This README was generated with ❀️ by readme-md-generator

About

Python package to query the ports for a given hostname or IP address. Back-end script used at https://portchecker.io

https://portchecker.io

License:MIT License


Languages

Language:Python 100.0%