npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

secure-rm-cli

v1.0.0

Published

Completely erases files by making recovery impossible. (CLI for secure-rm)

Downloads

30

Readme

❓ Why

When you delete a file using the rm command or fs.unlink in node, it only remove direct pointers to the data disk sectors and make the data recovery possible with common software tools.

Permanent data erasure goes beyond basic file deletion commands, which:

  1. Allow for selection of a specific standard, based on unique needs, and
  2. Verify the overwriting method has been successful and removed data across the entire device.

📦 Install

This package is the command line interface version of secure-rm. To install it, run:

npm install secure-rm-cli -g

Looking for the npm module version? Visit secure-rm.

Secure-rm will retry 3 times if an error occur to ensure the task succeeded.

🚀 Getting started

If you want to delete files on the fly with a pass of cryptographically strong pseudo-random data, run:

secure-rm ./your-folder/*.js

When you submit files, secure-rm asks you if you are sure:

And then you get a complete log of what happened:

📚 Usage

secure-rm <PATHS> [OPTIONS]
  • PATHS:
    • one or multiple paths (e.g. D:\data /d/data ./data/file.js ../../data)
    • supports glob patterns (e.g. ./*.js ./**/* @(pattern|pat*|pat?erN))
  • OPTIONS (flags):
    • -f, --force: avoid checks if you want to use it in a shell or bash file;
    • -h, --help: show CLI help, see below;
    • -m, --mute: mutes the cli to the bare minimum, just the end messages;
    • -s, --standard: text ID of the standard, default is secure. See them detailed below;
    • -r, --retries: max retries if an error occur;
    • -t, --table : show the standards table. See them detailed below;
    • -v, --version : show CLI version;
    • --no-globbing : disable file globbing.

Example:

secure-rm ./folder/*.js ./file.js -s gutmann -f

You can invoke the built-in help with secure-rm -h:

Standards

ID | Name | Passes | Description -- | ---- | ------ | ----------- randomData | Pseudorandom data | 1 | Also kwown as "Australian Information Security Manual Standard ISM 6.2.92"and "New Zealand Information and Communications Technology Standard NZSIT 402" Your data is overwritten with cryptographically strong pseudo-random data. (The data is indistinguishable from random noise.) randomByte | Pseudorandom byte | 1 | Overwriting with a random byte. zeroes | Zeroes | 1 | Overwriting with zeroes. ones | Ones | 1 | Overwriting with ones. secure | Secure-rm standard | 3 | Pass 1: Overwriting with random data;Pass 2: Renaming the file with random data;Pass 3: Truncating between 25% and 75% of the file. GOST_R50739-95 | Russian State Standard GOST R 50739-95 | 2 | Pass 1: Overwriting with zeroes;Pass 2: Overwriting with random data. HMG_IS5 | British HMG Infosec Standard 5 | 3 | Also known as "Air Force System Security Instructions AFSSI-5020","Standard of the American Department of Defense (DoD 5220.22 M)""National Computer Security Center NCSC-TG-025 Standard"and "Navy Staff Office Publication NAVSO P-5239-26"Pass 1: Overwriting with zeroes;Pass 2: Overwriting with ones;Pass 3: Overwriting with random data as well as verifying the writing of this data. AR380-19 | US Army AR380-19 | 3 | Pass 1: Overwriting with random data;Pass 2: Overwriting with a random byte;Pass 3: Overwriting with the complement of the 2nd pass, and verifying the writing. VSITR | Standard of the Federal Office for Information Security (BSI-VSITR)| 7 | Also known as "Royal Canadian Mounted Police TSSIT OPS-II"Pass 1: Overwriting with zeroes;Pass 2: Overwriting with ones;Pass 3-6: Same as 1-2;Pass 7: Overwriting with a random data as well as review the writing of this character. schneier | Bruce Schneier Algorithm | 7 | Pass 1: Overwriting with zeros;Pass 2: Overwriting with ones;Pass 3-7: Overwriting with random data. pfitzner | Pfitzner Method | 33 | Pass 1-33: Overwriting with random data. gutmann | Peter Gutmann Algorithm | 35 | Pass 1-4: Overwriting with random data;Pass 5: Overwriting with 0x55;Pass 6: Overwriting with 0xAA;Pass 7-9: Overwriting with 0x92 0x49 0x24, then cycling through the bytes;Pass 10-25: Overwriting with 0x00, incremented by 1 at each pass, until 0xFF;Pass 26-28: Same as 7-9;Pass 29-31: Overwriting with 0x6D 0xB6 0xDB, then cycling through the bytes;Pass 32-35: Overwriting with random data.

Note: Node ensures that the file is correctly written, checking the writing in these algorithms is unnecessary. (Report this if I'm wrong)

🚩 Troubleshooting / Common issues

Should works on OS X, Linux (almost, see below), and Windows. (See build status)

File systems

secure-rm will only work on file systems that overwrite blocks in place.

List of known file systems that will not work:

  • ext3
  • ext4
  • AthFS – AtheOS
  • OneFS
  • ssd's at large
  • reiserfs
  • ...
  • especially on the vast majority of journaled file systems.

"WARN Too many open files, cannot ...:"

Don't worry, you've just submited too much file for Node. The tool will retry 3 times to ensure the task succeeded. While you don't get an error, the tool can handle this issue.

If you really need to delete millions of file in one time, split the task (e.g. ./your_folder/a* then ./your_folder/b* ...).

Using Windows:

Be sure to use secure-rm ".\path\file" with doublequotes since back-slashes will always be interpreted as escape characters, not path separators.

Another solution is to double the back-slashes like: secure-rm .\\path\\file

Or if you can, use forward slashes!

📜 Changelog

See the changelog or releases.

📌 TODO

  • [ ] Implement more tests

🏗 Contributing

See contributing guidelines

Licensing

This project is under MIT License.