Terminal-based LAN chat client with rooms, private messaging, and CTF flag detection
Project description
Drevoid - Terminal-Based LAN Chat Client
A professional, feature-rich terminal-based chat application with room management, private messaging, CTF flag detection, and real-time collaboration capabilities.
Features
โจ Core Chat Features
- Multi-room chat system with public and private rooms
- Direct private messaging between users
- Real-time message delivery and synchronization
- User presence tracking and status updates
- Persistent room history
๐ Security & Privacy
- Password-protected private rooms
- User authentication and role-based access control
- Message encryption support
- Admin console for server management
- User ban/kick/mute capabilities
๐ฉ CTF Integration
- Automatic CTF flag detection and capture
- Flag pattern matching (flag format:
flag{...}) - Flag statistics and leaderboard
- Integration with HackTheBox and similar platforms
๐ฅ User Management
- User roles: Admin, Moderator, User
- Room creation and management
- User muting/unmuting by admins
- Connection status monitoring
- User profile customization
๐ฏ Productivity
- Command-line interface with intuitive commands
- Interactive shell with command history
- Help system with detailed documentation
- Color-coded output for better readability
- Support for both IPv4 and IPv6
Installation
From PyPI (Recommended)
pip install drevoid-client
From Source
git clone https://github.com/axiomchronicles/drevoid_client.git
cd drevoid_client
pip install -e .
Requirements
- Python 3.10 or higher
- No external dependencies (uses only Python standard library)
Quick Start
Starting the Client
The simplest way to start Drevoid is to use the dre command:
# Interactive mode
dre
# Connect to a specific server
dre -H 192.168.1.100 -u alice
# Connect with custom port
dre -H 192.168.1.100 -p 5000 -u bob
# Connect and join a room on startup
dre -H 192.168.1.100 -u carol -r development
Command-Line Options
usage: dre [-h] [-v] [-H HOST] [-p PORT] [-u USERNAME] [-r ROOM] [--debug]
options:
-h, --help Show this help message
-v, --version Show version information
-H, --host HOST Server hostname or IP address
-p, --port PORT Server port (default: 5000)
-u, --username USERNAME
Username to use for connection
-r, --room ROOM Room to join on startup
--debug Enable debug mode for troubleshooting
Environment Variables
You can set default connection parameters using environment variables:
export DREVOID_HOST=192.168.1.100
export DREVOID_PORT=5000
export DREVOID_USER=alice
export DREVOID_ROOM=general
# Now you can simply run:
dre
Client Commands
Connection Commands
| Command | Syntax | Description |
|---|---|---|
connect |
connect |
Connect to a server (prompted for host/port/username) |
disconnect |
disconnect |
Disconnect from the current server |
status |
status |
Show connection status |
Room Commands
| Command | Syntax | Description |
|---|---|---|
join |
join <room_name> |
Join an existing room |
leave |
leave |
Leave the current room |
create |
create <name> [public|private] [password] |
Create a new room |
rooms |
rooms |
List all available rooms |
users |
users |
List users in current room |
invite |
invite <username> |
Invite user to current room |
topic |
topic <new_topic> |
Set or update room topic |
Messaging Commands
| Command | Syntax | Description |
|---|---|---|
msg |
msg <username> <message> |
Send private message to user |
reply |
reply <message> |
Reply to last private message |
broadcast |
broadcast <message> |
Send message to all users |
announce |
announce <message> |
Send announcement to current room |
User Commands
| Command | Syntax | Description |
|---|---|---|
profile |
profile |
View your profile |
setname |
setname <new_name> |
Change your display name |
setstatus |
setstatus <status> |
Set your status message |
whoami |
whoami |
Show current username |
online |
online |
List all online users |
CTF Commands
| Command | Syntax | Description |
|---|---|---|
flags |
flags |
Display all captured flags |
flag-stats |
flag-stats |
Show flag statistics |
leaderboard |
leaderboard |
Show flag leaderboard |
my-flags |
my-flags |
Show your captured flags |
Admin Commands (Admin Only)
| Command | Syntax | Description |
|---|---|---|
kick |
kick <username> [reason] |
Kick user from room |
ban |
ban <username> [reason] |
Ban user from server |
unban |
unban <username> |
Unban user |
mute |
mute <username> [duration] |
Mute user in current room |
unmute |
unmute <username> |
Unmute user |
promote |
promote <username> [role] |
Promote user to role |
demote |
demote <username> |
Demote user |
clearroom |
clearroom |
Clear all messages in room |
lockroom |
lockroom |
Lock room (no new joins) |
unlockroom |
unlockroom |
Unlock room |
Utility Commands
| Command | Syntax | Description |
|---|---|---|
help |
help [command] |
Show help for all or specific command |
clear |
clear |
Clear screen |
history |
history |
Show command history |
export |
export <filename> |
Export chat history |
settings |
settings |
Show current settings |
exit |
exit |
Close application |
Usage Examples
Basic Chat Workflow
# Start client
dre
# At the prompt, connect to a server
> connect
Server host: 192.168.1.100
Server port [5000]:
Username: alice
# Join a room
> join general
# Send a message (automatic in current room)
> Hello everyone!
# Send private message
> msg bob Hi Bob, how are you?
# View room users
> users
# Leave room
> leave
# Disconnect
> disconnect
Room Management
# Create a private room
> create dev-team private mysecretpass
# Join the room
> join dev-team
# View room topic
> topic Team Development Discussion
# Invite another user
> invite alice
# Leave when done
> leave
CTF Hunting
# View all captured flags
> flags
# Check flag statistics
> flag-stats
# View leaderboard
> leaderboard
# See only your flags
> my-flags
Admin Tasks
# Mute a disruptive user for 30 minutes
> mute spambot 30m
# Kick a user from the current room
> kick baduser "Violated community guidelines"
# Promote a trusted user to moderator
> promote trustworthy moderator
# Ban a user from the entire server
> ban malicious "Spam and harassment"
# Unban a user later
> unban reformed_user
Architecture
Project Structure
drevoid_client/
โโโ src/drevoid/
โ โโโ __init__.py
โ โโโ cli.py # CLI entry point
โ โโโ client/
โ โ โโโ chat_client.py # Main client logic
โ โ โโโ connection.py # Network connection management
โ โ โโโ message_handler.py # Message routing
โ โ โโโ room_manager.py # Room state management
โ โโโ core/
โ โ โโโ protocol.py # Protocol definitions
โ โโโ ui/
โ โ โโโ shell.py # Interactive shell
โ โ โโโ ui_components.py # UI helper functions
โ โโโ ctf/
โ โ โโโ flag_detector.py # Flag detection logic
โ โ โโโ flag_patterns.py # CTF flag patterns
โ โโโ common/
โ โ โโโ exceptions.py # Custom exceptions
โ โ โโโ logging.py # Logging utilities
โ โโโ utils/
โ โโโ emoji_aliases.py # Emoji support
โ โโโ notifications.py # Notification system
โโโ bin/
โ โโโ drevoid-client.py # Legacy client entry point
โ โโโ drevoid-server.py # Legacy server entry point
โโโ setup.py # Package configuration
โโโ requirements.txt # Dependencies
โโโ README.md # This file
Key Components
ChatClient (client/chat_client.py)
- Manages connection to server
- Handles message sending/receiving
- Maintains local state for rooms and users
- Coordinates with message handler for notifications
ChatShell (ui/shell.py)
- Interactive command-line interface
- Command parsing and execution
- Help system and command history
- User input handling
MessageHandler (client/message_handler.py)
- Routes incoming messages
- Processes server notifications
- Updates local room state
- Triggers UI updates
RoomManager (client/room_manager.py)
- Manages local room state
- Tracks room members
- Handles room-specific operations
- Maintains room history
FlagDetector (ctf/flag_detector.py)
- Scans messages for CTF flags
- Validates flag format
- Maintains flag statistics
- Integrates with leaderboard
Configuration
Config File
Create ~/.drevoid/config.json for persistent settings:
{
"theme": "dark",
"color_output": true,
"auto_reconnect": true,
"reconnect_delay": 5,
"log_level": "INFO",
"default_host": "192.168.1.100",
"default_port": 5000,
"default_username": "alice",
"ctf_enabled": true,
"flag_patterns": [
"flag{.*}",
"FLAG{.*}",
"flag\\[.*\\]"
]
}
Logging
Logs are written to ~/.drevoid/logs/:
~/.drevoid/
โโโ config.json
โโโ logs/
โ โโโ client.log
โ โโโ chat_history.log
โโโ cache/
โโโ flags.json
Development
Running from Source
# Clone the repository
git clone https://github.com/axiomchronicles/drevoid_client.git
cd drevoid_client
# Install in development mode
pip install -e .
# Run tests
python -m pytest tests/
# Run client
dre
Project Dependencies
Drevoid uses only Python standard library modules:
socket- Networkingthreading- Concurrencyjson- Message serializationcmd- Interactive shellstruct- Binary data packinghashlib- Password hashingtime- Timestampsos- System operationssys- System parameters
Code Style
Follow PEP 8 guidelines:
# Check code style
python -m flake8 src/
# Format code
python -m black src/
# Type checking
python -m mypy src/
Troubleshooting
Connection Issues
Problem: Cannot connect to server
# Solution: Verify server is running and port is correct
dre -H <server_ip> -p <port> -u <username>
# Check if port is accessible
telnet 192.168.1.100 5000
Problem: "Unknown command" errors
# Solution: Try the `help` command
> help
> help <command>
Message Issues
Problem: Messages not sending
> Make sure you're connected: status
> Make sure you're in a room: rooms
> Try joining a room: join general
Problem: Missing private messages
> Check if user is online: online
> Try sending again: msg username message
Flag Detection
Problem: Flags not being detected
> Check flag format matches pattern
> Verify CTF mode is enabled: settings
> Add custom patterns to config
Performance Tips
-
Large Chat Histories: Export old messages to free memory
> export chat_history_2024.txt
-
Multiple Rooms: Reduce number of joined rooms for better performance
-
Network Optimization: Use server closest to your location
-
Message Filtering: Use room-specific topics to filter conversations
Security Considerations
- Password Protection: Always use strong passwords for private rooms
- Private Messages: Use for sensitive conversations
- Admin Access: Only promote trusted users to admin role
- Ban/Kick: Remove disruptive users immediately
- Flag Sharing: Be careful when sharing flag information
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For issues, questions, or suggestions:
- GitHub Issues: Report a bug
- Discussions: Start a discussion
- Email: dev@drevoid.local
Acknowledgments
- Built with Python standard library (no external dependencies)
- Inspired by professional chat systems and CTF platforms
- Community feedback and contributions
Changelog
Version 1.0.0 (Current)
- Initial release
- Multi-room chat system
- Private messaging
- CTF flag detection
- Admin console
- CLI integration
Made with โค๏ธ by the Drevoid Team
For more information, visit GitHub Repository
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.1.tar.gz.
File metadata
- Download URL: drevoid-1.0.1.tar.gz
- Upload date:
- Size: 50.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9db0bd310168331135a13a2fca75a13d80d7e603146931f503a8adaf5311e60e
|
|
| MD5 |
03752105bb01baa7cbae1cd8f7b1b485
|
|
| BLAKE2b-256 |
21f38e176e4e5f5c5a3fb7abb998bebf1f333947893c683b8f363c259dd544f5
|
File details
Details for the file drevoid-1.0.1-py3-none-any.whl.
File metadata
- Download URL: drevoid-1.0.1-py3-none-any.whl
- Upload date:
- Size: 53.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 |
f377884c70f81f722c99b634bc5542de7bfed4889b01e24a4b9bd0845dfa12a1
|
|
| MD5 |
f7765732b9dc06763351520e4f54b547
|
|
| BLAKE2b-256 |
1a4b737092fda8610b6ed35e588f832bbe12a23c5d1dbffa4c3900f942e19550
|