Modern, Beautiful, Secure File Encryption
Encrypt and decrypt files with style. Built with Click and Rich for a delightful CLI experience.
- π¨ Beautiful Interface β Rich terminal output with progress bars, tables, and colors
- π Modern Cryptography β AES-256-GCM, ChaCha20-Poly1305, Fernet (RSA and Hybrid under development)
- π File & Folder Support β Encrypt individual files or entire directories
- ποΈ Smart Key Management β Automatic key generation with secure storage
- π Metadata Preservation β Store encryption info for seamless decryption
- π‘οΈ Process Locking β Prevent concurrent operations from corrupting data
- π Binary File Support β Handle text and binary files (images, PDFs, videos)
- β‘ High Performance β Efficient encryption/decryption for large files
pip install pylock-suitegit clone https://github.com/skye-cyber/pylock.git
cd pylock
pip install -e .pip install -e ".[dev]"- Python 3.8+
- cryptography library
- click and rich for CLI
- base64 for binary data handling
# Interactive mode (prompts for password)
pylock encrypt secret.txt
# With explicit options
pylock encrypt document.pdf --cipher aes-256-gcm --password "mypassword"
# Short alias
pl encrypt photo.jpg -c chacha20# Interactive mode
pylock decrypt secret.txt.locked
# With key file
pylock decrypt backup.zip.locked --key-file key.pem
# Specify output
pylock decrypt data.enc -o decrypted.datapylock interactive| Option | Description |
|---|---|
-v, --verbose |
Enable verbose output |
-q, --quiet |
Suppress non-error output |
--version |
Show version and exit |
Encrypt files or folders.
pylock encrypt [OPTIONS] PATH
Options:
-c, --cipher TEXT Cipher to use (default: aes-256-gcm)
-p, --password TEXT Encryption password
-k, --key-file PATH Save key to file
-o, --output PATH Output file/directory
--no-compress Disable compressionDecrypt files or folders.
pylock decrypt [OPTIONS] PATH
Options:
-p, --password TEXT Decryption password
-k, --key-file PATH Read key from file
-o, --output PATH Output file/directory
--brute-force Attempt brute force (requires --wordlist)
-w, --wordlist PATH Wordlist for brute forceDisplay available ciphers and their properties.
pylock list-ciphersGenerate encryption keys (especially for RSA).
pylock generate-key --cipher rsa -o mykey.pemCheck if a file is encrypted and display metadata.
pylock verify mystery.fileLaunch guided interactive mode.
pylock interactive| Cipher | Security | Type | Best For | Status |
|---|---|---|---|---|
aes-256-gcm |
π Modern (Recommended) | Symmetric | General purpose, hardware accelerated | β Working |
chacha20-poly1305 |
π Modern | Symmetric | Mobile/ARM devices, software-only | β Working |
fernet |
π Modern | Symmetric | Simple password-based encryption | β Working |
rsa-oaep |
π Modern | Asymmetric | Key exchange, small data (<190 bytes) | |
hybrid-rsa-aes |
π Modern | Hybrid | Large files with asymmetric keys | |
caesar |
Substitution | Educational only | β Deprecated | |
vigenere |
Polyalphabetic | Educational only | β Deprecated | |
playfair |
Digraph | Educational only | β Deprecated | |
morse |
Encoding | Text encoding, educational | β Deprecated |
β οΈ Warning: Classical ciphers are deprecated and will be replaced with modern alternatives in future versions.
π§ Note: RSA and Hybrid-RSA-AES ciphers are currently under development and may not work correctly in this version.
# AES-256-GCM (default)
pylock encrypt secrets.txt
# ChaCha20-Poly1305 (better for mobile)
pylock encrypt mobile-data.zip -c chacha20
# Fernet (simple password-based)
pylock encrypt document.pdf -c fernet
# RSA and Hybrid-RSA-AES are currently under development
# pylock encrypt api-key.txt -c rsa-oaep
# pylock encrypt database.sql -c hybrid-rsa-aes# Encrypt entire folder
pylock encrypt ~/Documents/Private --cipher aes-256-gcm -o private.enc
# Decrypt folder
pylock decrypt private.enc -o ~/Documents/Private# Generate and save key
pylock generate-key -c aes-256-gcm -o master.key
# Encrypt with saved key
pylock encrypt file.txt --key-file master.key
# Decrypt with same key
pylock decrypt file.txt.locked --key-file master.key# Attempt password recovery
pylock decrypt unknown.locked --brute-force --wordlist passwords.txtPyLock/
βββ pylock/
β βββ cli/ # Click + Rich CLI interface
β β βββ cli.py # Main CLI entry point
β β βββ utils.py # CLI utilities
β βββ core/
β β βββ pylock.py # Core encryption engine
β β βββ pylockmanager.py # File/directory processing
β β βββ lock.py # Process lock manager
β β βββ interfaces.py # Interface definitions
β β βββ exceptions.py # Custom exceptions
β β βββ key_manager.py # Key derivation
β βββ ciphers/
β β βββ aes256gsm.py # AES-256-GCM (β
Working)
β β βββ chacha20.py # ChaCha20-Poly1305 (β
Working)
β β βββ fernet.py # Fernet (β
Working)
β β βββ rsa.py # RSA-OAEP (β οΈ Needs Fix)
β β βββ hybridrsa_aes.py # Hybrid encryption (β οΈ Needs Fix)
β β βββ classical.py # Classical ciphers (β Deprecated)
β β βββ factory.py # Cipher factory
β βββ utils/
β βββ logging.py # Rich logging
β βββ file_utils.py # File operations
PyLock is designed for legitimate data protection. Please use responsibly:
- π Keep passwords safe β Lost passwords cannot be recovered (unless brute force succeeds)
- ποΈ Backup encryption keys β Store key files in secure, separate locations
- π§ͺ Test decryption β Always verify you can decrypt before deleting originals
- π Use strong passwords β Combine uppercase, lowercase, numbers, and symbols
- ποΈ Compliance β Ensure your use complies with local laws and regulations
Warning: Irresponsible use can result in permanent data loss. The authors are not responsible for lost data due to forgotten passwords or corrupted key files.
Contributions are welcome! Please see our Contributing Guide for details.
# Fork and clone
git clone https://github.com/your-username/pylock.git
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Format code
black src tests
isort src tests
# Type check
mypy src/pylockThis project is licensed under the GNU General Public License v3.0 β see the LICENSE file for details.
- Click β Command line interface framework
- Rich β Beautiful terminal formatting
- Cryptography β Modern cryptographic recipes
- PyCryptodome β Low-level cryptographic primitives
- Shields.io β Status badges
Made with β€οΈ by Wambua (Skye-Cyber)
β Star us on GitHub β it motivates us to keep improving!