mirror of
https://github.com/kforney/pentest-distro-builder.git
synced 2024-11-22 01:50:56 -07:00
Merge pull request #4 from kforney/master
Add CLI options for use with unattended builds.
This commit is contained in:
commit
0e31d805b2
3 changed files with 68 additions and 31 deletions
24
README.md
24
README.md
|
@ -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.
|
* 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.
|
* 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.
|
||||||
|
|
|
@ -144,7 +144,7 @@ ver_debootstrap=$(dpkg-query -f '${Version}' -W debootstrap)
|
||||||
if dpkg --compare-versions "$ver_debootstrap" lt "1.0.97"; then
|
if dpkg --compare-versions "$ver_debootstrap" lt "1.0.97"; then
|
||||||
if ! echo "$ver_debootstrap" | grep -q kali; 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
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
73
runme.sh
73
runme.sh
|
@ -11,38 +11,54 @@ then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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)
|
DISTRO=$(lsb_release -i -s)
|
||||||
|
|
||||||
DESKTOP=$(whiptail --backtitle "Pentest Build Script" --title "Desktop Environment" --menu "Choose a desktop:" 15 50 6 \
|
while getopts ul:d:r: option
|
||||||
"gnome" "GNOME Desktop Environment" \
|
do
|
||||||
"mate" "MATE Advanced Traditional Environment" \
|
case "${option}" in
|
||||||
"cinnamon" "Cinnamon Desktop Environment" \
|
u) UNATTEND="true" && echo "UNATTEND";;
|
||||||
"kde" "K Desktop Environment" \
|
l) DISTRO=${OPTARG} && echo $DISTRO;;
|
||||||
"xfce" "Xfce Desktop Environment" \
|
d) DESKTOP=${OPTARG} && echo $DESKTOP;;
|
||||||
"lxde" "Lightweight X11 Desktop Environment" 3>&1 1>&2 2>&3)
|
r) REPO=${OPTARG} && echo $REPO;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
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
|
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" \
|
||||||
|
"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
|
||||||
|
@ -68,7 +84,7 @@ Kali)
|
||||||
|
|
||||||
cd build/live-build-config
|
cd build/live-build-config
|
||||||
./build.sh --distribution kali-rolling --variant $DESKTOP --verbose
|
./build.sh --distribution kali-rolling --variant $DESKTOP --verbose
|
||||||
cp images/*.iso ../../images/
|
cp images/*.iso ../../images/kali-rolling-$DESKTOP-$(date -I).iso
|
||||||
;;
|
;;
|
||||||
Parrot)
|
Parrot)
|
||||||
cp -rv ./modules/parrot-build ./build/
|
cp -rv ./modules/parrot-build ./build/
|
||||||
|
@ -85,10 +101,13 @@ Parrot)
|
||||||
|
|
||||||
cd build/parrot-build
|
cd build/parrot-build
|
||||||
./build.sh build variant-$DESKTOP amd64
|
./build.sh build variant-$DESKTOP amd64
|
||||||
cp ../*.iso ../../images/
|
cp ../*.iso ../../images/parrotsec-$DESKTOP-$(date -I).iso
|
||||||
;;
|
;;
|
||||||
esac
|
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
|
whiptail --backtitle "Pentest Build Script" --title "Finished" --msgbox "Fingers crossed there were no errors... Your image should be done!" 7 70
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue