From d855f8a75263803a29d9e2fedb9a3d09c3c34e3b Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Sat, 29 Sep 2018 16:42:16 -0600 Subject: [PATCH] CLI options functional. --- runme.sh | 71 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/runme.sh b/runme.sh index fe96719b..c0845eec 100755 --- a/runme.sh +++ b/runme.sh @@ -11,52 +11,53 @@ then exit 1 fi -#Argument check! +#Arguments + while getopts ud:r: option do case "${option}" in - u) UNATTEND=true;; - d) DESKTOP=${OPTARG};; - r) REPO=${OPTARG};; + u) UNATTEND="true" && echo "UNATTEND";; + d) DESKTOP=${OPTARG} && echo $DESKTOP;; + r) REPO=${OPTARG} && echo $REPO;; esac 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) -DESKTOP=$(whiptail --backtitle "Pentest Build Script" --title "Desktop Environment" --menu "Choose a desktop:" 15 50 6 \ -"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" ]; +if [ $UNATTEND != "true" ]; 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 + whiptail --backtitle "Pentest Build Script" --title "Welcome" --msgbox "This script will help you build a custom pentesting distribution." 7 70 -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 + DESKTOP=$(whiptail --backtitle "Pentest Build Script" --title "Desktop Environment" --menu "Choose a desktop:" 15 50 6 \ + "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 + 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 #This is the stuff that's common to both distros