mirror of
https://github.com/wickedyoda/public-setupfiles.git
synced 2026-11-16 13:31:56 -06:00
Enhance Kali updates script with Purple options
This commit is contained in:
1 parent
391ab90cf2
commit
5a948a039d
1 file changed
+88
-54
@@ -1,20 +1,21 @@
|
|||||||
# ...existing code...
|
#!/bin/bash
|
||||||
sudo apt update
|
set -euo pipefail
|
||||||
sudo apt upgrade -y
|
|
||||||
sudo apt full-upgrade -y
|
|
||||||
|
|
||||||
# Prompt for Kali tool categories to install (supports numbers, comma-separated, or 'all'/'a')
|
SUDO=""
|
||||||
echo
|
if [[ $EUID -ne 0 ]]; then
|
||||||
echo "Select Kali tool categories to install (comma-separated, numbers, or 'all'):"
|
if command -v sudo >/dev/null 2>&1; then
|
||||||
echo " 1) Identify -> kali-tools-identify"
|
SUDO="sudo "
|
||||||
echo " 2) Protect -> kali-tools-protect"
|
else
|
||||||
echo " 3) Detect -> kali-tools-detect"
|
echo "This script must be run as root or have sudo installed."
|
||||||
echo " 4) Respond -> kali-tools-respond"
|
exit 1
|
||||||
echo " 5) Recover -> kali-tools-recover"
|
fi
|
||||||
echo " Enter numbers (e.g. 1,3), 'all' or 'a' to install all. Leave empty to skip."
|
fi
|
||||||
read -p "Selection: " selection
|
|
||||||
|
|
||||||
declare -A map=(
|
${SUDO}apt update
|
||||||
|
${SUDO}apt upgrade -y
|
||||||
|
${SUDO}apt full-upgrade -y
|
||||||
|
|
||||||
|
declare -A TOOL_MAP=(
|
||||||
[1]=kali-tools-identify
|
[1]=kali-tools-identify
|
||||||
[2]=kali-tools-protect
|
[2]=kali-tools-protect
|
||||||
[3]=kali-tools-detect
|
[3]=kali-tools-detect
|
||||||
@@ -22,55 +23,88 @@ declare -A map=(
|
|||||||
[5]=kali-tools-recover
|
[5]=kali-tools-recover
|
||||||
)
|
)
|
||||||
|
|
||||||
pkgs=()
|
add_packages() {
|
||||||
if [[ -n "$selection" ]]; then
|
local pkg
|
||||||
selection="${selection,,}" # lowercase
|
for pkg in "$@"; do
|
||||||
# direct all options
|
if [[ -z "${PACKAGE_SEEN[$pkg]:-}" ]]; then
|
||||||
if [[ "$selection" == "all" || "$selection" == "a" ]]; then
|
INSTALL_PKGS+=("$pkg")
|
||||||
pkgs=(kali-tools-identify kali-tools-protect kali-tools-detect kali-tools-respond kali-tools-recover)
|
PACKAGE_SEEN[$pkg]=1
|
||||||
else
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
INSTALL_PKGS=()
|
||||||
|
declare -A PACKAGE_SEEN=()
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Select Kali tool categories to install (comma-separated numbers, or 'all'):"
|
||||||
|
echo " 1) Identify -> kali-tools-identify"
|
||||||
|
echo " 2) Protect -> kali-tools-protect"
|
||||||
|
echo " 3) Detect -> kali-tools-detect"
|
||||||
|
echo " 4) Respond -> kali-tools-respond"
|
||||||
|
echo " 5) Recover -> kali-tools-recover"
|
||||||
|
echo " Enter numbers (e.g. 1,3), 'all' or 'a' to install all. Leave empty to skip."
|
||||||
|
read -r -p "Selection: " selection
|
||||||
|
|
||||||
|
selection="${selection,,}"
|
||||||
|
selection="${selection//[[:space:]]/}"
|
||||||
|
|
||||||
|
if [[ -z "$selection" ]]; then
|
||||||
|
echo "No tools selected. Skipping Kali tool installation."
|
||||||
|
elif [[ "$selection" == "all" || "$selection" == "a" ]]; then
|
||||||
|
add_packages "${TOOL_MAP[@]}"
|
||||||
|
else
|
||||||
IFS=',' read -ra choices <<< "$selection"
|
IFS=',' read -ra choices <<< "$selection"
|
||||||
for c in "${choices[@]}"; do
|
for c in "${choices[@]}"; do
|
||||||
# trim whitespace
|
|
||||||
c="${c//[[:space:]]/}"
|
|
||||||
if [[ -z "$c" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if [[ "$c" == "all" || "$c" == "a" ]]; then
|
if [[ "$c" == "all" || "$c" == "a" ]]; then
|
||||||
pkgs=(kali-tools-identify kali-tools-protect kali-tools-detect kali-tools-respond kali-tools-recover)
|
add_packages "${TOOL_MAP[@]}"
|
||||||
break
|
break
|
||||||
fi
|
elif [[ -n "${TOOL_MAP[$c]:-}" ]]; then
|
||||||
if [[ -n "${map[$c]}" ]]; then
|
add_packages "${TOOL_MAP[$c]}"
|
||||||
pkgs+=("${map[$c]}")
|
|
||||||
else
|
else
|
||||||
echo "Warning: invalid choice '$c' ignored."
|
echo "Warning: invalid choice '$c' ignored."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Kali Purple installation options:"
|
||||||
|
echo " 1) Kali Purple tools (identify/protect/detect/respond/recover)"
|
||||||
|
echo " 2) Kali Purple experience (kali-themes-purple, kali-menu, kali-wallpapers-legacy)"
|
||||||
|
echo " 3) All Kali Purple options"
|
||||||
|
echo " 4) Continue without Kali Purple installation"
|
||||||
|
read -r -p "Selection [4]: " purple_selection
|
||||||
|
|
||||||
|
purple_selection="${purple_selection,,}"
|
||||||
|
purple_selection="${purple_selection//[[:space:]]/}"
|
||||||
|
|
||||||
|
case "$purple_selection" in
|
||||||
|
1)
|
||||||
|
add_packages ${TOOL_MAP[@]}
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
add_packages kali-themes-purple kali-menu kali-wallpapers-legacy
|
||||||
|
;;
|
||||||
|
3|all|a)
|
||||||
|
add_packages ${TOOL_MAP[@]} kali-themes-purple kali-menu kali-wallpapers-legacy
|
||||||
|
;;
|
||||||
|
""|4|skip)
|
||||||
|
echo "Skipping Kali Purple installation."
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unrecognized choice. Skipping Kali Purple installation."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ ${#INSTALL_PKGS[@]} -gt 0 ]]; then
|
||||||
|
echo "Installing selected packages: ${INSTALL_PKGS[*]}"
|
||||||
|
${SUDO}apt install -y "${INSTALL_PKGS[@]}"
|
||||||
|
echo "Selected packages installed."
|
||||||
else
|
else
|
||||||
echo "No tools selected. Skipping Kali tool installation."
|
echo "No optional Kali packages selected for installation."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# deduplicate packages and install if any
|
${SUDO}apt autoremove -y
|
||||||
if [[ ${#pkgs[@]} -gt 0 ]]; then
|
${SUDO}apt clean -y
|
||||||
declare -A seen=()
|
|
||||||
final_pkgs=()
|
|
||||||
for p in "${pkgs[@]}"; do
|
|
||||||
if [[ -z "${seen[$p]}" ]]; then
|
|
||||||
final_pkgs+=("$p")
|
|
||||||
seen[$p]=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Installing: ${final_pkgs[*]}"
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y "${final_pkgs[@]}"
|
|
||||||
echo "Selected Kali tool packages installed."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ...existing code...
|
|
||||||
sudo apt autoremove -y
|
|
||||||
sudo apt clean -y
|
|
||||||
sudo apt purge -y
|
|
||||||
echo "System update and cleanup complete!"
|
echo "System update and cleanup complete!"
|
||||||
# ...existing code...
|
|
||||||
Reference in new issue
Block a user