A Python-based anti-forensic tool that securely deletes files using DoD 5220.22-M compliant data overwriting.
Standard file deletion (e.g., Shift+Delete) only removes the reference to the file in the file system table — the actual data remains on disk until overwritten.
This allows forensic tools to easily recover “deleted” files.
Secure File Shredder prevents recovery by:
- Overwriting file content with cryptographically secure random bytes.
- Obfuscating the filename to remove metadata traces.
- Unlinking (securely deleting) the file from the file system.
Use it for secure disposal of sensitive files, privacy protection, and anti-forensic use cases.
- 🗑️ DoD 5220.22-M inspired multi-pass shredding
- 🔐 Cryptographically strong randomness via Python’s
secretsmodule - 🧹 Filename obfuscation to destroy metadata traces
- 💻 Simple CLI interface
- 📚 Ideal for cybersecurity & digital forensics learning
- Python 3.8+
- pip
-
Clone the repository
git clone https://github.com/osmankaankars/Secure-File-Shredder.git cd Secure-File-Shredder -
Create and activate a virtual environment
python3 -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
python shredder.py confidential_doc.pdfpython shredder.py confidential_doc.pdf -p 7-p, --passes: Number of overwrite passes (default: 3)
-
Pass 1 → Pass N-1:
Overwrites the full file size with cryptographically secure random bytes (viasecrets.token_bytes). -
Final Pass:
Overwrites the file with0x00bytes to conceal random-pattern indicators.
- The tool enforces flush & fsync to force the OS to write changes to disk immediately.
- The file is renamed to a random alphanumeric string (e.g.,
a8X92kL1m.tmp) before final deletion.
- After the final pass completes, the file is securely unlinked from the filesystem.
This tool is for educational, research & authorized use only.
Irreversible: Files shredded with this tool cannot be recovered.
Use with caution.
On SSDs with wear-levelling, no software can guarantee 100% physical cell erasure, though this tool significantly reduces recoverability.
Osman Kaan Kars
Cybersecurity Engineer | SAP Security Specialist
- GitHub: https://github.com/osmankaankars
- LinkedIn: https://www.linkedin.com/in/osman-kaan-kars/