Skip to content

Instantly share code, notes, and snippets.

@UnleashTheCode
Last active January 25, 2024 01:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save UnleashTheCode/eda2966e05a367b5e247abed37b39094 to your computer and use it in GitHub Desktop.
Save UnleashTheCode/eda2966e05a367b5e247abed37b39094 to your computer and use it in GitHub Desktop.
A scripts to improve the quality of life on your kali
#!/bin/bash
ls ~/.zshrc_copy || cp ~/.zshrc ~/.zshrc_copy
# Abort on errors
set -e
# Function to install a package only if it's not already installed
function install_if_needed() {
local pkg="$1"
if ! dpkg -l "$pkg" &>/dev/null ; then
echo "Installing $pkg..."
if sudo apt install -y "$pkg" > /dev/null 2>&1; then
echo "Successfully installed $pkg."
else
echo "Failed to install $pkg."
exit 1
fi
fi
}
# Updating System
echo "Updating system..."
if sudo apt update > /dev/null 2>&1; then
echo "System update successful."
else
echo "System update failed."
exit 1
fi
# List of packages to be installed
packages=("bat" "rlwrap" "grc" "tig" "ripgrep" "sshuttle" "httpie" "exa" "golang-go" "hurl" "jq" "fd-find" "feroxbuster" "terminator" "pipx")
for pkg in "${packages[@]}"; do
install_if_needed "$pkg"
done
echo "Removing unnecessary packages..."
if sudo apt -y autoremove > /dev/null 2>&1; then
echo "Successfully removed unnecessary packages."
else
echo "Failed to remove unnecessary packages."
exit 1
fi
# Install fzf if not already
if ! command -v fzf &>/dev/null; then
echo "Installing fzf..."
if git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf > /dev/null 2>&1 && ~/.fzf/install --all > /dev/null 2>&1; then
echo "Successfully installed fzf."
else
echo "Failed to install fzf."
exit 1
fi
fi
# Install nuclei if not already
if ! command -v nuclei &>/dev/null; then
echo "Installing nuclei..."
if GO111MODULE=on go install -v github.com/projectdiscovery/nuclei/v2/cmd/nuclei@latest > /dev/null 2>&1; then
echo "Successfully installed nuclei."
else
echo "Failed to install nuclei."
exit 1
fi
fi
# FZF with fd
if ! grep -q "export FZF_DEFAULT_COMMAND='fdfind'" ~/.zshrc; then
echo "Updating .zshrc with FZF defaults..."
echo "export FZF_DEFAULT_COMMAND='fdfind'" >> ~/.zshrc
echo 'export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"' >> ~/.zshrc
echo 'export FZF_COMPLETION_OPTS="--height 40%"' >> ~/.zshrc
echo "Successfully updated .zshrc with FZF defaults."
fi
# Source fzf setup script
grep -q '[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh' ~/.zshrc || echo '[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh' >> ~/.zshrc
# Completion
echo >> ~/.zshrc
git clone https://github.com/rsherstnev/zshcompletions.git
sudo mv zshcompletions/_* /usr/share/zsh/functions/Completion/Unix/
git clone https://github.com/zsh-users/zsh-completions.git
sudo mv zsh-completions/src/_* /usr/share/zsh/functions/Completion/Unix/
rm -rf zsh-completions
rm -rf zshcompletions
# Initialize completion
grep -q 'autoload -Uz compinit && compinit' ~/.zshrc || echo 'autoload -Uz compinit && compinit' >> ~/.zshrc
echo >> ~/.zshrc
# grc
grep -q '[[ -s "/etc/grc.zsh" ]] && source /etc/grc.zsh' ~/.zshrc || echo '[[ -s "/etc/grc.zsh" ]] && source /etc/grc.zsh' >> ~/.zshrc
echo >> ~/.zshrc
# cht.sh
sudo curl https://cht.sh/:cht.sh -o /bin/cht.sh
sudo chmod +x /bin/cht.sh
# FZF with fd
grep -q "export FZF_DEFAULT_COMMAND='fdfind'" ~/.zshrc || echo "export FZF_DEFAULT_COMMAND='fdfind'" >> ~/.zshrc
grep -q 'export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"' ~/.zshrc || echo 'export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"' >> ~/.zshrc
grep -q 'export FZF_COMPLETION_OPTS="--height 60%"' ~/.zshrc || echo 'export FZF_COMPLETION_OPTS="--height 60%"' >> ~/.zshrc
echo >> ~/.zshrc
#Alias
grep -q 'alias cat="/usr/bin/batcat"' ~/.zshrc || echo 'alias cat="/usr/bin/batcat"' >> ~/.zshrc
grep -q 'alias snano="sudo nano"' ~/.zshrc || echo 'alias snano="sudo nano"' >> ~/.zshrc
grep -q 'alias ls="exa --icons -F -lh"' ~/.zshrc || echo 'alias ls="exa --icons -F -lh"' >> ~/.zshrc
grep -q 'alias ll="exa -F -lha"' ~/.zshrc || echo 'alias ll="exa -F -lha"' >> ~/.zshrc
grep -q 'alias tree="exa -lT"' ~/.zshrc || echo 'alias tree="exa -lT"' >> ~/.zshrc
grep -q 'alias find="fdfind"' ~/.zshrc || echo 'alias find="fdfind"' >> ~/.zshrc
grep -q "alias aptupdate='sudo apt update && sudo apt upgrade -y && sudo apt full-upgrade -y && sudo apt dist-upgrade -y && sudo apt autoremove -y'" ~/.zshrc || echo "alias aptupdate='sudo apt update && sudo apt upgrade -y && sudo apt full-upgrade -y && sudo apt dist-upgrade -y && sudo apt autoremove -y'" >> ~/.zshrc
grep -q 'alias cme="crackmapexec"' ~/.zshrc || echo 'alias cme="crackmapexec"' >> ~/.zshrc
grep -q 'alias hurl="hURL"' ~/.zshrc || echo 'alias hurl="hURL"' >> ~/.zshrc
grep -q 'alias serve="python -m http.server 80"' ~/.zshrc || echo 'alias serve="python -m http.server 80"' >> ~/.zshrc
echo >> ~/.zshrc
#ENV
grep -q "dir_small=/usr/share/wordlists/dirbuster/directory-list-2.3-small.txt" ~/.zshrc || echo "dir_small=/usr/share/wordlists/dirbuster/directory-list-2.3-small.txt" >> ~/.zshrc
grep -q "dir_medium=/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt" ~/.zshrc || echo "dir_medium=/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt" >> ~/.zshrc
grep -q "rockyou=/usr/share/wordlists/rockyou.txt" ~/.zshrc || echo "rockyou=/usr/share/wordlists/rockyou.txt" >> ~/.zshrc
echo >> ~/.zshrc
pipx ensurepath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment