Code Monkey home page Code Monkey logo

autoshred's Introduction

PayPal donate button License

Overview: autoshred

Shred wrapper script that will allow you to plug in external drives and automatically wipe the data. While shooting, smashing, and drilling harddrives is cool and fun, why not repurpose the drives?


Usage

Installation

sudo apt update
sudo apt install -y git coreutils vim screen
git clone https://github.com/pgporada/autoshred && cd autoshred
mv autoshred.example.conf autoshred.conf
lsblk
# Configure your exclusion list to drives that should not be wiped
vim autoshred.conf

Starting the program on boot

sudo crontab -e
@reboot /usr/bin/screen -d -m /home/pi/autoshred/autoshred.sh -f

Displays some help

./autoshred -h

Destroy data

sudo ./autoshred -f

Verifying that autoshred is running

screen -ls
ps aux | grep shred

Development/Testing

The average user shouldn't need to worry about this section. This will take you through the process of creating a vagrant and a garbage volume to test the script out

vagrant up
vagrant ssh

Create a volume, mount it, and destroy it

vagrant@ubuntu-xenial:/vagrant$ sudo dd if=/dev/zero of=MyDrive.img bs=1M count=500
500+0 records in
500+0 records out
524288000 bytes (524 MB, 500 MiB) copied, 2.90638 s, 180 MB/s

vagrant@ubuntu-xenial:/vagrant$ sudo fdisk MyDrive.img

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x5cb4896a.

Command (m for help): p
Disk MyDrive.img: 500 MiB, 524288000 bytes, 1024000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5cb4896a

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
   Select (default p): p
   Partition number (1-4, default 1): 1
   First sector (2048-1023999, default 2048):
   Last sector, +sectors or +size{K,M,G,T,P} (2048-1023999, default 1023999):

   Created a new partition 1 of type 'Linux' and of size 499 MiB.

   Command (m for help): w
   The partition table has been altered.
   Syncing disks.

vagrant@ubuntu-xenial:/vagrant$ sudo mkfs -t ext4 MyDrive.img
mke2fs 1.42.13 (17-May-2015)
Found a dos partition table in MyDrive.img
Proceed anyway? (y,n) y
Creating filesystem with 512000 1k blocks and 128016 inodes
Filesystem UUID: 48ea4ef2-6393-46e4-b35b-ddf06b27e6a4
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409

Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

vagrant@ubuntu-xenial:/vagrant$ sudo mount -t ext4 MyDrive.img /media/test/

vagrant@ubuntu-xenial:/vagrant$ lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   10G  0 disk
└─sda1   8:1    0   10G  0 part /
sdb      8:16   0   10M  0 disk
loop0    7:0    0  500M  0 loop /media/test

Thanks

Thank you for using my software! If you find my code useful to you or your organization, please consider donating some beer money to me via the PayPal badge above. 😄 🍻

Thanks to http://www.retrojunkie.com/asciiart/cartchar/turtles.htm for the Shredder ascii art.

(C) Phil Porada

autoshred's People

Contributors

pgporada avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

autoshred's Issues

Does it continue to run if you logout?

Greetings! I SSH into a RPi machine and started the script manually (versus configuring to run on boot). I logged out of the session and noted that the HDD activity light on my HDD dock was still blinking, may I assume that means it's still running? If so, may I also assume the dock HDD activity light will stop blinking once it's complete?

Replacing nwipe with shred

Replacing nwipe with shred command instead. On the raspberry pi nwipe will randomly lock up when shredding multiple hard drives at the same time.

Question - What do all the rows in the shredder monitoring window mean?

None of them appear to be labelled. I'm a Linux newb with no code experience so most of this is new to me. I can figure out a few of them like drive ID and data write rate, but the rest of them are a mystery to me, like ETA if that's even there. There does appear to be two time-formatted sections, but those don't count or read like the time...except the first one which I believe was the start time. I also couldn't find documentation about the info present in the monitor window. Can you explain them for me?

Rewrite this tool in Golang

I've come to the realization that to further my skills, I need to learn anything other than bash shell scripting. Hence my goal for this project is to rewrite basic functionality with Golang. I'll still shell out to shred because fuuuuuuck rewriting that. Something cool is that I can implement prometheus metrics and close out ticket #3.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.