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.
Release files for drevoid 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| drevoid-1.0.3.tar.gz | 26.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| drevoid-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 52.7 kB
Release files / drevoid-1.0.3.tar.gz
| Download URL | drevoid-1.0.3.tar.gz |
|---|---|
| Size | 26.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31a2ef8eba469a2ad2c4c9297277d9addb87704c0b8b703b25f09fd40ea22549
|
|
BLAKE2b-256 checksum How to use checksums |
4922fd52a7b405064190f5a8c19a8bcf5d760ffa6cf3e557d41011eda4a91fc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / drevoid-1.0.3-py3-none-any.whl
| Download URL | drevoid-1.0.3-py3-none-any.whl |
|---|---|
| Size | 26.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c24275a684dc107e328e306b65af8fe4299250e95d0f009f204157b0d06be1d
|
|
BLAKE2b-256 checksum How to use checksums |
99dea5dfe30ae8c367e78dce724949c1c82aec09ac804321a7e62cc41d5bb02f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|