This project started as a school assignment, but I ended up having a lot of fun with it. The original task was to create a simple Client/Server Python program, where one computer would act as the Server, and other computers would connect as Clients. Essentially, this required writing two sets of code: one for the Client and one for the Server.

However, we decided to take it a step further. Instead of just connecting two computers over the university's Wi-Fi, we set up a Server on a Raspberry Pi 5 at home and connected to it via the Internet (WAN). The result was a secure and functional chat application, complete with encrypted messaging using SSL/TLS to protect data during transmission. We successfully connected four devices, chatted in a general chatroom, and even sent private messages (whispers) between users.

In addition to the basic chat functionality, we also implemented features like sound notifications for events such as login, logout, and message receipts, and ensured that only authenticated users could access the chat.

This Project was a lot of fun and actually inspired me to try and learn how to set up the Preeda Database.

Features:

Secure Communication:

  • Encrypted Messaging: All communications are encrypted using SSL/TLS, ensuring data transmitted between users is protected from unauthorized access.

  • Private Messaging: Users can send direct, private messages within the chat for confidential communication.

User Authentication:

  • Authenticated Access: Only authenticated users can participate in the chat, ensuring that only authorized individuals have access to the platform.

  • Credential Security: User credentials are securely stored in a JSON file with passwords hashed using SHA-256 for added security.

Sound Notifications:

  • Event Alerts: Receive sound notifications for various events, including login, logout, private messages, and normal messages, enhancing the user experience.

System Architecture

  • Client-Server Model: The application uses a client-server model where the server handles user authentication, message broadcasting, and private messaging.

How to Use:

Login Securely: Start by logging into the application using your credentials to gain access to the chat.

Send and Receive Messages: Use the chat interface to broadcast messages to all users in the general chat or send private messages to specific users for more confidential communication.

User Commands: As a user, you can interact with the chat application using the following commands:

  • /msg [username] [message]: Send a private message to a specific user.

  • /logout: Log out from the chat application.

  • /who: List all users currently online in the chat.

  • /whisper [username] [message]: Send a private message (whisper) to a specific user without others seeing it.

  • /help: Display a list of available commands for quick reference.

Admin Controls: As an admin, you have additional control over the chat environment. Here are the commands you can use:

  • /adduser [username] [password]: Add a new user to the chat by specifying their username and password.

  • /listusers: View a list of all registered users currently in the system.

  • /logoutuser [username]: Forcefully disconnect a specific user from the chat.

  • /shutdown: Safely shut down the server, ending all active sessions and connections.

Technologies Used:

  • Python: The application is developed using Python, chosen for its simplicity and powerful libraries.

  • Socket & SSL: Libraries like socket are used for network communication, and ssl for securing connections.

  • Playsound: A simple library used for playing sound notifications across different platforms.

  • JSON: Used for storing and managing user credentials securely. The credentials are encrypted and stored in JSON format, with passwords hashed using SHA-256, ensuring that sensitive information is protected and remains secure.

Previous
Previous

Preeda Database Alternative (Android App)