Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TARGET=$1
- if [ -z $TARGET ];
- then
- echo "You must specify a file to destroy";
- else
- if [ ! -w $TARGET ];
- then
- echo "Cannot write target file, do you have permissions?";
- else
- SIZE=`stat -c%s $TARGET`;
- URL="http://www.random.org/cgi-bin/randbyte?nbytes=$SIZE&format=f"
- if [ $SIZE -lt 1 ];
- then
- echo "ERROR: Unable to stat file";
- else
- if [ -z $2 ];
- then
- ITERATIONS=32;
- else
- ITERATIONS=$2
- fi
- echo "Killing $TARGET; FileSize $SIZE; $ITERATIONS iterations";
- for i in `seq 1 $ITERATIONS`;
- do
- (curl $URL > ./rand) 2>/dev/null
- dd if=./rand of=$TARGET bs=1 count=$SIZE 2>/dev/null;
- rm -f ./rand;
- echo "Iteration $i Finished";
- done
- dd if=/dev/zero of=$TARGET bs=1 count=$SIZE 2>/dev/null;
- rm -f $TARGET;
- fi
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment