Enterprise-Grade File Management System with Security & Encryption
A sophisticated desktop file manager built with Python and Tkinter, featuring military-grade security, encrypted storage, smart trash recovery, comprehensive audit logging, and protected system path validation. This project demonstrates professional software engineering practices including authentication systems, cryptographic encryption, metadata management, and event-driven GUI architecture.
Key Technologies: Python 3.x | Tkinter/ttk | Cryptography (Fernet) | SHA-256 Hashing | JSON Metadata | Activity Logging
Complexity Level: Intermediate to Advanced
- Overview
- Key Features
- Screenshots
- Installation
- Usage
- Security Features
- Technical Stack
- Project Structure
- Educational Objectives
- Future Improvements
- Contributing
- License
What started as a simple beginner project with basic "create, read, delete" operations somehow evolved into a full-blown security fortress with SHA-256 password hashing, Fernet encryption, brute-force protection, smart trash recovery, metadata preservation, and system path validation. Now featuring 800+ lines of code, login attempt tracking, audit logging, and enough security features to make even paranoid sysadmins feel safe - because apparently "just delete a file" wasn't exciting enough!
- Secure Authentication System with brute-force protection
- Encrypted Configuration Storage using industry-standard cryptography
- Smart Trash System with metadata preservation and full file recovery
- Comprehensive Activity Logging for audit trails
- Protected System Paths to prevent accidental system damage
- Modern GUI Interface with tabbed navigation and real-time updates
- Password Protection: SHA-256 hashed passwords with encrypted storage
- Brute-Force Protection: Maximum 3 login attempts with 5-minute account lockout
- Encrypted Configuration: Sensitive files encrypted using Fernet (symmetric encryption)
- Activity Logging: All operations logged with timestamps and results
- Protected Paths: Automatic blocking of system-critical directories
- Create Files: Write new files with custom content
- Read Files: View file contents in integrated text editor
- Edit & Save: Modify existing files with real-time editing
- Delete Files: Safe deletion with trash system (no permanent loss)
- Copy Files: Duplicate files with automatic naming
- Rename Files: Change file names with validation
- Navigation: Browse directories with up/down/home controls
- Create Folders: Make new directories on-the-fly
- Tree View: Visual directory structure with icons
- Size Calculation: Recursive folder size computation
- Timestamps: Display modification dates for all items
- Double-Click Navigation: Quick folder access
- Safe Deletion: Files moved to
.trashdirectory instead of permanent deletion - Metadata Preservation: Original path, deletion time, and size stored
- Full Restoration: Restore deleted files to their original locations
- Permanent Deletion: Option to remove files forever from trash
- Trash Browser: Dedicated tab to view and manage deleted items
- File Size Formatting: Human-readable sizes (KB, MB, GB, TB)
- Protected File Detection: Visual indicators (lock icon) for system directories
- Context Menus: Right-click operations in file explorer
- Error Handling: Comprehensive try-catch blocks for stability
- Cross-Platform: Works on Windows, macOS, and Linux
Secure login with attempt tracking and lockout protection
Create, read, edit, and manage files with integrated text editor
Visual file browser with folder sizes and modification dates
Recover or permanently delete files with metadata view
- Python 3.x (3.7 or higher recommended)
- pip package manager
# Clone the repository
git clone https://github.com/yourusername/FileManager.git
cd FileManager
# Or download the file_manager.py directlypip install cryptographypython file_manager.py- Login: Use the default password
admin123 - Main Window: Three tabs will appear (Files, Explorer, Trash)
- Change Password (recommended): Modify
PASSWORD_HASHin the code or use password change feature
Creating a File:
1. Enter filename in the "File Name" field (e.g., "notes.txt")
2. Type content in the text editor
3. Click "Create" button
Reading a File:
1. Enter filename or use "Browse" button
2. Click "Read" button
3. Content appears in the text editor
Editing a File:
1. Read the file first
2. Modify content in the editor
3. Click "Save" to update the file
Deleting a File:
1. Enter filename
2. Click "Delete" button
3. Confirm to move file to trash
Navigation:
• Type path and click "Go" - Navigate to specific directory
• Click "Up" - Move to parent directory
• Click "Home" - Return to user home directory
• Double-click folder - Open directory
• Double-click file - Load in editor tab
Creating Folders:
1. Click "New Folder"
2. Enter folder name
3. Folder appears in current directory
Context Menu (Right-Click):
• Open - Navigate into folder or load file
• Move to Trash - Delete selected item
• Refresh - Update directory listing
Restoring Files:
1. Select file from trash list
2. Click "Restore" button
3. File returns to original location
Permanent Deletion:
1. Select file from trash
2. Click "Delete Permanently"
3. Confirm to remove forever
# Password is hashed using SHA-256
PASSWORD_HASH = hashlib.sha256("admin123".encode()).hexdigest()
# Login attempts are tracked
MAX_LOGIN_ATTEMPTS = 3
LOGIN_TIMEOUT = 300 # 5 minutes lockoutProtection Mechanisms:
- Passwords never stored in plain text
- Configuration encrypted with Fernet
- Failed attempts logged with timestamps
- Automatic account lockout after 3 failures
- Lockout timer prevents brute-force attacks
The application blocks operations on critical system directories:
PROTECTED_PATHS = [
"/System", # macOS system files
"/Windows", # Windows system files
"/Program Files", # Windows programs
"C:\\Windows", # Windows (absolute)
"/bin", "/sbin", # Unix system binaries
"/usr/bin", "/usr/sbin" # Unix user binaries
]The following files are automatically protected from deletion:
password.cfg- Encrypted password configurationfile_manager.log- Activity loglogin_attempts.json- Authentication tracking.key- Encryption key
| Component | Technology | Purpose |
|---|---|---|
| Language | Python 3.x | Core application logic |
| GUI Framework | Tkinter / ttk | User interface |
| Encryption | cryptography (Fernet) |
Secure data storage |
| Hashing | hashlib (SHA-256) |
Password security |
| File Operations | os, shutil |
File system management |
| Path Handling | pathlib |
Cross-platform paths |
| Data Storage | json |
Metadata and configuration |
| Date/Time | datetime |
Timestamps and logging |
| Encoding | base64 |
Binary data encoding |
FileManager/
│
├── file_manager.py # Main application file
├── README.md # This documentation
│
├── .trash/ # Deleted files storage (auto-created)
│ ├── 20240214_120530_document.txt
│ ├── 20240214_120530_document.txt.meta
│ └── ...
│
├── .key # Encryption key (auto-generated)
├── password.cfg # Encrypted password hash
├── login_attempts.json # Login attempt tracking
└── file_manager.log # Activity log
| File | Description | Format |
|---|---|---|
.key |
Fernet encryption key | Binary |
password.cfg |
Encrypted password hash | Encrypted text |
login_attempts.json |
Failed login tracking | JSON |
file_manager.log |
Operation history | Plain text |
.trash/*.meta |
Deleted file metadata | JSON |
YYYY-MM-DD HH:MM:SS | ACTION | RESULT | TARGET | MESSAGE
2024-02-14 15:30:45 | LOGIN | SUCCESS | file_manager | authentication successful
2024-02-14 15:31:12 | CREATE | SUCCESS | notes.txt | file created
2024-02-14 15:32:03 | DELETE | SUCCESS | old_file.txt | moved to trash
This project serves as a comprehensive learning tool for several software engineering concepts:
Concepts Demonstrated:
- Password hashing vs encryption (one-way vs two-way functions)
- SHA-256 for irreversible password storage
- Fernet symmetric encryption for reversible data
- Brute-force attack prevention
- Account lockout mechanisms
Key Takeaway: Learn the difference between hashing (passwords) and encryption (configuration data), and why each is used in different contexts.
Concepts Demonstrated:
- File state tracking (active vs deleted)
- Metadata preservation during state transitions
- JSON-based metadata storage
- Original context reconstruction
Key Takeaway: Understand how professional applications (like Git, operating systems) manage file states and preserve historical context.
Concepts Demonstrated:
- File system traversal (
os.walk) - Exception handling (
try-exceptblocks) - Permission management
- Path validation
- Cross-platform file operations
Key Takeaway: Learn robust error handling to prevent crashes and provide meaningful feedback to users.
Concepts Demonstrated:
- Tkinter widget hierarchy
- Event binding (clicks, double-clicks, key presses)
- Dynamic UI updates
- Tabbed interface (ttk.Notebook)
- Context menus
Key Takeaway: Master event-driven programming where user actions trigger specific application responses.
Concepts Demonstrated:
- Separation of concerns (UI vs logic)
- Function decomposition
- Configuration management
- Logging and auditing
- Data validation layers
Key Takeaway: Understand how to structure code for maintainability and scalability.
- Append text to existing files
- Show file sizes in directory listing
- Confirmation dialogs before deletion
- Comprehensive error handling with try/except
- Folder support (create, delete, list)
- Directory navigation (cd-like behavior)
- Filter files by extension
- Timestamps (created/modified dates)
- Search functionality for files
- Activity logging
- User roles (read-only vs admin)
- GUI using Tkinter
- Password protection with hashing
- Encryption for sensitive data
- Login attempt limits
- Account lockout mechanism
- Protected system paths
- Smart trash system with metadata
- Search Functionality: Find files by name, content, or date
- File Preview: Quick view for images, PDFs, and text files
- Bulk Operations: Select and operate on multiple files
- Compression: Create and extract ZIP archives
- File Permissions: Unix-style permission management
- Favorites/Bookmarks: Quick access to frequently used folders
- Themes: Dark mode and custom color schemes
- Keyboard Shortcuts: Power user navigation (Ctrl+N, Ctrl+D, etc.)
- File Comparison: Side-by-side diff viewer
- Cloud Integration: Google Drive, Dropbox sync
- Advanced Search: Regex patterns, file content search
- Plugin System: Extensible architecture for custom features
- Multi-Language Support: Internationalization (i18n)
- Undo/Redo: Operation history with rollback
- Version Control Integration: Git operations within the file manager
- Network File Systems: FTP, SFTP, SMB support
- Database Browser: View and edit SQLite databases
- Code Editor: Syntax highlighting for programming files
- Terminal Integration: Embedded command line interface
- File Watchers: Automatic actions on file changes
- Tagging System: Organize files with custom tags
def verify_password(password: str) -> bool:
"""Verify password against stored hash"""
return hashlib.sha256(password.encode()).hexdigest() == PASSWORD_HASHdef encrypt_data(data: str) -> str:
"""Encrypt string data using Fernet"""
key = get_encryption_key()
f = Fernet(key)
encrypted = f.encrypt(data.encode())
return base64.b64encode(encrypted).decode()def move_to_trash(path: str) -> bool:
"""Move file to trash with metadata preservation"""
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
basename = os.path.basename(path)
trash_path = os.path.join(TRASH_DIR, f"{timestamp}_{basename}")
# Save metadata
metadata = {
"original_path": os.path.abspath(path),
"deleted_at": datetime.now().isoformat(),
"size": os.path.getsize(path)
}
with open(trash_path + ".meta", "w") as f:
json.dump(metadata, f)
shutil.move(path, trash_path)
return TrueContributions are welcome! Here's how you can help:
- Check if the bug is already reported in Issues
- Create a new issue with:
- Clear title and description
- Steps to reproduce
- Expected vs actual behavior
- Screenshots (if applicable)
- Your environment (OS, Python version)
- Open an issue with the "enhancement" label
- Describe the feature and its benefits
- Provide examples of how it would work
- 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
- Follow PEP 8 guidelines
- Use descriptive variable names
- Add comments for complex logic
- Include docstrings for functions
- Update README if adding new features
This project is licensed under the MIT License - see below for details:
MIT License
Copyright (c) 2024 INikolOFF
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- Python Community for excellent documentation
- Tkinter for accessible GUI framework
- cryptography library maintainers for secure encryption tools
- All contributors and testers who helped improve this project
- Issues: GitHub Issues
- Email: dnnikolov94@gmail.com
- Documentation: This README
For Educational Purposes: This project is designed as a learning tool. While it implements security best practices, it should not be used for managing critical or sensitive data in production environments without additional security audits.
System Files Warning: The application includes protection for common system directories, but users should exercise caution when navigating system areas.
- Initial release
- Core file management features
- Security implementation
- Trash system
- Activity logging
- Search functionality
- File preview
- Bulk operations
- Keyboard shortcuts
Made with Python
Star this project if you find it helpful!