the project provides backend and frontend for checking ip address and port
Find a file
2025-08-02 21:26:45 +03:00
.github/workflows [u] add target 2025-03-07 19:07:18 +03:00
static [u] scroll bar 2025-03-10 03:44:06 +03:00
templates [r] rename 2025-08-02 21:26:45 +03:00
.gitignore [+] init project 2024-12-29 22:23:03 +03:00
dockerfile [f] download nmap 2025-03-07 19:57:45 +03:00
main.py [u] use nmap 2024-12-31 02:37:07 +03:00
pyproject.toml [r] pyright migration to pyproject 2025-03-07 19:14:04 +03:00
readme.md [r] rename 2025-08-02 21:26:45 +03:00
uv.lock [r] uv conversion 2025-03-07 19:06:46 +03:00

check-host

A Python application using FastAPI to check your public IP address and verify if a specified port is open. This app provides a web interface and an API for checking the IP address and port status.

Initial Setup

  1. Clone the repository: Clone this repository using git clone.
  2. Create Virtual Env: Create a Python Virtual Env venv to download the required dependencies and libraries.
  3. Download Dependencies: Download the required dependencies into the Virtual Env venv using uv.
git clone https://github.com/ergolyam/check-host.git
cd check-host
python -m venv .venv
.venv/bin/python -m pip install uv
.venv/bin/python -m uv sync

Deploy

  • Run:
    PORT="8000" RELOAD="True" uv run main.py
    

Container

  • Pull container:

    podman pull ghcr.io/ergolyam/check-host:latest
    
  • Deploy in container

    podman run -d \
    --name check-host \
    --cap-add=NET_RAW \
    --cap-add=NET_ADMIN \
    --network host \
    -e PORT="8000" \
    ghcr.io/ergolyam/check-host:latest
    

Proxy on nginx

  • Create a file /etc/nginx/sites-enabled/example.com with the lines:
    server {
        listen 80 default;
        listen [::1]:80 default;
        server_name example.com;
    
        location / {
            proxy_pass http://[::1]:8000/;
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }
    

Usage

API Endpoints

  • Get your public IP:

    curl http://localhost:8000/myip
    
    • Response:
      {
          "ip": "your-public-ip"
      }
      
  • Check a port's status:

    curl http://localhost:8000/check-port/80
    
    • Response
      {
          "host": "your-public-ip",
          "port": 80,
          "status": "open/closed/filtered/error"
      }
      

Features

  • Display the client's public IP address.
  • Check the status of a specific port (open, closed, or filtered).
  • Simple and user-friendly web interface.
  • API endpoints for programmatic access.