Skip to main content

Python implementation of shred. Calls into port of github.com/rozbb/rust-shred using Py03

Project description

Description

This is a python library for securely deleting (shredding) files and directories. The code calls into rozbb's rust-shred library using Py03 and maturin. I merely modernized the code (the code was written >10 years ago) and made it callable from Python

Why Shredding?

Computers typically "delete" files by removing the file system reference to the file. This means disk recovery tools can possibly find and recover the file.

So why do we overwrite multiple times?

Each time a transistor is toggled, slight remenants of the previous states remain. This means parts of files can still be recovered using state of the art tools.

Using multiple passes effectively burns out all traces of the old state, the more passes, the better.

Warning

There are cases where data is duplicated which this deletion method doesn't detect and handle. Examples are the file system journal and overprovisioned SSD's.

I suggest reading NIST Special Publication 800 NIST SP 800-88r2 section '3.1.1. Clear Sanitization Method' for more information.

If privacy is a true goal of yours, You'd be far better off switching to an operating system like TAILS.

Example Usage

from test_stuff import shred
from pathlib import Path


f = Path("./secrets")
f.write_text("My password is foo123!")
shred(
    path: f, # Which file are we shredding
    n_passes: 10, # How many times is this file overwritten with random bytes
    remove: True, # Is this file deleted after shredding
    size: None, # How many bytes we want to shred. If None, the entire file is shredded.
    exact: True, # If true, delete exactly size bytes, otherwise delete size rounded up to the next page table boundary
    zero: True, # Do we do an additional pass to zero out the file.
    verbose: False, # Do we print debug information
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

file_shredder-0.1.2.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

file_shredder-0.1.2-cp39-abi3-macosx_11_0_arm64.whl (237.1 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file file_shredder-0.1.2.tar.gz.

File metadata

  • Download URL: file_shredder-0.1.2.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for file_shredder-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9411f405154422b4d0e96cb32e29430ee983f7fda0cd70a99b48454dd33d7a60
MD5 db68866953c66c2f8f5e50b703075db9
BLAKE2b-256 08e546da6b140281e0c5e7ab501ab477400d9951b18fc86f7cc74b9521b508ad

See more details on using hashes here.

File details

Details for the file file_shredder-0.1.2-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: file_shredder-0.1.2-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 237.1 kB
  • Tags: CPython 3.9+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for file_shredder-0.1.2-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 deb013823bc08d513d73c9c28ce77812e6e7d3d04f1e14329b13158fdf399e6c
MD5 b33d70bd22e33dd4b8efc70a95c3dd1f
BLAKE2b-256 80cd3e39850e73dc5ed4d11c7a93fbfede5eae63e7d6b38656ebdea1c9a823c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page