Secure. Simple. Shareable.
A command-line file sharing tool with built-in malware scanning and encryption.
Developed by Vision KC
| Feature | Description |
|---|---|
| 🔍 Security Scanning | Extension check, magic byte detection, entropy analysis, and script pattern matching |
| 🔐 Encryption at Rest | All files encrypted with Fernet (AES-128-CBC + HMAC-SHA256) before storage |
| 🆔 Unique File IDs | Cryptographically secure 12-character IDs (e.g. ABCD-WXYZ-2345) |
| ⏰ File Expiry | Set automatic expiry (1–365 days, or never) |
| 🗑️ Auto-Delete | Optionally delete a file after its first download |
| 📊 Download Counter | Track how many times a file has been downloaded |
| 📝 Logging | All uploads and downloads logged to ~/.safedrop/safedrop.log |
| 🛡️ Directory Traversal Prevention | All file paths validated to stay within the storage directory |
| 💻 Rich Terminal UI | Clean, colorful interface powered by Rich |
- Python 3.9 or higher
- pip
git clone https://github.com/VisionKC/safedrop.git
cd safedrop
pip install -e .pip install -r requirements.txt# If installed as a package:
safedrop
# Or run directly with Python:
python -m safedrop ____ __ ____
/ __/__ _____/ /__ ___/ / /______ ___
_\ \/ _ `/ _ / -_) _ / __/ __/ \/ _ \
/___/\_,_/\_,_/\__/\_,_/\__/_/ /_/ .__/
/_/
Secure. Simple. Shareable.
v1.0.0 · Developed by Vision KC
┌────────────────────────────────────────┐
│ 1 Upload File Share a file │
│ 2 Download File Retrieve by ID │
│ 3 Exit Quit SafeDrop │
└────────────────────────────────────────┘
- Select 1 from the menu
- Enter the full path to your file
- SafeDrop scans the file for threats
- Set expiry days (0 = never expires)
- Choose auto-delete and add an optional note
- Your unique File ID is displayed — share it with the recipient
- Select 2 from the menu
- Enter the File ID (e.g.
ABCD-WXYZ-2345) - Choose a destination directory
- The file is decrypted and restored to your chosen location
SafeDrop runs four layers of scanning before accepting any file:
- Extension Check — Blocks 50+ dangerous file types (
.exe,.bat,.ps1,.sh,.dll,.jar, etc.) - Magic Byte Detection — Reads file headers to detect executables regardless of extension (MZ, ELF, Mach-O, shebang, ZIP, OLE2)
- Entropy Analysis — Calculates Shannon entropy; files with entropy > 7.5/8.0 are flagged as potentially packed/encrypted malware
- Script Pattern Matching — Scans file content for known malicious patterns (PowerShell download cradles, reverse shells, obfuscation techniques)
- Files are encrypted with Fernet (symmetric authenticated encryption)
- Each file gets its own unique encryption key
- Keys are stored in the metadata file (
~/.safedrop/metadata.json) - The stored file format uses the
.sdf(SafeDrop File) extension
~/.safedrop/
├── storage/ # Encrypted file storage (chmod 700)
│ ├── ABCDWXYZ2345.sdf
│ └── ...
├── metadata.json # File records (IDs, keys, expiry, etc.)
└── safedrop.log # Audit log
- All file IDs are validated against the expected format before lookup
- Destination paths are sanitized to prevent directory traversal
- File size is limited to 500 MB per upload
- Original filenames are stripped of directory components on restore
Edit safedrop/config.py to customize:
| Setting | Default | Description |
|---|---|---|
MAX_FILE_SIZE_MB |
500 |
Maximum upload size in MB |
DEFAULT_EXPIRY_DAYS |
7 |
Default file expiry |
ENTROPY_THRESHOLD |
7.5 |
Entropy threshold for malware detection |
STORAGE_DIR |
~/.safedrop/storage/ |
Where encrypted files are stored |
pip install pytest
pytest tests/ -vSafeDrop/
├── safedrop/
│ ├── __init__.py # Package metadata
│ ├── __main__.py # Entry point & main loop
│ ├── config.py # Configuration constants
│ ├── id_generator.py # Secure ID generation
│ ├── logger.py # Logging setup
│ ├── security.py # Malware scanning
│ ├── crypto.py # File encryption/decryption
│ ├── metadata.py # File record management
│ ├── storage.py # Secure file storage
│ ├── upload.py # Upload flow
│ ├── download.py # Download flow
│ └── cli.py # Terminal UI
├── tests/
│ ├── test_id_generator.py
│ ├── test_security.py
│ ├── test_crypto.py
│ ├── test_metadata.py
│ └── test_storage.py
├── requirements.txt
├── pyproject.toml
├── LICENSE
└── README.md
MIT License — see LICENSE for details.