CLI options functional.

Former-commit-id: d855f8a752
Former-commit-id: 5651fe34d260b125ca58f2683648ea62a9a9e453
This commit is contained in:
Kaj Forney 2018-09-29 16:42:16 -06:00
parent 6b31cbf0cc
commit 9ede0f6f13

View file

@ -11,52 +11,53 @@ then
exit 1 exit 1
fi fi
#Argument check! #Arguments
while getopts ud:r: option while getopts ud:r: option
do do
case "${option}" in case "${option}" in
u) UNATTEND=true;; u) UNATTEND="true" && echo "UNATTEND";;
d) DESKTOP=${OPTARG};; d) DESKTOP=${OPTARG} && echo $DESKTOP;;
r) REPO=${OPTARG};; r) REPO=${OPTARG} && echo $REPO;;
esac esac
done done
if [ $UNATTEND != "true" ];
then
whiptail --backtitle "Pentest Build Script" --title "Welcome" --msgbox "This script will help you build a custom pentesting distribution." 7 70
DISTRO=$(lsb_release -i -s) DISTRO=$(lsb_release -i -s)
DESKTOP=$(whiptail --backtitle "Pentest Build Script" --title "Desktop Environment" --menu "Choose a desktop:" 15 50 6 \ if [ $UNATTEND != "true" ];
"gnome" "GNOME Desktop Environment" \
"mate" "MATE Advanced Traditional Environment" \
"cinnamon" "Cinnamon Desktop Environment" \
"kde" "K Desktop Environment" \
"xfce" "Xfce Desktop Environment" \
"lxde" "Lightweight X11 Desktop Environment" 3>&1 1>&2 2>&3)
REPO=$(whiptail --backtitle "Pentest Build Script" --title "Repository" --menu "Which repository are you going to use?" 10 60 2 \
"default" "The distribution's default repository" \
"local" "A repository hosted on your local network" 3>&1 1>&2 2>&3)
if [ $REPO == "local" ];
then then
REPO=$(whiptail --backtitle "Pentest Build Script" --title "Local Repository" --inputbox "What is the IP address of your local repository?" \ whiptail --backtitle "Pentest Build Script" --title "Welcome" --msgbox "This script will help you build a custom pentesting distribution." 7 70
10 60 3>&1 1>&2 2>&3)
fi
if (whiptail --backtitle "Pentest Build Script" --title "Confirmation" --yesno "We're going to build: DESKTOP=$(whiptail --backtitle "Pentest Build Script" --title "Desktop Environment" --menu "Choose a desktop:" 15 50 6 \
Distribution: $DISTRO "gnome" "GNOME Desktop Environment" \
Desktop Environment: $DESKTOP "mate" "MATE Advanced Traditional Environment" \
Repository: $REPO "cinnamon" "Cinnamon Desktop Environment" \
Shall we proceed?" 10 50) "kde" "K Desktop Environment" \
then "xfce" "Xfce Desktop Environment" \
whiptail --backtitle "Pentest Build Script" --title "Build Time!" --msgbox "This will take a while. Press OK to proceed." 8 30 "lxde" "Lightweight X11 Desktop Environment" 3>&1 1>&2 2>&3)
else
whiptail --backtitle "Pentest Build Script" --title "OK" --msgbox "This script will now terminate." 8 35 REPO=$(whiptail --backtitle "Pentest Build Script" --title "Repository" --menu "Which repository are you going to use?" 10 60 2 \
exit 1 "default" "The distribution's default repository" \
fi "local" "A repository hosted on your local network" 3>&1 1>&2 2>&3)
if [ $REPO == "local" ];
then
REPO=$(whiptail --backtitle "Pentest Build Script" --title "Local Repository" --inputbox "What is the IP address of your local repository?" \
10 60 3>&1 1>&2 2>&3)
fi
if (whiptail --backtitle "Pentest Build Script" --title "Confirmation" --yesno "We're going to build:
Distribution: $DISTRO
Desktop Environment: $DESKTOP
Repository: $REPO
Shall we proceed?" 10 50)
then
whiptail --backtitle "Pentest Build Script" --title "Build Time!" --msgbox "This will take a while. Press OK to proceed." 8 30
else
whiptail --backtitle "Pentest Build Script" --title "OK" --msgbox "This script will now terminate." 8 35
exit 1
fi
fi fi
#This is the stuff that's common to both distros #This is the stuff that's common to both distros