hackerschoice / hackshell

Make BASH stealthy and hacker friendly with lots of bash functions
212 stars 22 forks source link

fixed issue with shred function #3

Closed Extr3m4R4710 closed 3 months ago

Extr3m4R4710 commented 3 months ago

When sourcing the current hackshell in MnajaroLinux environment, an error occurs when parsing the shred() function.

[UserName@localhost ~]% source <(curl -SsfL https://thc.org/hs)
bash: /dev/fd/63: line 187: syntax error near unexpected token `('
bash: /dev/fd/63: line 187: `command -v shred >/dev/null || shred() {'

I fixed line 187

# SHRED without shred command
custom_shred() {
    [[ -z $1 || ! -f "$1" ]] && { echo >&2 "shred [FILE]"; return 255; }
    dd status=none bs=1k count=$(du -sk "${1:?}" | cut -f1) if=/dev/urandom of="$1"
    rm -f "${1:?}"
}

if ! command -v shred >/dev/null; then
    alias shred='custom_shred'
fi

In this pull request, we aim to change the judgment using an OR expression to an if statement and reapply the shred command using an alias (if the shred command binary does not exist). At least it worked in my ManjaroLinux as Blackarch environment. Screenshot_2024-08-14_15-21-55

If you have any questions, we are always available.