Advertisement
FlyFar

wiper.sh

Jul 10th, 2023
894
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.01 KB | Cybersecurity | 0 0
  1. #!/usr/bin/env bash
  2. #   Keeping it portable.
  3. #   see:    https://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html
  4.  
  5.  
  6. ### FAIR WARNING!
  7. ##  THIS SCRIPT IS LIVE AND ARMED!
  8. #   IT WILL DELETE DATA!
  9.  
  10. #   This script is a version of another server wiping script, but with all the security checks removed.
  11. #   see:    https://github.com/kkarhan/misc-scripts/blob/master/server_wipe.sh
  12.  
  13.  
  14. echo    "Detecting Blockdevices..."
  15.  
  16. lsblk -e7 -d -io NAME -n
  17. #   lists devices, excluding loopback devices partitions and header line.
  18. #   see:    https://unix.stackexchange.com/questions/414305/lsblk-capture-only-the-disks
  19. #   output should only yield /dev/ devicenames like sda & nvme0n1
  20.  
  21.  
  22. echo    "Starting wipe..."
  23.  
  24. mapfile -t my_array < <(lsblk -e7 -d -io NAME -n)
  25.  
  26. for i in "${my_array[@]}"
  27. do
  28.     shred -f -n 1 -v -z /dev/$i
  29.     echo    "/dev/$i nuked!"
  30.     echo    " "
  31. done
  32. #   wipe each detected disk [physical block device] twice with shred & output progress
  33.  
  34. echo    " "
  35. echo    "finished!"
  36.  
  37. exit
  38. #   Quit Script
Tags: BASH wiper
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement