2018-09-05 17:06:30 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
function pause(){
|
|
|
|
read -p "$*"
|
|
|
|
}
|
|
|
|
|
|
|
|
#Root check!
|
|
|
|
if [ "$EUID" -ne 0 ]
|
|
|
|
then
|
|
|
|
whiptail --backtitle "Pentest Build Script" --title "NOT ROOT" --msgbox "YOU ARE NOT ROOT. PLEASE RUN THIS SCRIPT AS ROOT." 10 55
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-09-29 16:42:16 -06:00
|
|
|
#Arguments
|
|
|
|
|
2018-10-01 22:42:40 -06:00
|
|
|
DISTRO=$(lsb_release -i -s)
|
2018-09-29 02:35:13 -06:00
|
|
|
|
2018-10-01 22:42:40 -06:00
|
|
|
while getopts ul:d:r: option
|
2018-09-29 02:35:13 -06:00
|
|
|
do
|
|
|
|
case "${option}" in
|
2018-09-29 16:42:16 -06:00
|
|
|
u) UNATTEND="true" && echo "UNATTEND";;
|
2018-10-01 22:42:40 -06:00
|
|
|
l) DISTRO=${OPTARG} && echo $DISTRO;;
|
2018-09-29 16:42:16 -06:00
|
|
|
d) DESKTOP=${OPTARG} && echo $DESKTOP;;
|
|
|
|
r) REPO=${OPTARG} && echo $REPO;;
|
2018-09-29 02:35:13 -06:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2018-09-05 17:06:30 -06:00
|
|
|
|
2018-10-01 22:42:40 -06:00
|
|
|
if [[ $UNATTEND != "true" ]];
|
2018-09-05 17:06:30 -06:00
|
|
|
then
|
2018-09-29 16:42:16 -06:00
|
|
|
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" \
|
|
|
|
"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
|
2018-09-29 02:35:13 -06:00
|
|
|
fi
|
2018-09-05 17:06:30 -06:00
|
|
|
|
|
|
|
#This is the stuff that's common to both distros
|
|
|
|
dpkg-name ./debs/*.deb
|
|
|
|
rm -rf build
|
|
|
|
mkdir build
|
2018-10-17 15:10:56 -06:00
|
|
|
apt install git build-essential cdebootstrap live-build curl wget -y
|
2018-09-05 17:06:30 -06:00
|
|
|
|
|
|
|
case $DISTRO in
|
2018-09-07 15:28:03 -06:00
|
|
|
Kali)
|
2018-09-05 17:06:30 -06:00
|
|
|
cp -rv ./modules/live-build-config ./build/
|
|
|
|
mkdir ./build/live-build-config/kali-config/variant-$DESKTOP/packages.chroot
|
|
|
|
cp ./debs/*.deb build/live-build-config/kali-config/variant-$DESKTOP/packages.chroot/
|
|
|
|
cp -rv filesystem/* ./build/live-build-config/kali-config/common/includes.chroot/
|
2018-09-26 17:27:02 -06:00
|
|
|
cp config/software.list.chroot ./build/live-build-config/kali-config/variant-$DESKTOP/package-lists/
|
2018-10-18 18:01:16 -06:00
|
|
|
cp config/pentest-distro-builder.chroot ./build/live-build-config/kali-config/common/hooks/live/
|
2018-09-26 15:44:51 -06:00
|
|
|
|
|
|
|
if [ $REPO != "default" ];
|
|
|
|
then
|
2018-09-26 15:57:11 -06:00
|
|
|
sed -i "s|archive.kali.org|$REPO|g" ./build/live-build-config/auto/config
|
2018-09-26 15:44:51 -06:00
|
|
|
fi
|
|
|
|
|
2018-09-05 17:06:30 -06:00
|
|
|
cd build/live-build-config
|
|
|
|
./build.sh --distribution kali-rolling --variant $DESKTOP --verbose
|
2018-09-29 02:05:44 -06:00
|
|
|
cp images/*.iso ../../images/kali-rolling-$DESKTOP-$(date -I).iso
|
2018-09-05 17:06:30 -06:00
|
|
|
;;
|
2018-09-07 15:28:03 -06:00
|
|
|
Parrot)
|
2018-09-05 17:06:30 -06:00
|
|
|
cp -rv ./modules/parrot-build ./build/
|
|
|
|
mkdir ./build/parrot-build/templates/parrot-variant-$DESKTOP/packages.chroot
|
|
|
|
cp ./debs/*.deb build/parrot-build/templates/parrot-variant-$DESKTOP/packages.chroot/
|
|
|
|
cp -rv filesystem/* ./build/parrot-build/templates/common/includes.chroot/
|
2018-09-26 17:27:02 -06:00
|
|
|
cp config/software.list.chroot ./build/parrot-build/templates/parrot-variant-$DESKTOP/package-lists/
|
2018-10-18 18:01:16 -06:00
|
|
|
cp config/pentest-distro-builder.chroot ./build/parrot-build/templates/common/hooks/normal/
|
2018-09-26 15:44:51 -06:00
|
|
|
|
|
|
|
if [ $REPO != "default" ];
|
|
|
|
then
|
|
|
|
sed -i "s|archive.parrotsec.org|$REPO|g" ./build/parrot-build/auto/config
|
2018-10-23 15:07:19 -06:00
|
|
|
sed -i "s|deb.parrotsec.org|$REPO|g" ./build/parrot-build/templates/common/archives/parrot.list
|
2018-09-26 15:44:51 -06:00
|
|
|
fi
|
|
|
|
|
2018-09-05 17:06:30 -06:00
|
|
|
cd build/parrot-build
|
|
|
|
./build.sh build variant-$DESKTOP amd64
|
2018-09-29 02:05:44 -06:00
|
|
|
cp ../*.iso ../../images/parrotsec-$DESKTOP-$(date -I).iso
|
2018-09-05 17:06:30 -06:00
|
|
|
;;
|
|
|
|
esac
|
2018-09-26 15:44:51 -06:00
|
|
|
|
2018-10-01 22:42:40 -06:00
|
|
|
if [[ $UNATTEND != "true" ]];
|
2018-09-29 02:35:13 -06:00
|
|
|
then
|
2018-09-26 15:44:51 -06:00
|
|
|
whiptail --backtitle "Pentest Build Script" --title "Finished" --msgbox "Fingers crossed there were no errors... Your image should be done!" 7 70
|
2018-09-29 02:35:13 -06:00
|
|
|
fi
|
2018-09-26 15:44:51 -06:00
|
|
|
|
|
|
|
exit 0
|