From 8712778613d11dcddaa8d18b3e0bb11c45c93f9e Mon Sep 17 00:00:00 2001 From: Root THC Date: Fri, 28 Jun 2024 13:05:17 +0100 Subject: [PATCH] hackshell --- tools/hackshell.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/hackshell.sh b/tools/hackshell.sh index 8c75049..7e533ee 100755 --- a/tools/hackshell.sh +++ b/tools/hackshell.sh @@ -14,6 +14,7 @@ # Environment variables: # XHOME= Set custom XHOME directory instead of /dev/shm/.$'\t''~?$:?' # +# https://github.com/hackerschoice/thc-tips-tricks-hacks-cheat-sheet/blob/master/tools/hackshell.sh # 2024 by theM0ntarCann0n & skpr CY="\033[1;33m" # yellow @@ -31,6 +32,7 @@ CF="\033[2m" # faint CN="\033[0m" # none CW="\033[1;37m" + ### Functions to keep in memory HS_ERR() { echo -e >&2 "${CR}ERROR: ${CDR}$*${CN}"; } HS_WARN() { echo -e >&2 "${CY}WARN: ${CDM}$*${CN}"; } @@ -94,6 +96,7 @@ notime() { date --set="$now" >/dev/null || return } + # Presever mtime, ctime and birth-time as best as possible. # notime_cp notime_cp() { @@ -204,6 +207,8 @@ hs_exit() { hs_init() { local a local prg="$1" + + [ -z "$BASH" ] && { HS_ERR "Needs BASH"; return 255; } [ "${prg##*\.}" = "sh" ] && { HS_ERR "Use ${CDC}source $prg${CDR} instead"; exit 255; } [ -z "$UID" ] && UID="$(id -u)" @@ -232,13 +237,13 @@ hs_init_alias() { } ### Programm -hs_init "$0" +hs_init "$0" || return #zsh shall bail. bash continues hs_init_alias export HISTFILE="/dev/null" export BASH_HISTORY="/dev/null" export LANG=C.UTF-8 -locale -a 2>/dev/null|grep -Fqim1 C.UTF-8 || export LANG=C +locale -a 2>/dev/null|grep -Fqim1 C.UTF || export LANG=C export LESSHISTFILE=- export REDISCLI_HISTFILE=/dev/null export MYSQL_HISTFILE=/dev/null