Skip to main content

A P2P chat tunnel using WireGuard for private, terminal-based communication.

Project description

TermiTunnel User Guide

TermiTunnel is a peer-to-peer communication tool that creates a secure, encrypted tunnel for private chat sessions directly in your terminal, powered by WireGuard.


How It Works

  1. Registry Server: A central server acts as a phone book. It doesn't see or handle any communication, it just tells peers how to find each other.
  2. TermiTunnel CLI: The client tool you use to connect.
    • On init, it generates your unique cryptographic keys and registers you in the "phone book".
    • On connect, it gets the latest list of peers from the server and creates a local WireGuard configuration file.
  3. WireGuard: Once you activate the connection, WireGuard establishes a direct, end-to-end encrypted tunnel between you and the other peers. All communication from this point on is completely private.

Prerequisites

  1. Python: You need Python 3 installed.
  2. WireGuard Tools: You must have the wireguard-tools package installed.
    • macOS: brew install wireguard-tools
    • Debian/Ubuntu: sudo apt-get install wireguard-tools
  3. Project Files: You need access to the termitunnel directory.

Step-by-Step Usage

Important: All python3 commands should be run from the directory containing the termitunnel folder.

1. First-Time Setup (Run This Only Once)

Initialize your user profile. This creates your private keys and registers you with the server. Choose a unique username.

python3 termitunnel/client/termitunnel.py init --username <your-username>

2. Connect to the Network

Before chatting, you must connect. This is a two-step process.

First, generate the WireGuard config file. This fetches the latest peer list.

python3 termitunnel/client/termitunnel.py connect

Second, activate the secure tunnel. This requires administrator privileges.

# On macOS or Linux
sudo wg-quick up ~/.termitunnel/wg0.conf

You are now connected to the private network.

3. Chat with a Peer

You can see who is available on the network.

python3 termitunnel/client/termitunnel.py list-peers

To start a chat, get the commands for a specific user.

python3 termitunnel/client/termitunnel.py chat <username-of-peer>

The tool will give you two netcat commands. One person must listen and the other must connect.

  • Person A (Listen):
    nc -l 9999
    
  • Person B (Connect):
    nc <ip-of-person-a> 9999
    

Now, whatever you type in your terminal will appear in the other person's terminal. All communication is encrypted by WireGuard.

4. Disconnect from the Network

When you are finished, bring the tunnel down. This also requires administrator privileges.

sudo wg-quick down ~/.termitunnel/wg0.conf

For the Administrator

The registry server must be running on a machine that all users can access via its IP address or domain name. To start it, run the following command from within the termitunnel directory:

# Example:
uvicorn server.main:app --host 0.0.0.0 --port 8000

Users will then need to provide the server URL during initialization if it's not the default, for example: termitunnel init --username my-name --server http://<your-server-ip>:8000

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

termitunnel_cli-0.1.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

termitunnel_cli-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: termitunnel_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for termitunnel_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fe9be7055e6ff08a05cacf90c5414bd7a5ef95a5d307831b0af7e36216d4e5af
MD5 ec55043ca0dbb9ae6dc72f88d9d28a17
BLAKE2b-256 3518af9ad6d44bb6287b9a2a0f8d9a006bab6086c4516df5571fe00f9c19b414

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for termitunnel_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 42f23ace7502363677108328efead1a5ac9073ffe9ea697f6ed247b900a63cbf
MD5 7dfa71021466b40bcc22a30d7eaa9668
BLAKE2b-256 43a8a21baf2972ac53473b0a14c39c1ad571cc8fca4ceb616025e1ed06478974

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