Kosh is a modern Flask application for secure file sharing over a local network using AES encryption and simulated Attribute-Based Encryption (ABE). It features a beautiful Tailwind-based UI, an admin dashboard for user and policy management, real-time synchronization, and improved file structure for scalability.
kosh/
βββ app/
β βββ app.py # Main Flask application
β βββ __init__.py # Package initialization
β βββ attribute_management.py # Attribute management logic
β βββ crypto/
β β βββ aes.py # AES encryption/decryption
β β βββ abe_simulator.py # JSON-based ABE simulation
β βββ static/
β β βββ admin/ # Admin dashboard assets
β β β βββ admin.css
β β β βββ admin-dashboard.js
β β β βββ tailwind.config.js
β β βββ dashboard/ # User dashboard assets
β β β βββ dashboard.css
β β β βββ dashboard.js
β β β βββ dashboard-tailwind.config.js
β β βββ shared/ # Shared components and utilities
β β β βββ components/
β β β β βββ modal.js
β β β β βββ notification-manager.js
β β β β βββ toast.js
β β β βββ modules/
β β β β βββ attribute-manager.js
β β β β βββ audit-manager.js
β β β β βββ dashboard-file-manager.js
β β β β βββ file-manager.js
β β β β βββ password-manager.js
β β β β βββ policy-manager.js
β β β β βββ realtime-manager.js
β β β β βββ upload-manager.js
β β β β βββ user-manager.js
β β β βββ utils/
β β β βββ admin-links.js
β β β βββ ui-helpers.js
β β βββ common/ # Common assets (icons, favicons)
β βββ templates/
β β βββ index.html # Login page
β β βββ dashboard.html # User dashboard
β β βββ admin.html # Admin dashboard
β βββ uploads/ # Encrypted file storage
β βββ user_keys/ # User key files
βββ data/
β βββ aes_encryption.key # AES encryption key
β βββ aes_hmac.key # HMAC key for integrity
β βββ attributes.json # Global attribute pool
β βββ audit_logs.jsonl # System audit logs
β βββ policies.json # File access policies
β βββ users.json # User accounts and attributes
βββ .github/ # GitHub templates and workflows
β βββ ISSUE_TEMPLATE/
β βββ bug_report.md
β βββ feature_request.md
βββ requirements.txt # Python dependencies
βββ README.md # This file
git clone https://github.com/neelshha/kosh.git
cd kosh
python -m venv venv
source venv/bin/activate # On macOS/Linux
# or
venv\Scripts\activate # On Windows
pip install -r requirements.txt
python -m app.app
The application will start on http://localhost:7130
. You can access it from any device on the same local network.
admin
/ pass
pass
for all usershttp://localhost:7130/admin
after logging in as adminKosh includes comprehensive real-time synchronization using WebSocket technology (Socket.IO):
user_added
, user_updated
, user_deleted
policy_added
, policy_updated
, policy_deleted
attribute_added
, attribute_removed
audit_log_added
for system activity trackingOpen multiple browser tabs as admin to see live synchronization:
# Admin room management
@socketio.on('join_admin')
def handle_join_admin():
user_id = session.get('user_id')
if user_id == 'admin':
join_room('admin_updates')
emit('joined_admin', {'message': 'Joined admin updates'})
# Real-time event emission
socketio.emit('user_added', {
'user': user_id,
'attributes': attributes,
'timestamp': datetime.now().strftime('%Y-%m-%d %H:%M:%S')
}, room='admin_updates')
// Initialize connection
const socket = io();
socket.emit('join_admin');
// Listen for real-time events
socket.on('user_added', function(data) {
addUserToTable(data.user, data.attributes);
showToast(`User "${data.user}" added`, 'success');
});
For production environments, configure specific CORS origins:
socketio = SocketIO(app, cors_allowed_origins=["https://yourdomain.com"])
Real-time features work in all modern browsers supporting WebSocket:
All users have a consistent password structure:
pass
for all usersThe system automatically converts legacy user formats to the new dictionary format:
{
"username": {
"attributes": ["attr1", "attr2"],
"password": "pass"
}
}
Please report security vulnerabilities by creating an issue with the βsecurityβ label. We support the following versions:
Version | Supported |
---|---|
5.1.x | β |
5.0.x | β |
4.0.x | β |
< 4.0 | β |
Include in your report:
Kosh follows a modular architecture with clear separation of concerns:
The dashboard has been completely restructured for better maintainability:
app/static/
βββ css/
β βββ dashboard.css # All dashboard styles
βββ js/
β βββ dashboard.js # Main dashboard controller
β βββ config/
β β βββ dashboard-tailwind.config.js # Tailwind configuration
β βββ components/
β β βββ notification-manager.js # Notification system
β βββ modules/
β βββ dashboard-file-manager.js # File display and management
β βββ upload-manager.js # File upload functionality
β βββ password-manager.js # Password change modal
# Emit events after data changes
socketio.emit('custom_event', data, room='admin_updates')
// Listen for events and update UI
socket.on('custom_event', function(data) {
updateUIElement(data);
});
user_added
not ua
policy_updated
not updated
file_deleted
not file_delete
With the new modular structure, future improvements are easier:
We welcome contributions from the community! Whether itβs fixing a bug, improving documentation, or adding a new feature, all contributions are welcome.
git clone https://github.com/<your-username>/kosh.git
cd kosh
git remote add upstream https://github.com/neelshha/kosh.git
git checkout -b feature/<short-description>
Follow Conventional Commits:
<type>: <short description>
feat: add real-time file upload progress
fix: resolve WebSocket connection issues
docs: update installation instructions
refactor: restructure dashboard components
style: formatting changes, no code logic updates
test: adding or updating tests
Use our GitHub issue templates for:
git push origin feature/<branch-name>
This project is licensed for educational and internal LAN use only.
Kosh is designed for educational purposes and internal network use. It should not be exposed to the public internet without proper security hardening.
Thank you to all contributors who have helped make Kosh better:
For questions, bug reports, or feature requests:
Planned enhancements for future versions:
Happy file sharing with Kosh! ππ