Permenently disable bash history
parent
9543c4499d
commit
6ca21923e0
|
@ -15,9 +15,8 @@ echo
|
|||
echo "Select an option :"
|
||||
echo
|
||||
echo "1) Clear auth & bash history for user $USER"
|
||||
echo "2) Permenently disable bash log"
|
||||
echo "3) Kill current session"
|
||||
echo "4) Restore settings to default"
|
||||
echo "2) Permenently disable bash history"
|
||||
echo "3) Restore settings to default"
|
||||
echo "99) Exit tool"
|
||||
echo
|
||||
|
||||
|
@ -29,35 +28,58 @@ if [[ $option == 1 ]]; then
|
|||
# Clear current history
|
||||
if [ -w /var/log/auth.log ]; then
|
||||
echo "" > /var/log/auth.log
|
||||
echo "/var/log/auth.log cleaned."
|
||||
echo "[+] /var/log/auth.log cleaned."
|
||||
else
|
||||
echo "[!] /var/log/auth.log is not writable! Retry using sudo."
|
||||
fi
|
||||
|
||||
|
||||
if [ -a ~/.zsh_history ]; then
|
||||
echo "" > ~/.zsh_history
|
||||
echo "~/.zsh_history cleaned."
|
||||
echo "[+] ~/.zsh_history cleaned."
|
||||
fi
|
||||
|
||||
echo "" > ~/.bash_history
|
||||
rm ~/.bash_history -rf
|
||||
echo "~/.bash_history cleaned."
|
||||
|
||||
echo "[+] ~/.bash_history cleaned."
|
||||
|
||||
history -c
|
||||
|
||||
echo "Bash history cleaned."
|
||||
echo "Reminder: your need to kill current terminal session to see changes."
|
||||
echo "[+] History file deleted."
|
||||
|
||||
echo
|
||||
echo "Reminder: your need to reload the session to see effects."
|
||||
echo "Type exit to do so."
|
||||
elif [[ $option == 2 ]]; then
|
||||
# Permenently disable bash log
|
||||
ln /dev/null ~/.bash_history -sf # Permanently send history to /dev/null
|
||||
ln /dev/null ~/.bash_history -sf
|
||||
echo "[+] Permanently sending bash_history to /dev/null"
|
||||
|
||||
if [ -a ~/.zsh_history ]; then
|
||||
ln /dev/null ~/.zsh_history -sf
|
||||
echo "[+] Permanently sending zsh_history to /dev/null"
|
||||
fi
|
||||
|
||||
export HISTFILESIZE=0
|
||||
export HISTSIZE=0
|
||||
unset HISTFILE
|
||||
echo "[+] Set HISTFILESIZE & HISTSIZE to 0"
|
||||
|
||||
set +o history
|
||||
|
||||
echo
|
||||
echo "Permenently disabled bash log."
|
||||
elif [[ $option == 3 ]]; then
|
||||
kill -9 $$ # Kill current session
|
||||
elif [[ $option == 4 ]]; then
|
||||
# Restore settings to default
|
||||
echo "4"
|
||||
# Restore default settings
|
||||
#ln /dev/null ~/.bash_history -sf
|
||||
echo "[+] Disabled sending history to /dev/null"
|
||||
|
||||
export HISTFILESIZE=""
|
||||
export HISTSIZE=50000
|
||||
echo "[+] Restore HISTFILESIZE & HISTSIZE default values"
|
||||
|
||||
echo
|
||||
echo "Permenently enabeld bash log."
|
||||
elif [[ $option == 99 ]]; then
|
||||
exit 1
|
||||
else
|
||||
echo "Option not reconized. Exiting."
|
||||
echo "[!] Option not reconized. Exiting."
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue