Merge pull request #1 from kforney/unattended

Add CLI options and no-menu mode.

Former-commit-id: f5e8f6458384dc2ed0feca0f5f8a080189192030
Former-commit-id: 90bc2bcb86dc64bda244f39cd0584138eb173cd4
This commit is contained in:
Kaj Forney 2018-10-03 14:23:58 -06:00 committed by GitHub
commit 586c1226e1
3 changed files with 66 additions and 29 deletions

View file

@ -9,8 +9,26 @@ 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.

View file

@ -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

View file

@ -11,10 +11,25 @@ then
exit 1
fi
whiptail --backtitle "Pentest Build Script" --title "Welcome" --msgbox "This script will help you build a custom pentesting distribution." 7 70
#Arguments
DISTRO=$(lsb_release -i -s)
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
if [[ $UNATTEND != "true" ]];
then
whiptail --backtitle "Pentest Build Script" --title "Welcome" --msgbox "This script will help you build a custom pentesting distribution." 7 70
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" \
@ -44,6 +59,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 +105,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