From cae438497f2f1c8c5f44fd01ea6755fffab4fe91 Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Sat, 29 Sep 2018 02:35:13 -0600 Subject: [PATCH 1/7] Add CLI options for use with unattended builds. Former-commit-id: 5e29956dcf271d995ebe2e1cae5ecba902c9daff Former-commit-id: ac82de30f8840b34434ec54534e588700e33c21e --- runme.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/runme.sh b/runme.sh index c1b95ab7..fe96719b 100755 --- a/runme.sh +++ b/runme.sh @@ -11,6 +11,19 @@ then exit 1 fi +#Argument check! + +while getopts ud:r: option +do + case "${option}" in + u) UNATTEND=true;; + d) DESKTOP=${OPTARG};; + r) REPO=${OPTARG};; + 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) @@ -44,6 +57,7 @@ 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 dpkg-name ./debs/*.deb @@ -89,6 +103,9 @@ Parrot) ;; esac +if [ $UNATTEND != "true" ]; +then whiptail --backtitle "Pentest Build Script" --title "Finished" --msgbox "Fingers crossed there were no errors... Your image should be done!" 7 70 +fi exit 0 From 476cba952357470f1c144a603e2279c707214972 Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Sat, 29 Sep 2018 16:42:16 -0600 Subject: [PATCH 2/7] CLI options functional. Former-commit-id: 93c2b29cef089262fc9d555c131acde0f01d4ef6 Former-commit-id: 5651fe34d260b125ca58f2683648ea62a9a9e453 --- 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 From a306bfe87267f3325282bc5f0dfcca8be7469d38 Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Mon, 1 Oct 2018 22:42:40 -0600 Subject: [PATCH 3/7] Fix unary operators. Former-commit-id: f727ba95af39612968bc2a80c3787d023659f050 Former-commit-id: 3e3fb956b1d16717d9344131fe312bb9297ec5a4 --- runme.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/runme.sh b/runme.sh index c0845eec..88c9e7a3 100755 --- a/runme.sh +++ b/runme.sh @@ -13,19 +13,20 @@ fi #Arguments +DISTRO=$(lsb_release -i -s) -while getopts ud:r: option +while getopts ul:d:r: option do case "${option}" in u) UNATTEND="true" && echo "UNATTEND";; + l) DISTRO=${OPTARG} && echo $DISTRO;; d) DESKTOP=${OPTARG} && echo $DESKTOP;; r) REPO=${OPTARG} && echo $REPO;; esac done -DISTRO=$(lsb_release -i -s) -if [ $UNATTEND != "true" ]; +if [[ $UNATTEND != "true" ]]; then whiptail --backtitle "Pentest Build Script" --title "Welcome" --msgbox "This script will help you build a custom pentesting distribution." 7 70 @@ -104,7 +105,7 @@ Parrot) ;; esac -if [ $UNATTEND != "true" ]; +if [[ $UNATTEND != "true" ]]; then whiptail --backtitle "Pentest Build Script" --title "Finished" --msgbox "Fingers crossed there were no errors... Your image should be done!" 7 70 fi From 1b21e396059bc968e3948487b6c6ab2c6e3db2d9 Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Mon, 1 Oct 2018 22:46:22 -0600 Subject: [PATCH 4/7] Fix for use with Debian. Former-commit-id: b64c2f9d205468e756cefe38720b137858bd755e Former-commit-id: 43fdefb6e0c9cdcbbdc5532fd95c455b470f9330 --- modules/live-build-config/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/live-build-config/build.sh b/modules/live-build-config/build.sh index 16f29826..f939e343 100755 --- a/modules/live-build-config/build.sh +++ b/modules/live-build-config/build.sh @@ -144,7 +144,7 @@ ver_debootstrap=$(dpkg-query -f '${Version}' -W debootstrap) if dpkg --compare-versions "$ver_debootstrap" lt "1.0.97"; then if ! echo "$ver_debootstrap" | grep -q kali; then echo "ERROR: You need debootstrap >= 1.0.97 (or a Kali patched debootstrap). Your current version: $ver_debootstrap" >&2 - exit 1 + #exit 1 fi fi From e611c8c83dc2bb7f4176071b1a99a30813fa81e4 Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Wed, 3 Oct 2018 00:56:39 -0600 Subject: [PATCH 5/7] Update README.md Former-commit-id: 96d43f58b8f9812596cc7da910f491bf877a8129 Former-commit-id: ca4e8424560ad07043e9374264ef0aa9f95e2a7d --- README.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e1a6d70f..918f1da5 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,22 @@ Just clone the repository, then make whatever changes you wish to make. * Files in the filesystem/ folder will be copied to the system. * Add any extra software from the repository you wish to install to the config/software.list.chroot file. -When you're ready to build, run `sudo ./runme.sh` . +When you're ready to build, run `sudo ./runme.sh` . Once it's complete, the finished image will be copied to the images/ folder. -The script will build whichever OS you are currently running, and prompt for which desktop environment and repository you wish to use. +If you run the script without any options, it will build whichever OS you are currently running, and prompt for which desktop environment and repository you wish to use. If you wish, however, you can manually specify these options instead: -Once it's complete, the finished image will be copied to the images/ folder. +* -u + * Unattended mode (skip the menu, required for the other options to function) +* -l + * Linux distribution you wish to build (can be either "Kali" or "Parrot") +* -d + * Desktop environment (can be one of "cinnamon", "gnome", "kde", "lxde", "mate", or "xfce") +* -r (optional) + * Repository (can be either "default" for the distribution's default repo, or an IP address) + +## Examples +`sudo ./runme.sh -u -l Kali -d mate -r 192.168.0.30` +This will build a Kali Linux .iso, with the MATE desktop environment, using a local repository at 192.168.0.30 + +`sudo ./runme.sh -u -l Parrot -d cinnamon` +This will build a Parrot Security OS .iso, with the Cinnamon desktop environment, using the default Parrot repository. If -r is unspecified, then the default will be used. From 99204169566fcd56e0b2d2ec3bdc1a19e22c10d2 Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Wed, 3 Oct 2018 00:56:52 -0600 Subject: [PATCH 6/7] Update README.md Former-commit-id: 1457dd69dfb82e198942261e7d2107d3a8e32cd5 Former-commit-id: 834ed518f1781496cb9e9444bfa525ab1dac544b --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 918f1da5..be332baf 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,9 @@ If you run the script without any options, it will build whichever OS you are cu ## Examples `sudo ./runme.sh -u -l Kali -d mate -r 192.168.0.30` + This will build a Kali Linux .iso, with the MATE desktop environment, using a local repository at 192.168.0.30 `sudo ./runme.sh -u -l Parrot -d cinnamon` + This will build a Parrot Security OS .iso, with the Cinnamon desktop environment, using the default Parrot repository. If -r is unspecified, then the default will be used. From 2820698a3eb904677cb4c4365e9f5acfb1e850c8 Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Wed, 3 Oct 2018 00:57:40 -0600 Subject: [PATCH 7/7] Update README.md Former-commit-id: 31acfa0fbd5830d2de3b3ac1e7683555599e83e2 Former-commit-id: 5873be24f7ce84818116246085982cbe5ea94b40 --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index be332baf..f9d4c7ef 100644 --- a/README.md +++ b/README.md @@ -29,4 +29,6 @@ This will build a Kali Linux .iso, with the MATE desktop environment, using a lo `sudo ./runme.sh -u -l Parrot -d cinnamon` -This will build a Parrot Security OS .iso, with the Cinnamon desktop environment, using the default Parrot repository. If -r is unspecified, then the default will be used. +This will build a Parrot Security OS .iso, with the Cinnamon desktop environment, using the default Parrot repository. + +If -r is unspecified, then the default will be used.