diff --git a/README.md b/README.md index b1098b2..efd8eb9 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,14 @@ Best of all, wouldn't it be cool to be able to do a pen test just by talking to ## Install & Usage -There are several steps to install it, please refer to the [PAKURI-THON wiki](https://github.com/01rabbit/PAKURI-THON/wiki). After the installation is complete, run the following command. **You'll need root privileges to run it!** +There are several means of installation. For manual installation, please refer to the [PAKURI-THON wiki](https://github.com/01rabbit/PAKURI-THON/wiki). +If you want to use the installer, please run the following command. **You'll need root privileges to run it!** + +``` shell +sudo ./install.sh +``` + +After the installation is complete, run the following command. **You'll need root privileges to run it!** ``` shell sudo ./pkr3.sh diff --git a/installer.sh b/installer.sh new file mode 100755 index 0000000..420264c --- /dev/null +++ b/installer.sh @@ -0,0 +1,138 @@ +#!/bin/bash + +NC='\e[0m' +BOLD='\e[1m' +BLACK_b='\e[1;30m' +RED_b='\e[1;31m' +GREEN_b='\e[1;32m' +YELLOW_b='\e[1;33m' +BLUE_b='\e[1;34m' +PURPLE_b='\e[1;35m' +LIGHTBLUE_b='\e[1;36m' + +IFACE="eth0" +IP_ADDRESS=$(/sbin/ip -f inet -o addr show "$IFACE" | cut -d\ -f 7 | cut -d/ -f 1) + +clear +echo "Step 1/10 Running system check..." +printf "Checking for root access... " +if [ "$EUID" -ne 0 ]; then + printf "${RED_b}Failed${NC}\n" + printf "Please run as ${RED_b}root${NC}\n" + exit 1 +else + printf "${GREEN_b}OK${NC}\n" +fi + +printf "Step 2/10 : Checking for internet connection... " +if ping -q -c 1 -W 1 google.com >/dev/null; then + printf "${GREEN_b}OK${NC}\n" +else + printf "${RED_b}Failed${NC}\n" + printf "Please check your internet connection.\n" + exit 1 +fi + +figlet -v &> /dev/null +if [ $? -eq 0 ]; then + figlet -w 160 -f smslant "PAKURI-THON" + echo -e "${Green_b}" + figlet -w 160 -f smslant "Installer" + echo -e "${NC}\n" +else + echo -e "${RED_b}Figlet was not installed.${NC}" + echo -e "${RED_b}Install figlet.${NC}" + apt update && apt install figlet -y + echo "Installed figlet. Please run this script again." + exit 1 +fi +date +echo "Step 3/10 : Creating service.ini..." +cat < service.ini +[postgresql] +user = builder +password = password +host = localhost +database = builder +[nextcloud] +server = http://$IP_ADDRESS:8080 +EOF +echo "Step 4/10 : Nextcloud login information..." +echo "Enter the name(ID) and password(at least 8 characters, uppercase and lowercase letters, symbols, and numbers) of chatbot you want to use." +read -p "Name(ID): " NAME +read -sp "Password: " PASSWORD +echo "" +cat <> service.ini +username = $NAME +password = $PASSWORD +inforoom = Information +[webssh] +EOF +echo "Step 5/10 : SSH login information..." +echo "Enter the username and password for ssh login." +read -p "USERNAME: " USERNAME +read -sp "PASSWORD: " PASSWORD +ENCPASS=`echo -n $PASSWORD|base64` +echo "" +cat <> service.ini +username = $USERNAME +password = $ENCPASS +[empire] +username = empireadmin +password = password123 +server = https://$IP_ADDRESS:1337 +listener = pakuri +port = 8088 +EOF + +printf "Step 6/10 : Checking that Docker is installed... " +docker --version &> /dev/null +if [ $? -eq 0 ]; then + printf "${GREEN_b}OK${NC}\n" +else + printf "${RED_b}Failed${NC}\n" + printf "Install Docker.\n" + curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - + echo 'deb [arch=amd64] https://download.docker.com/linux/debian buster stable' > /etc/apt/sources.list.d/docker.list + apt update && apt install docker-ce -y + apt install docker-compose -y + systemctl start docker + systemctl enable docker +fi + +echo "Step 7/10 : Docker content is being installed..." +cd docker +printf "WebSSH... " +docker-compose -f webssh/docker-compose.yml ps &> /dev/null +if [ $? -eq 0 ]; then + cd webssh + docker-compose up -d + printf "${GREEN_b}OK${NC}\n" +else + git clone https://github.com/huashengdun/webssh.git webssh + cd webssh + docker-compose up -d + printf "${GREEN_b}Installed${NC}\n" +fi +cd .. + +printf "Step 8/10 : Nextcloud... " +cd NextCloud-Docker +docker-compose up -d +printf "${GREEN_b}OK${NC}\n" +cd .. + +printf "Step 9/10 : PostgreSQL... " +cd postgres +docker-compose up -d +printf "${GREEN_b}OK${NC}\n" +cd ../../.. + +printf "Step 10/10 : Set up the environment..." +apt install libpq-dev -y +pipenv sync +printf "${GREEN_b}OK${NC}\n" + +echo "Instll complete!" +echo "Please accsess http://$IP_ADDRESS:8080 with a web browser to complete the Nextcloud configuration." +printf "When you are finished, type ${RED_b}sudo ./pkr3.sh${NC} to start PAKURI-THON.\n" \ No newline at end of file diff --git a/pkr3.sh b/pkr3.sh index 0c01025..29885c5 100755 --- a/pkr3.sh +++ b/pkr3.sh @@ -9,16 +9,8 @@ YELLOW_b='\e[1;33m' BLUE_b='\e[1;34m' PURPLE_b='\e[1;35m' LIGHTBLUE_b='\e[1;36m' + clear -figlet -v &> /dev/null -if [ $? -eq 0 ]; then - figlet -w 160 -f smslant "PAKURI-THON" -else - echo -e "${RED_b}Figlet not installed.${NC}" - echo -e "${RED_b}Please install figlet.${NC}" - exit 1 -fi -date echo "Running system check..." printf "Checking for root access... " if [ "$EUID" -ne 0 ]; then @@ -29,6 +21,16 @@ else printf "${GREEN_b}OK${NC}\n" fi +figlet -v &> /dev/null +if [ $? -eq 0 ]; then + figlet -w 160 -f smslant "PAKURI-THON" +else + echo -e "${RED_b}Figlet not installed.${NC}" + echo -e "${RED_b}Please install figlet.${NC}" + exit 1 +fi +date + printf "Checking docker startup... " if systemctl status docker.service | grep "active (running)" > /dev/null; then printf "${GREEN_b}OK${NC}\n"