From b8f0c9f17837d73878dd8112a3fb7f27123f6d7e Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Sat, 29 Sep 2018 02:05:44 -0600 Subject: [PATCH 1/8] Add dates to iso filenames. --- runme.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runme.sh b/runme.sh index 2d4e2d1d..c1b95ab7 100755 --- a/runme.sh +++ b/runme.sh @@ -68,7 +68,7 @@ Kali) cd build/live-build-config ./build.sh --distribution kali-rolling --variant $DESKTOP --verbose - cp images/*.iso ../../images/ + cp images/*.iso ../../images/kali-rolling-$DESKTOP-$(date -I).iso ;; Parrot) cp -rv ./modules/parrot-build ./build/ @@ -85,7 +85,7 @@ Parrot) cd build/parrot-build ./build.sh build variant-$DESKTOP amd64 - cp ../*.iso ../../images/ + cp ../*.iso ../../images/parrotsec-$DESKTOP-$(date -I).iso ;; esac From 57b9323b2ed1b3396695092e160e21e7dc022b79 Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Sat, 29 Sep 2018 02:35:13 -0600 Subject: [PATCH 2/8] Add CLI options for use with unattended builds. --- 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 d855f8a75263803a29d9e2fedb9a3d09c3c34e3b Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Sat, 29 Sep 2018 16:42:16 -0600 Subject: [PATCH 3/8] 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 From ecb86089a6a84dfd5c1a3fbe4547b61613656fa9 Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Mon, 1 Oct 2018 22:42:40 -0600 Subject: [PATCH 4/8] Fix unary operators. --- 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 77394d8d4ad5261d2726d659702d9c5c063e79dc Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Mon, 1 Oct 2018 22:46:22 -0600 Subject: [PATCH 5/8] Fix for use with Debian. --- 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 6834fc0d7e724c40361fdbee6650a089a1c4fcd5 Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Wed, 3 Oct 2018 00:56:39 -0600 Subject: [PATCH 6/8] Update README.md --- 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 ae6d5e4fca139e58a5f0a2f658dd4e6f51c9b033 Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Wed, 3 Oct 2018 00:56:52 -0600 Subject: [PATCH 7/8] Update README.md --- 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 253548413fc7069af16835fbb6983b957aaf9270 Mon Sep 17 00:00:00 2001 From: Kaj Forney Date: Wed, 3 Oct 2018 00:57:40 -0600 Subject: [PATCH 8/8] Update README.md --- 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.