Last active
April 24, 2018 22:31
-
-
Save subfission/853c9a28ded16fdcf12aa6bf56fd8806 to your computer and use it in GitHub Desktop.
Secure File Wipe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# @author: Zach Jetson | |
# | |
# Secure File Wiper | |
# | |
# Add this function to the bottom of your bash profile for a quick | |
# and dirty secure file clean. Works with Linux & MacOS. | |
secure_delete() { | |
DD_FILE=$1 | |
BLK_SZ=`wc -c < $DD_FILE` | |
[[ BLK_SZ -eq 0 ]] && echo "[!] Invalid file" && return | |
echo "Zeroing file ${DD_FILE}" | |
dd if=/dev/zero of=$DD_FILE count=1 conv=notrunc bs=$BLK_SZ 2> /dev/null | |
rm -f "$DD_FILE" | |
echo "[!] Securely erased $BLK_SZ bytes" | |
} | |
# Even more secure wiper | |
super_secure_delete(){ | |
DD_FILE=$1 | |
BLK_SZ=`wc -c < $DD_FILE` | |
[[ BLK_SZ -eq 0 ]] && echo "[!] Invalid file" && return | |
echo "DoD grade file erase ${DD_FILE}" | |
for ((n=1;n<8;n++)) | |
do | |
dd if=/dev/zero of=$DD_FILE count=1 conv=notrunc bs=$BLK_SZ 2> /dev/null | |
done | |
rm -f "$DD_FILE" | |
echo "[!] Securely erased $BLK_SZ bytes" | |
} | |
# Hide desktop icons in MacOS | |
hide_desktop_icons(){ | |
echo "Hiding desktop icons" | |
defaults write com.apple.finder CreateDesktop false | |
killall Finder | |
} | |
show_desktop_icons(){ | |
defaults write com.apple.finder CreateDesktop true | |
killall Finder | |
} | |
# | |
# Handy Methods | |
# --------------------- | |
# Interrogate SSL | |
ssl_interrogate_remote(){ | |
HOST=$1 | |
if [ -z "$HOST" ]; then | |
echo "[!] Error: missing domain in argument" | |
echo | |
echo "usage: ssl_remotecert domain" | |
echo | |
echo " domain\tThe domain to query for SSL certs" | |
echo | |
else | |
echo | openssl s_client -servername $HOST -connect $HOST:443 2>/dev/null | openssl x509 -noout -text | |
fi | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment