#progress-bar #overwrite #times #securely #file #random #data

secure_purge

SecurePurge is a crate for securely deleting files by overwriting their data multiple times. It is easy to use, supports removing single files, directories, and multiple files with unique names, and allows customization of overwrite times. The tool relies on dependencies like indicatif for progress bars, rand for generating random overwrite data, and colored for output readability. SecurePurge is open-source and welcomes contributions. Future enhancements include adding disk formatting and optimizing performance. It is licensed under the MIT License. Stay tuned for more updates.

1 unstable release

0.1.0 Jan 30, 2024

#967 in Filesystem

MIT license

13KB
174 lines

SecurePurge

Introduction

SecurePurge is a rust crate designed for securely deleting files from a filesystem. It employs a method where file data is overwritten several times before the file is finally deleted, ensuring that the data is not easily recoverable. This tool is particularly useful for situations where sensitive data needs to be securely erased from storage devices.

How to Use

SecurePurge is straightforward to use with its syntax. Here are some examples of how to use SecurePurge:

Usage examples:

Removing a Single File


#[tokio::main]
async fn main() {
    let file_path = PathBuf::from("path/to/your/file.txt");
    let remover = FileRemover::new(5, file_path, false).unwrap();
    remover.delete().await.unwrap();
}

Removing a Directory and Its Contents


#[tokio::main]
async fn main() {
    let dir_path = PathBuf::from("path/to/your/directory");
    let remover = FileRemover::new(5, dir_path, true).unwrap();
    remover.delete().await.unwrap();
}

Removing Multiple Files with Unique Filenames


#[tokio::main]
async fn main() {
    // Generate 10 files with unique names in a temporary directory
    let dir = tempfile::TempDir::new().unwrap();
    for i in 0..10 {
        let file_name = format!("file{}.txt", i);
        let file_path = dir.path().join(file_name);
        let mut file = File::create(file_path).unwrap();
        write!(file, "File {} contents", i).unwrap();
    }

    // Remove all files from the temporary directory
    let remover = FileRemover::new(5, dir.path().to_path_buf(), false).unwrap();
    remover.delete().await.unwrap();
}

Customize Overwrite Times

Increase the overwrite times to enhance the security of file removal.


#[tokio::main]
async fn main() {
    let file_path = PathBuf::from("path/to/your/file.txt");
    let remover = FileRemover::new(100, file_path, false).unwrap();
    remover.delete().await.unwrap();
}

Dependencies

SecurePurge relies on several dependencies to function properly:

  • indicatif: A Rust crate for creating progress bars. SecurePurge uses indicatif to display progress when securely deleting files. (Current Version: 0.17.7)

  • rand: This is a Rust crate that provides functionalities for generating random numbers. In SecurePurge, it is used to generate random data to overwrite files during the secure deletion process. (Current Version: 0.8.5)

  • colored: A Rust crate for coloring terminal output. SecurePurge uses colored to enhance the readability of its output. (Current Version: 2.1.0)

Contributors

SecurePurge is an open-source project, and contributions are welcome. If you're interested in contributing, please feel free to fork the repository, make your changes, and submit a pull request.

Future Enhancements

  • The addition of the disk formatting feature, which will allow for secure erasing of entire storage devices.
  • Further optimization and testing on various filesystems and platforms.

License

SecurePurge is licensed under MIT License. Feel free to use, modify, and distribute the code as per the license terms.


SecurePurge is still in active development, and new features and improvements are continually being added. Stay tuned for more updates and enhancements.

Dependencies

~4–11MB
~123K SLoC