A completely anonymous, end-to-end encrypted chat application for Linux with no user registration required.
- Complete Anonymity: No usernames, emails, or personal information required
- End-to-End Encryption: All messages encrypted with RSA-2048 and Fernet (AES-128)
- Encrypted Direct Messages: Private encrypted conversations between users
- Encrypted Broadcasts: Send encrypted messages to all connected users
- Secure Key Exchange: Automatic RSA-based key exchange for establishing secure channels
- No Data Storage: Server only relays encrypted messages, stores nothing
- Anonymous IDs: Random 16-character hex IDs assigned to each connection
- RSA-2048 Key Pairs: Each client generates a unique RSA key pair on startup
- Symmetric Encryption: Messages encrypted with Fernet (AES-128 in CBC mode)
- Key Exchange: Symmetric keys exchanged using RSA public key encryption
- Zero Server Knowledge: Server cannot decrypt any messages
- No user registration or authentication
- No message logging or storage
- Anonymous connection IDs
- No IP address tracking in application layer
- Fresh encryption keys on each session
- Python 3.7 or higher
- pip package manager
- tkinter (for GUI mode only)
- Install Python dependencies:
pip install -r requirements.txt- For GUI mode, install tkinter (if not already installed):
# Ubuntu/Debian
sudo apt install python3-tk
# Fedora
sudo dnf install python3-tkinter
# Arch Linux
sudo pacman -S tk- Make scripts executable:
chmod +x server.py client.py client_gui.pypython3 server.pyThe server automatically broadcasts its presence on the local network for client discovery.
SecureChat offers both a GUI and CLI interface:
python3 client_gui.pyThe GUI provides:
- Visual server discovery and connection management
- Real-time message display with color-coded messages
- Online users list with click-to-DM functionality
- Easy switching between broadcast and direct message modes
- Modern dark theme interface
python3 client.pyCLI options:
python3 client.py --help # Show help
python3 client.py --host 192.168.1.10 # Connect to specific host
python3 client.py --port 8888 # Use custom port
python3 client.py --no-discover # Skip auto-discoveryBoth clients will automatically discover and connect to available servers on your local network. If no servers are found, they will attempt to connect to localhost:9999 as a fallback.
- Server Discovery: Click "Discover" to find servers on local network
- Connect/Disconnect: Toggle connection with the "Connect" button
- Send Message: Type in the input field and press Enter or click "Send"
- Message Type: Select "Broadcast" for all users or "Direct Message" for private chat
- User Selection: Click a user in the list to set them as DM target, double-click to switch to DM mode
Once connected, you can use these commands:
-
Send broadcast message: Just type your message and press Enter
Hello everyone! -
Send direct message: Use
/dmcommand/dm <user_id> <message>Example:
/dm a1b2c3d4 This is a private message -
List online users: See who's connected
/users -
Show help: Display available commands
/help -
Quit: Exit the chat
/quit
- Client connects to server
- Server assigns random anonymous ID
- Client generates RSA key pair
- Client sends public key to server
- Server broadcasts user list with public keys
- Client can now send encrypted messages
- Client encrypts message with their symmetric key
- Encrypted message sent to server
- Server relays to all other clients
- Clients decrypt using sender's shared encryption context
- Client initiates DM to target user
- Client encrypts their symmetric key with target's RSA public key
- Encrypted key sent through server to target
- Target decrypts symmetric key with their RSA private key
- Secure channel established for direct messaging
- All subsequent DMs use the shared symmetric key
If running on a server, ensure port 9999 is open:
# UFW (Ubuntu/Debian)
sudo ufw allow 9999/tcp
# firewalld (CentOS/RHEL)
sudo firewall-cmd --permanent --add-port=9999/tcp
sudo firewall-cmd --reload
# iptables
sudo iptables -A INPUT -p tcp --dport 9999 -j ACCEPTModify the port in both server and client, or pass as argument:
# Server
python3 server.py # Edit port in code or add CLI args
# Client
python3 client.py localhost 8888- End-to-end encryption of all messages
- Anonymous communication (no identity required)
- Protection against eavesdropping
- Secure key exchange
- Protection against server operator seeing connection metadata (IP addresses, timing)
- Protection against network-level traffic analysis
- Forward secrecy (keys not rotated during session)
- Authentication of users (anyone can connect)
- Protection against man-in-the-middle if server is compromised
- Use VPN: Additional layer of network privacy
- Trusted Server: Only connect to servers you trust
- Verify Keys: In high-security scenarios, verify public keys out-of-band
- Ephemeral Sessions: Disconnect and reconnect frequently for fresh keys
- cryptography: Python cryptography library (pyca/cryptography)
- RSA: 2048-bit keys with OAEP padding
- Fernet: Symmetric encryption (AES-128-CBC + HMAC)
- Hashing: SHA-256
All messages are JSON-encoded:
{
"type": "broadcast|direct|key_exchange|system",
"from": "sender_anonymous_id",
"encrypted_data": "base64_encoded_encrypted_message",
"timestamp": "ISO8601_timestamp"
}- Transport: TCP sockets with asyncio
- Encoding: UTF-8
- Message Size: Up to 64KB per message
- Connection: Persistent TCP connection per client
- Ensure server is running
- Check firewall rules
- Verify correct IP and port
- Ensure you're using the same encryption session
- For DMs, key exchange must complete first
- Check for network interruptions
- Check Python version (3.7+ required)
- Verify cryptography library is installed
- Check system resources (memory, file descriptors)
securechat/
├── server.py # Server implementation
├── client.py # CLI client interface
├── client_gui.py # GUI client interface (tkinter)
├── core.py # Shared client core (encryption, networking)
├── requirements.txt # Python dependencies
├── README.md # This file
└── SETUP.md # Detailed setup guide
The client is split into three components:
- core.py: Contains
CryptoManager,ServerDiscovery, andSecureChatClientCore- shared between GUI and CLI - client.py: CLI wrapper with colored terminal output
- client_gui.py: GUI wrapper using tkinter
- Add file transfer: Implement chunked encrypted file sending
- Add rooms: Create separate encrypted chat rooms
- Add authentication: Optional identity verification
- Add forward secrecy: Implement key rotation
- Add persistence: Optional encrypted message history
This software is provided for educational and privacy purposes. Users are responsible for compliance with local laws and regulations regarding encryption and anonymous communication. The authors assume no liability for misuse.