#!/bin/bash
# Filename: Zero-it
# Author: robz
# Version: 150910
# Use as a right clicker for the nautilus-scripts directory.
# This will create a very large file effectively overwriting all free drive
# space with zeros or random characters, on completion this file is deleted.
# Zeros can take a while on a big drive, random a very long time.
# You will need package "apt-get install dcfldd"
C3="\033[1m\E[33m" # yellow
C6="\033[1m\E[36m" # cyan
C7="\033[1m\E[37m" # white
SOUND=/home/robz1/Audio/Success.wav
ICON=/usr/share/icons/gnome/scalable/emotes/face-smile.svg
NORMAL="NORMAL - zeros-fastish"
PARANOID="PARANOID - random-vslow"
TITLE="FREE SPACE OVERWRITE"
FILE=/home/robz1/TO_BE_DELETED
FREE=`df | awk '/sda2/ {print $4/1024}'`
VERBAL=$C3"WORKING.........."\\n$C7"Approx space to overwrite $FREE""Mb"\\n\
$C3"Press Ctrl+C to exit"$C6
MODE=$(zenity --title "Zero-It" --width 235 --height 190 --list --text \
"Select write mode - I am:" --radiolist --column "" --column "" \
TRUE "$NORMAL" FALSE "$PARANOID");
if [ $? = 1 ]; then
exit $?
fi
MODE=$(echo $MODE | sed "s/$NORMAL/zero/g; s/$PARANOID/urandom/g;")
gnome-terminal --geometry=42x15 --title="$TITLE" -x bash -c "\
trap 'rm -f "$FILE" 2>/dev/null; killall dcfldd; exit' TERM INT SIGKILL;\
echo -e '$VERBAL';\
sync;\
dcfldd if=/dev/$MODE of=$FILE statusinterval=10 bs=10M conv=notrunc;\
echo -e 'File: \"TO_BE_DELETED\" is being deleted';\
sync && rm -f $FILE;\
echo 'ALL DONE.........';\
notify-send -i $ICON '## OPERATION COMPLETE ##';\
/usr/bin/canberra-gtk-play --volume 6 -f $SOUND"
exit
No comments:
Post a Comment