Terminal-based LAN chat client with rooms, private messaging, and CTF flag detection
Project description
Drevoid LAN Chat Application
A robust terminal-based LAN chat application built with Python sockets, featuring room management, private messaging, CTF flag detection, and an interactive command shell.
๐ Features
Core Features
- Multi-user support - Handle multiple concurrent users
- Room management - Create and join public/private rooms
- Private messaging - Send direct messages to specific users
- Interactive shell - Command-based interface using Python's
cmdmodule - Real-time messaging - Instant message delivery
- User authentication - Username-based connection system
- CTF flag detection - Automatic detection and tracking of CTF flags
- Emoji support - Use emoji aliases in messages (e.g., :heart:, :fire:)
- Cross-platform notifications - Desktop notifications for important events
Advanced Features
- Public & Private Rooms - Create password-protected private rooms
- Room moderation - Kick and ban users (for moderators)
- Message history - Room event tracking
- User roles - Admin, Moderator, and User roles
- Connection management - Robust connection handling
- Colorized interface - ANSI color codes for better UX
- Server admin console - Administrative server management
- Thread-safe operations - Safe concurrent access to shared resources
๐ Project Structure
drevoid_client/
โโโ drevoid/
โ โโโ __init__.py # Package initialization
โ โโโ core/ # Core protocol and utilities
โ โ โโโ __init__.py
โ โ โโโ protocol.py # Message protocol, serialization, colors
โ โโโ client/ # Client-side modules
โ โ โโโ __init__.py
โ โ โโโ chat_client.py # Main client logic
โ โ โโโ connection.py # Connection management
โ โ โโโ flag_detector.py # CTF flag detection
โ โ โโโ message_handler.py # Message processing
โ โ โโโ room_manager.py # Room operations
โ โ โโโ shell.py # Interactive shell interface
โ โโโ server/ # Server-side modules
โ โ โโโ __init__.py
โ โ โโโ chat_server.py # Main server implementation
โ โโโ utils/ # Utility modules
โ โโโ __init__.py
โ โโโ emojis.py # Emoji alias system
โ โโโ notifications.py # Cross-platform notifications
โโโ tests/ # Test files
โโโ scripts/ # Utility scripts
โโโ docs/ # Documentation
โโโ start_client.py # Client entry point
โโโ start_server.py # Server entry point
โโโ install.py # Installation script
โโโ requirements.txt # Python dependencies
โโโ README.md # This file
โโโ LICENSE # License file
๐โโ๏ธ Quick Start
Installation
- Clone the repository:
git clone <repository-url>
cd drevoid_client
- Install dependencies (optional, uses only standard library):
pip install -r requirements.txt
- Install the
drevoidcommand globally (optional):
python install.py
Running the Server
python start_server.py
# Or with custom host/port
python start_server.py --host 0.0.0.0 --port 8891
Running the Client
python start_client.py
# Or with auto-connect
python start_client.py localhost 8891 myusername
3. Basic Usage
# Connect to server
> connect localhost 12345 myusername
# Join the general room
> join general
# Send a message
> Hello everyone!
# Create a private room
> create myroom private mypassword
# Send private message
> msg username Hey there!
# List available commands
> help
๐ฏ Commands Reference
Connection Commands
connect [host] [port] [username]- Connect to serverdisconnect- Disconnect from serverquit/exit- Exit the application
Room Management
join <room_name> [password]- Join a roomleave- Leave current roomcreate <room_name> [private] [password]- Create a roomrooms- List available roomsusers- List users in current room
Messaging
<message>- Send message to current roommsg <username> <message>- Send private messagepm <username> <message>- Send private message (alias)
Moderation (Moderators only)
kick <username>- Kick user from roomban <username>- Ban user from room
Utility
status- Show connection statusclear- Clear screenhelp- Show all commands
๐ฅ๏ธ Server Commands
While the server is running, you can use these commands:
help- Show server commandsstats- Show server statisticsusers- List connected usersrooms- List active roomsshutdown- Shutdown server
๐ ๏ธ Technical Details
Architecture
- Server: Multi-threaded server handling concurrent connections
- Client: Event-driven client with separate threads for sending/receiving
- Protocol: JSON-based message protocol with length prefixing
- Threading: Thread-safe data structures and proper synchronization
Message Types
CONNECT/DISCONNECT- Connection managementMESSAGE- Room messagesPRIVATE_MESSAGE- Direct messagesJOIN_ROOM/LEAVE_ROOM- Room managementCREATE_ROOM- Room creationLIST_ROOMS/LIST_USERS- Information queriesKICK_USER/BAN_USER- Moderation actionsNOTIFICATION- System notificationsSUCCESS/ERROR- Response messages
Security Features
- Password hashing for room protection
- User role management
- Ban/kick functionality
- Input validation and sanitization
๐จ Customization
Adding New Commands
- Add new message type to
common/protocol.py - Implement handler in
server/server.py - Add command method to client shell in
client/client.py
Extending Room Features
- Modify the
Roomclass inserver/server.py - Add new room properties and methods
- Update client commands as needed
๐ง System Requirements
- Python 3.6+
- No external dependencies (uses only standard library)
- Terminal with ANSI color support (optional, for colors)
๐ License
This project is open source and available under the MIT License.
๐ค Contributing
Feel free to fork this project and submit pull requests for improvements!
๐ Troubleshooting
Common Issues
Connection refused
- Check if server is running
- Verify host and port settings
- Check firewall settings
Messages not appearing
- Ensure you're connected and in a room
- Check network connectivity
- Restart client if needed
Permission denied errors
- Check user roles and permissions
- Ensure you're a moderator for kick/ban commands
Debug Mode
Add debug prints in the code to trace message flow and connection issues.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file drevoid-1.0.2.tar.gz.
File metadata
- Download URL: drevoid-1.0.2.tar.gz
- Upload date:
- Size: 26.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c43f94901ecdd6b3b26944b879c7f4f7a50600ca09553148e86f23b0ad4a5d1a
|
|
| MD5 |
e5b93b5aa5676c2281cab6b9443d22da
|
|
| BLAKE2b-256 |
affb3609f92bb38971c842c4ccc94c69950d3bae5a44c43a5d354aaaf1a16dae
|
File details
Details for the file drevoid-1.0.2-py3-none-any.whl.
File metadata
- Download URL: drevoid-1.0.2-py3-none-any.whl
- Upload date:
- Size: 26.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77baa7d4301f24747cdd93337bcabbb87468170c657c685e6c5d12eea11690b0
|
|
| MD5 |
03324972d3d224fba2c9713718d778b4
|
|
| BLAKE2b-256 |
adacb914583e1771dbf6735d8d7d40ce24d9c58fa4a2093c190f26b5ded52b7d
|