Skip to content
ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

154 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค CMD-CHAT

encrypted terminal chat. no servers. no logs. ram only.

License: MIT Python 3.8+


peer-to-peer encrypted chat that runs in your terminal. you host, you control. close the window โ€” everything's gone.

why

every "secure" messenger still stores metadata somewhere. this doesn't. it's just two terminals talking over an encrypted tunnel. nothing written to disk, ever.

how it works

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                        SRP AUTHENTICATION                        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                  โ”‚
โ”‚  CLIENT                                         SERVER           โ”‚
โ”‚    โ”‚                                              โ”‚              โ”‚
โ”‚    โ”‚โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• TCP CONNECT โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ–บโ”‚              โ”‚
โ”‚    โ”‚                                              โ”‚              โ”‚
โ”‚    โ”‚โ”€โ”€โ”€ {"cmd":"srp_init","username","A"} โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚              โ”‚
โ”‚    โ”‚         (A = client public ephemeral)        โ”‚              โ”‚
โ”‚    โ”‚                                              โ”‚              โ”‚
โ”‚    โ”‚โ—„โ”€โ”€โ”€โ”€ {"user_id","B","salt","room_salt"} โ”€โ”€โ”€โ”€ โ”‚              โ”‚
โ”‚    โ”‚         (B = server public ephemeral)        โ”‚              โ”‚
โ”‚    โ”‚                                              โ”‚              โ”‚
โ”‚    โ”‚  [client derives room_key via HKDF:          โ”‚              โ”‚
โ”‚    โ”‚   room_key = HKDF(password, room_salt)]      โ”‚              โ”‚
โ”‚    โ”‚                                              โ”‚              โ”‚
โ”‚    โ”‚โ”€โ”€โ”€ {"cmd":"srp_verify","user_id","M"} โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚              โ”‚
โ”‚    โ”‚         (M = client proof)                   โ”‚              โ”‚
โ”‚    โ”‚                                              โ”‚              โ”‚
โ”‚    โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ {"H_AMK","session_key"} โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚              โ”‚
โ”‚    โ”‚         (H_AMK = server proof)               โ”‚              โ”‚
โ”‚    โ”‚                                              โ”‚              โ”‚
โ”‚    โ”‚  [password never transmitted]                โ”‚              โ”‚
โ”‚    โ”‚  [MITM can't derive session key]             โ”‚              โ”‚
โ”‚    โ”‚                                              โ”‚              โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                 E2E ENCRYPTED CHAT (same socket)                 โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚    โ”‚                                              โ”‚              โ”‚
โ”‚    โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€ {"type":"init","messages","users"} โ”€ โ”‚              โ”‚
โ”‚    โ”‚                                              โ”‚              โ”‚
โ”‚  โ”Œโ”€โ”ดโ”€โ”                                        โ”Œโ”€โ”€โ”ดโ”€โ”€โ”            โ”‚
โ”‚  โ”‚ C โ”‚โ”€ {"type":"message","text":encrypted} โ”€โ–บโ”‚  S  โ”‚            โ”‚
โ”‚  โ”‚ L โ”‚                                        โ”‚  E  โ”‚            โ”‚
โ”‚  โ”‚ I โ”‚โ—„โ”€โ”€ {"type":"message","data":{...}} โ”€โ”€โ”€โ”€โ”‚  R  โ”‚            โ”‚
โ”‚  โ”‚ E โ”‚                                        โ”‚  V  โ”‚            โ”‚
โ”‚  โ”‚ N โ”‚โ—„โ”€โ”€ {"type":"user_joined",...} โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚  E  โ”‚            โ”‚
โ”‚  โ”‚ T โ”‚                                        โ”‚  R  โ”‚            โ”‚
โ”‚  โ”‚   โ”‚โ—„โ”€โ”€ {"type":"user_left",...} โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚     โ”‚            โ”‚
โ”‚  โ””โ”€โ”ฌโ”€โ”˜                                        โ””โ”€โ”€โ”ฌโ”€โ”€โ”˜            โ”‚
โ”‚    โ”‚                                              โ”‚              โ”‚
โ”‚    โ”‚  [server stores ONLY ciphertext]             โ”‚              โ”‚
โ”‚    โ”‚  [server CANNOT read messages]               โ”‚              โ”‚
โ”‚    โ”‚  [all clients with same password             โ”‚              โ”‚
โ”‚    โ”‚   derive identical room_key]                 โ”‚              โ”‚
โ”‚    โ”‚                                              โ”‚              โ”‚
โ”‚    โ”‚  Encryption: Fernet (AES-128-CBC + HMAC)     โ”‚              โ”‚
โ”‚    โ”‚  Key derivation: HKDF-SHA256                 โ”‚              โ”‚
โ”‚    โ”‚  Protocol: newline-delimited JSON over TCP   โ”‚              โ”‚
โ”‚    โ”‚                                              โ”‚              โ”‚
โ”‚    โ”‚  [on disconnect: keys wiped from RAM]        โ”‚              โ”‚
โ”‚    โ”‚                                              โ”‚              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      KEY HIERARCHY                               โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                  โ”‚
โ”‚  password โ”€โ”€โ”ฌโ”€โ”€โ–บ SRP โ”€โ”€โ–บ session_key (per-user, auth only)       โ”‚
โ”‚             โ”‚                                                    โ”‚
โ”‚             โ””โ”€โ”€โ–บ HKDF(password, room_salt) โ”€โ”€โ–บ room_key (shared) โ”‚
โ”‚                                                                  โ”‚
โ”‚  room_salt: generated once at server start                       โ”‚
โ”‚  room_key:  deterministic, same for all clients with same pwd    โ”‚
โ”‚                                                                  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

SRP (Secure Remote Password) โ€” password is never sent over the network. both sides prove they know it via zero-knowledge proof, then derive identical session keys.

install

git clone https://github.com/emilycodestar/cmd-chat.git
cd cmd-chat
python -m venv venv && source venv/bin/activate && pip install -r requirements.txt

windows:

python -m venv venv ; .\venv\Scripts\activate ; pip install -r requirements.txt

usage

start server:

python cmd_chat.py serve 0.0.0.0 3000 --password mysecret

connect:

python cmd_chat.py connect SERVER_IP 3000 username mysecret

Example

features

  • ram only โ€” nothing touches disk
  • pure sockets โ€” no http, no websocket, just raw tcp
  • srp auth โ€” password never sent over network
  • e2e encryption โ€” Fernet (AES-128-CBC + HMAC)
  • zero dependencies on web frameworks โ€” only asyncio

license

MIT

About

My ISP tried to block this repo. ๐Ÿค A truly peer-to-peer, end-to-end encrypted CLI chat that leaves NO logs. Perfect for... sensitive discussions. ๐Ÿ”ฅ Get it before it gets taken down

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages