DEV Community

Divyanshu Sinha
Divyanshu Sinha

Posted on

Build a Secure XOR-Encrypted Chat Client in Python with Pythonaibrain-Client (1.0.4)

Pythonaibrain-Client

Secure Encrypted Socket Client powered by Pythonaibrain v1.1.9

pythonaibrain-client is a Python terminal chat client that enables secure, encrypted, multi-client communication using XOR encryption. It works seamlessly with Pythonaibrain v1.1.9 server, supporting AI-enabled or regular chat.


πŸš€ Features

  • Secure messaging with XOR cipher encryption
  • Supports multiple clients (2, 3, or more) on the same server
  • Multi-threaded send/receive for real-time chatting
  • Cross-platform terminal commands (clear / cls)
  • Easy CLI usage via client-server
  • Optional GUI integration using Tkinter, PySide6, or CustomTkinter
  • Emoji reactions, private messages, typing indicators
  • Daily chat logs for persistent storage

πŸ“ Project Structure


pythonaibrain-client/
β”œβ”€β”€ pyaibrain/
β”‚   └── client/
β”‚       β”œβ”€β”€ **init**.py       # Main client code
β”‚       └── .env              # Encryption key, host, and port
β”œβ”€β”€ pyproject.toml            # Project metadata & dependencies
β”œβ”€β”€ README.md                 # This file
└── LICENSE                   # MIT License

Enter fullscreen mode Exit fullscreen mode

⚑ Getting Started

Prerequisites

  • Python 3.8 or higher
  • pip installed

Installation

pip install pythonaibrain-client
Enter fullscreen mode Exit fullscreen mode

Connecting to the Server

  1. Install pythonaibrain v1.1.9 which contains the AI server.
  2. Start the server:
pyaibrain-server   # For normal chat
Enter fullscreen mode Exit fullscreen mode
  1. Run the client:
client-server
Enter fullscreen mode Exit fullscreen mode
  1. Enter your alias and start chatting securely.

πŸ“ Usage Example

from pyaibrain.client import ClientServer

cServer = ClientServer()
cServer.serve()
Enter fullscreen mode Exit fullscreen mode

πŸ› οΈ Commands

Command Description
clear / cls Clear terminal screen
/pm <alias> <msg> Send private message
/list Show connected clients
/about Show client info
/quit Disconnect from server
/react <alias> <emoji> React to last message

πŸ” Encryption Details

  • Messages are XOR-encrypted using the key from .env.
  • Note: XOR is for demonstration; use stronger encryption for production.

πŸ‘€ Preview

Chat Preview 1
Chat Preview 2


✍️ Author

Divyanshu Sinha
Email: divyanshu.sinha136@gmail.com


πŸ“„ License

GNU LESSER GENERAL PUBLIC LICENSE β€” see License
for details.

This version emphasizes:

  • Compatibility with pythonaibrain v1.1.9.
  • Multi-client encrypted chat.
  • AI server optional usage.

Top comments (0)