Skip to main content

End-to-end encrypted terminal chat using Diffie-Hellman key exchange and AES encryption

Project description

echat - Encrypted P2P Terminal Chat

A secure, end-to-end encrypted peer-to-peer chat application for your terminal. Built with Python using Diffie-Hellman key exchange and AES-256 encryption.

Features

  • ๐Ÿ”— True P2P Architecture - No central server, connect directly to peers
  • ๐Ÿ” Diffie-Hellman Key Exchange - Secure key agreement without sharing secrets
  • ๐Ÿ”’ AES-256 Encryption - Military-grade encryption using Fernet
  • ๐ŸŒ Network Support - Works over local networks (LAN)
  • ๐Ÿ’ฌ Full-Duplex - Send and receive messages simultaneously
  • ๐Ÿ–ฅ๏ธ Terminal-Based - No GUI needed, works in any terminal
  • ๐Ÿ“ Connection Requests - Accept or reject incoming connections

Installation

git clone https://github.com/manikanta-adupa/EncryptedTerminalChat.git
cd echat
pip install -e .

Usage

Start echat

Both users run the same command:

echat

What You'll See

==================================================
  echat - Encrypted P2P Terminal Chat
==================================================

  Your IP: 192.168.1.100
  Listening on port: 9999

  Share your IP with others to let them connect.
==================================================

Options:
  1. Connect to a peer (enter their IP)
  2. Wait for incoming connections
  3. Exit

Enter peer IP to connect, or press Enter to wait:

Connecting to a Peer

User A (initiator):

Enter peer IP to connect, or press Enter to wait: 192.168.1.101
Connecting to 192.168.1.101:9999...
Waiting for peer to accept...
Connection accepted!
Establishing secure connection...
Secure connection established!
==================================================
  You can now chat securely. Type 'exit' to quit.
==================================================

User B (receiver):

==================================================
  Incoming connection from 192.168.1.100
==================================================
Accept connection? (y/n): y
Establishing secure connection...
Secure connection established!
==================================================
  You can now chat securely. Type 'exit' to quit.
==================================================

Custom Port

echat -p 8888

How It Works

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   User A    โ”‚                    โ”‚   User B    โ”‚
โ”‚             โ”‚                    โ”‚             โ”‚
โ”‚  Listening  โ”‚   Connection Req   โ”‚  Listening  โ”‚
โ”‚  on :9999   โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚  on :9999   โ”‚
โ”‚             โ”‚                    โ”‚             โ”‚
โ”‚             โ”‚   Accept? (y/n)    โ”‚             โ”‚
โ”‚             โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚             โ”‚
โ”‚             โ”‚                    โ”‚             โ”‚
โ”‚             โ”‚   Key Exchange     โ”‚             โ”‚
โ”‚             โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚             โ”‚
โ”‚             โ”‚                    โ”‚             โ”‚
โ”‚             โ”‚  Encrypted Chat    โ”‚             โ”‚
โ”‚             โ”‚โ—„โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ–บโ”‚             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  1. Both users start echat - Each listens for incoming connections
  2. One user connects - Enters the other's IP address
  3. Accept/Reject - Receiver chooses to accept or reject
  4. Key Exchange - Diffie-Hellman establishes shared secret
  5. Secure Chat - All messages encrypted with AES-256

Security

  • โœ… Private keys never leave each machine
  • โœ… Shared secret computed independently on both sides
  • โœ… All messages encrypted with AES-256
  • โœ… Each session generates new keys
  • โœ… No central server - direct peer connection

Requirements

  • Python 3.8+
  • cryptography library

Contributing

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

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

echat-0.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

echat-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for echat-0.1.0.tar.gz
Algorithm Hash digest
SHA256 755da5b1ed980dbf0be3f70a76fd3de19480f37e5633da19cbb7a7dc5e452a49
MD5 b62a5ec68cf123c7f6c463e64b40f487
BLAKE2b-256 fdcc64d7401571a7c3a060b6ec37c9991c4704393e64e8541d1be77c332bd01c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: echat-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for echat-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da1762540ece920633660b2fb5b2123746a49cf81af3e45f4df47d331319f820
MD5 3adac1ff9aa5d09a8e5dbdf14fd20b33
BLAKE2b-256 edbf4ecf8e812cf9be5b38a550e1b2083d67cd308f92163e6dfac51c5d7ba0da

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