Skip to content

A Python-based anti-forensic tool implementing DoD 5220.22-M algorithms for secure file deletion and metadata obfuscation to prevent data recovery.

Notifications You must be signed in to change notification settings

osmankaankars/Secure-File-Shredder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Secure File Shredder 🗑️

A Python-based anti-forensic tool that securely deletes files using DoD 5220.22-M compliant data overwriting.

Python
License
Security


📖 Overview

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:

  1. Overwriting file content with cryptographically secure random bytes.
  2. Obfuscating the filename to remove metadata traces.
  3. Unlinking (securely deleting) the file from the file system.

Use it for secure disposal of sensitive files, privacy protection, and anti-forensic use cases.


✨ Features

  • 🗑️ DoD 5220.22-M inspired multi-pass shredding
  • 🔐 Cryptographically strong randomness via Python’s secrets module
  • 🧹 Filename obfuscation to destroy metadata traces
  • 💻 Simple CLI interface
  • 📚 Ideal for cybersecurity & digital forensics learning

⚙️ Installation

Prerequisites

  • Python 3.8+
  • pip

Setup

  1. Clone the repository

    git clone https://github.com/osmankaankars/Secure-File-Shredder.git
    cd Secure-File-Shredder
  2. Create and activate a virtual environment

    python3 -m venv venv  
    source venv/bin/activate       # Windows: venv\Scripts\activate
  3. Install dependencies

    pip install -r requirements.txt

🚀 Usage

1️⃣ Basic Usage (Default: 3 Passes)

python shredder.py confidential_doc.pdf

2️⃣ Custom Pass Count (Example: 7 Passes)

python shredder.py confidential_doc.pdf -p 7

🔧 Command-Line Options

  • -p, --passes : Number of overwrite passes (default: 3)

🛠️ Technical Details

Overwriting Algorithm (DoD 5220.22-M Inspired)

  • Pass 1 → Pass N-1:
    Overwrites the full file size with cryptographically secure random bytes (via secrets.token_bytes).

  • Final Pass:
    Overwrites the file with 0x00 bytes to conceal random-pattern indicators.

I/O Synchronization

  • The tool enforces flush & fsync to force the OS to write changes to disk immediately.

Metadata Destruction

  • The file is renamed to a random alphanumeric string (e.g., a8X92kL1m.tmp) before final deletion.

Secure Deletion

  • After the final pass completes, the file is securely unlinked from the filesystem.

⚠️ Disclaimer

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.


👨‍💻 Author

Osman Kaan Kars
Cybersecurity Engineer | SAP Security Specialist

About

A Python-based anti-forensic tool implementing DoD 5220.22-M algorithms for secure file deletion and metadata obfuscation to prevent data recovery.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages