Skip to content

Instantly share code, notes, and snippets.

@UnleashTheCode
Last active September 16, 2024 07:28
Show Gist options
  • 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
# Ensure backup of .zshrc
cp ~/.zshrc ~/.zshrc_copy 2>/dev/null || true
# Add go to path
echo "export PATH=$PATH:/home/$USER/go/bin" >> ~/.zshrc
export PATH=$PATH:/home/$USER/go/bin
# Abort on errors
set -e
# Function to install a package only if it's not already installed
install_if_needed() {
local pkg="$1"
if ! dpkg -l "$pkg" &>/dev/null; then
echo "Installing $pkg..."
sudo apt install -y "$pkg" &>/dev/null && echo "Successfully installed $pkg." || { echo "Failed to install $pkg."; exit 1; }
fi
}
# Update system
echo "Updating system..."
if ! grep -q 'deb \[arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg\]' /etc/apt/sources.list.d/docker.list; then
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian bookworm stable" | sudo tee /etc/apt/sources.list.d/docker.list
fi
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo apt update &>/dev/null && echo "System update successful." || { echo "System update failed."; exit 1; }
# List of packages to install
packages=("thefuck" "filezilla" "jd-gui" "fzf" "bat" "rlwrap" "grc" "tig" "ripgrep" "httpie" "lsd" "libpcap-dev" "golang-go" "hurl" "jq" "fd-find" "feroxbuster" "slowhttptest" "terminator" "xsltproc" "docker-ce" "docker-ce-cli" "containerd.io" "ansible" "flameshot" "copyq" "peass" "netexec" "pipx" "autorecon")
for pkg in "${packages[@]}"; do
install_if_needed "$pkg"
done
# Remove unnecessary packages
echo "Removing unnecessary packages..."
sudo apt -y autoremove &>/dev/null && echo "Successfully removed unnecessary packages." || { echo "Failed to remove unnecessary packages."; exit 1; }
# Add your user to docker
echo "Add $USER to docker group, log off and log on needed"
sudo usermod -aG docker "$USER"
# Install Nuclei if not already installed
echo "Installing Nuclei..."
command -v nuclei &>/dev/null || {
GO111MODULE=on go install -v github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest &>/dev/null && echo "Successfully installed nuclei." || { echo "Failed to install nuclei."; exit 1; }
}
# Install katana if not already installed
echo "Installing katana..."
command -v katana &>/dev/null || {
GO111MODULE=on go install github.com/projectdiscovery/katana/cmd/katana@latest &>/dev/null && echo "Successfully installed katana." || { echo "Failed to install katana."; exit 1; }
}
# Install unfurl if not already installed
echo "Installing unfurl..."
command -v unfurl &>/dev/null || {
GO111MODULE=on go install -v github.com/tomnomnom/unfurl@latest &>/dev/null && echo "Successfully installed unfurl." || { echo "Failed to install unfurl."; exit 1; }
}
# Install naabu if not already installed
echo "Installing naabu..."
command -v naabu &>/dev/null || {
GO111MODULE=on go install -v github.com/projectdiscovery/naabu/v2/cmd/naabu@latest &>/dev/null && echo "Successfully installed naabu." || { echo "Failed to install naabu."; exit 1; }
}
# Remove existing httpx and install ProjectDiscovery httpx
echo "Managing httpx installation..."
command -v httpx &>/dev/null && sudo apt remove -y python3-httpx
command -v httpx &>/dev/null || {
GO111MODULE=on go install -v github.com/projectdiscovery/httpx/cmd/httpx@latest &>/dev/null && echo "Successfully installed httpx." || { echo "Failed to install httpx."; exit 1; }
}
# Install Ligolo
ls /opt/ligolo-ng || {
echo "Installing Ligolo...";
sudo git clone https://github.com/nicocha30/ligolo-ng.git /opt/ligolo-ng;
sudo mkdir -p /opt/ligolo-ng/bin;
cd /opt/ligolo-ng;
sudo go build -o /opt/ligolo-ng/bin/server /opt/ligolo-ng/cmd/proxy/main.go;
sudo go build -o /opt/ligolo-ng/bin/agent /opt/ligolo-ng/cmd/agent/main.go;
sudo ln -s /opt/ligolo-ng/bin/server /usr/bin/ligolo;
sudo mkdir /opt/ligolo-ng/agents;
cd /opt/ligolo-ng/agents;
curl -s https://api.github.com/repos/nicocha30/ligolo-ng/releases/latest | grep "browser_download_url.*" | cut -d : -f 2,3 | tr -d \" | sudo wget -qi -;
/usr/bin/find /opt/ligolo-ng/agents 'ligolo-ng_agent_*' -exec sh -c '
for dir do
newname=$(echo "$dir" | awk -F _ "{print \$(NF-1) \"_\" \$NF}")
sudo mv -- "$dir" "$newname"
done
' sh {} +;}
# Install Reverse SSH
ls /opt/reverse_ssh &>/dev/null || {
echo "Installing Reverse SSH...";
sudo git clone https://github.com/NHAS/reverse_ssh.git /opt/reverse_ssh;
cd /opt/reverse_ssh;
sudo make;
sudo ln -s /opt/reverse_ssh/reverse_ssh /usr/bin/reverse_ssh;}
# Install duplicut
ls /opt/duplicut &>/dev/null || command -v duplicut || {
echo "Installing duplicut...";
sudo git clone https://github.com/nil0x42/duplicut /opt/duplicut;
cd /opt/duplicut;
sudo make;
sudo ln -s /opt/duplicut/duplicut /usr/bin/duplicut;}
# Install jwt_tool
command -v jwt_tool.py &>/dev/null || {
echo "Installing jwt_tool...";
sudo git clone https://github.com/ticarpi/jwt_tool.git /opt/jwt_tool;
sudo chmod +x /opt/jwt_tool/jwt_tool.py;
sudo ln -s /opt/jwt_tool/jwt_tool.py /usr/bin/jwt_tool.py;}
# Install duplicut
ls /opt/krbrelayx &>/dev/null || command -v addspn.py || {
echo "Installing krbrelayx...";
sudo git clone https://github.com/dirkjanm/krbrelayx.git /opt/krbrelayx;
sudo chmod +x /opt/krbrelayx/addspn.py /opt/krbrelayx/dnstool.py /opt/krbrelayx/krbrelayx.py /opt/krbrelayx/printerbug.py
sudo ln -s /opt/krbrelayx/addspn.py /usr/bin/addspn.py;
sudo ln -s /opt/krbrelayx/dnstool.py /usr/bin/dnstool.py;
sudo ln -s /opt/krbrelayx/krbrelayx.py /usr/bin/krbrelayx.py;
sudo ln -s /opt/krbrelayx/printerbug.py /usr/bin/printerbug.py;}
# Install rsa_sign2n
# command -v rsa_sign2n &>/dev/null || {
# echo "Installing rsa_sign2n...";
# sudo git clone https://github.com/silentsignal/rsa_sign2n.git /opt/rsa_sign2n;
# cd /opt/rsa_sign2n/standalone;
# sudo systemctl start docker;
# sudo docker build -t . rsa_sign2n;
# sudo systemctl stop docker;}
# Install DNSrebinder
command -v dnsrebinder &>/dev/null || {
echo "Installing DNSrebinder...";
sudo git clone https://github.com/mogwailabs/DNSrebinder.git /opt/DNSrebinder;
pip3 install dnslib;
sudo chmod +x /opt/DNSrebinder/dnsrebinder.py;
sudo ln -s /opt/DNSrebinder/dnsrebinder.py /usr/bin/dnsrebinder;}
# Installing anew
echo "Installing anew"
command -v anew &>/dev/null || {
GO111MODULE=on go install -v github.com/tomnomnom/anew@latest &>/dev/null && echo "Successfully installed anew." || { echo "Failed to install anew."; exit 1; }
}
# Installing qsreplace
echo "Installing qsreplace"
command -v qsreplace &>/dev/null || {
GO111MODULE=on go install -v github.com/tomnomnom/qsreplace@latest &>/dev/null && echo "Successfully installed qsreplace." || { echo "Failed to install qsreplace."; exit 1; }
}
# Install SSTImap
command -v sstimap &>/dev/null || {
echo "Installing SSTImap";
cd /opt;
sudo git clone https://github.com/vladko312/SSTImap.git;
cd SSTImap;
sudo chmod +x sstimap.py;
sudo ln -s /opt/SSTImap/sstimap.py /usr/bin/sstimap;}
# Install Penelope
command -v penelope &>/dev/null || {
echo "Installing Penelope";
sudo git clone -b dev https://github.com/brightio/penelope.git /opt/penelope;
cd /opt/penelope;
sudo chmod +x penelope.py;
sudo ln -s /opt/penelope/penelope.py /usr/bin/penelope;}
# Install Windows resources
echo "Installing Windows resources..."
sudo ls /usr/share/windows-resources/PowerSharpPack || sudo git clone https://github.com/S3cur3Th1sSh1t/PowerSharpPack.git /usr/share/windows-resources/PowerSharpPack
sudo ls /usr/share/windows-resources/binaries/GhostPack-Binaries || sudo git clone https://github.com/r3motecontrol/Ghostpack-CompiledBinaries.git /usr/share/windows-resources/binaries/GhostPack-Binaries
cd /usr/share/windows-resources/
curl -s https://api.github.com/repos/AlessandroZ/LaZagne/releases/latest | grep "browser_download_url.*exe" | cut -d : -f 2,3 | tr -d \" | sudo wget -qi -
sudo wget https://raw.githubusercontent.com/61106960/adPEAS/main/adPEAS.ps1
# Install Linux resources
echo "Installing Linux resources..."
sudo mkdir -p /usr/share/linux-resources
sudo wget https://raw.githubusercontent.com/CISOfy/lynis/master/lynis -P /usr/share/linux-resources/lynis
sudo wget https://raw.githubusercontent.com/UnleashTheCode/Teddybears_Picnic/master/Teddybears_Picnic_v2.0.sh -O /usr/share/linux-resources/teddy.sh
sudo wget "https://github.com/diego-treitos/linux-smart-enumeration/releases/latest/download/lse.sh" -O /usr/share/linux-resources/lse.sh
# Create uploader directory structure
echo "Setting up uploader directories..."
mkdir -p ~/uploader/{windows,linux}/exploits
ln -s /usr/share/windows-resources ~/uploader/windows/resources
ln -s /usr/share/peass/winpeas ~/uploader/windows/winpeas
ln -s /usr/share/linux-resources ~/uploader/linux/resources
ln -s /usr/share/peass/linpeas ~/uploader/linux/linpeas
ln -s /opt/ligolo-ng/agents ~/uploader/lingolo_agents
# Add zsh completions
echo "Setting up Zsh completions..."
git clone https://github.com/zsh-users/zsh-completions.git /tmp/zsh-completions
sudo mv /tmp/zsh-completions/src/_* /usr/share/zsh/functions/Completion/Unix/
rm -rf /tmp/zsh-completions
git clone https://github.com/rsherstnev/zshcompletions.git /tmp/zshcompletions
sudo mv /tmp/zshcompletions/_* /usr/share/zsh/functions/Completion/Unix/
rm -rf /tmp/zshcompletions
# Setup grc
grep -q '[[ -s "/etc/grc.zsh" ]] && source /etc/grc.zsh' ~/.zshrc || echo '[[ -s "/etc/grc.zsh" ]] && source /etc/grc.zsh' >> ~/.zshrc
# Install and configure cht.sh
echo "Installing cht.sh..."
sudo curl https://cht.sh/:cht.sh -o /bin/cht.sh
sudo chmod +x /bin/cht.sh
#The fuck?!
grep -q 'eval $(thefuck --alias)' ~/.zshrc || echo 'eval $(thefuck --alias)' >> ~/.zshrc
# Some nano magic
curl https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh | sh
# Add environment variables
echo "Setting environment variables..."
grep -q "EDITOR=nano" ~/.zshrc || echo "EDITOR=nano" >> ~/.zshrc
grep -q 'export FZF_DEFAULT_COMMAND='fdfind'' ~/.zshrc || echo 'export FZF_DEFAULT_COMMAND='fdfind'' >> ~/.zshrc
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
# Update aliases
echo "Updating aliases..."
echo 'We alias now'
grep -q "source $HOME/.zsh_aliases" ~/.zshrc || echo "source $HOME/.zsh_aliases" >> ~/.zshrc
touch ~/.zsh_aliases
grep -q 'alias cat="/usr/bin/batcat"' ~/.zsh_aliases || echo 'alias cat="/usr/bin/batcat"' >> ~/.zsh_aliases
grep -q 'alias snano="sudo nano"' ~/.zsh_aliases || echo 'alias snano="sudo nano"' >> ~/.zsh_aliases
grep -q 'alias ls="lsd --icon auto -F -lh"' ~/.zsh_aliases || echo 'alias ls="lsd --icon auto -F -lh"' >> ~/.zsh_aliases
grep -q 'alias ll="lsd --icon auto -F -lha"' ~/.zsh_aliases || echo 'alias ll="lsd --icon auto -F -lha"' >> ~/.zsh_aliases
grep -q 'alias find="fdfind"' ~/.zsh_aliases || echo 'alias find="fdfind"' >> ~/.zsh_aliases
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'" ~/.zsh_aliases || echo "alias aptupdate='sudo apt update && sudo apt upgrade -y && sudo apt full-upgrade -y && sudo apt dist-upgrade -y && sudo apt autoremove -y'" >> ~/.zsh_aliases
grep -q 'alias hurl="hURL"' ~/.zsh_aliases || echo 'alias hurl="hURL"' >> ~/.zsh_aliases
grep -q 'alias uploader="cd ~/uploader"' ~/.zsh_aliases || echo 'alias uploader="cd ~/uploader"' >> ~/.zsh_aliases
grep -q 'alias serve="updog -p 80"' ~/.zsh_aliases || echo 'alias serve="updog -p 80"' >> ~/.zsh_aliases
grep -q 'alias nhosts="sudo $EDITOR /etc/hosts"' ~/.zsh_aliases || echo 'alias nhosts="sudo $EDITOR /etc/hosts"' >> ~/.zsh_aliases
grep -q 'alias nz="$EDITOR ~/.zshrc"' ~/.zsh_aliases || echo 'alias nz="$EDITOR ~/.zshrc"' >> ~/.zsh_aliases
grep -q 'alias xcat="docker run -it tomforbes/xcat"' ~/.zsh_aliases || echo 'alias xcat="docker run -it tomforbes/xcat"' >> ~/.zsh_aliases
grep -q 'alias rssh="cd /opt/reverse_ssh/bin; ./server --tls --webserver --datadir /home/kali/htb/academy/rev_sever/ "' ~/.zsh_aliases || echo 'alias rssh="cd /opt/reverse_ssh/bin; ./server --tls --webserver --datadir /home/kali/htb/academy/rev_sever/ "' >> ~/.zsh_aliases
grep -q 'alias rsa_sign2n="docker run -it rsa_sign2n /bin/bash"' ~/.zsh_aliases || echo 'alias rsa_sign2n="docker run -it rsa_sign2n /bin/bash"' >> ~/.zsh_aliases
# grep -q 'alias =""' ~/.zsh_aliases || echo 'alias =""' >> ~/.zsh_aliases
echo "Setup pipx"
pipx ensurepath
pipx install updog shcheck arsenal-cli smbclientng
pip3 install parth uro arjun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment