From ad3ad4cc81177119d81dafb94fa1c1befb0c77ec Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Fri, 7 Jun 2024 15:34:32 +0200 Subject: [PATCH 01/25] build(installation): make users aware of installation time --- install.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index b1d53943..abf86bc6 100755 --- a/install.sh +++ b/install.sh @@ -17,7 +17,7 @@ fi tput setaf 2; cat web/art/reNgine.txt -log "\r\nBefore running this script, please make sure Docker is running and you have made changes to the `.env` file." 1 +log "\r\nBefore running this script, please make sure Docker is running and you have made changes to the .env file." 1 log "Changing the postgres username & password from .env is highly recommended.\r\n" 1 log "#########################################################################" 4 @@ -26,7 +26,7 @@ log "Only x86_64 platform are supported" 3 log "#########################################################################\r\n" 4 tput setaf 1; -read -p "Are you sure you made changes to the `.env` file (y/n)? " answer +read -p "Are you sure you made changes to the .env file (y/n)? " answer case ${answer:0:1} in y|Y|yes|YES|Yes ) log "Continuing Installation!" 2 @@ -99,7 +99,8 @@ else fi log "\r\n#########################################################################" 4 -log "Installing reNgine, please be patient it could take a while" 4 +log "Installing reNgine-ng, please be patient as it could take a while" 1 +sleep 5 log "\r\n=========================================================================" 5 log "Generating certificates and building docker images" 5 @@ -107,7 +108,8 @@ log "=========================================================================" make certs && make build && log "reNgine is built" 2 || { log "reNgine installation failed!!" 1; exit 1; } log "\r\n=========================================================================" 5 -log "Docker containers starting, please wait celery container could be long" 5 +log "Docker containers starting, please wait as Celery container could take a while" 1 +sleep 5 log "=========================================================================" 5 make up && log "reNgine is installed!!!" 2 || { log "reNgine installation failed!!" 1; exit 1; } From b5846f0eb54601d27708987aceb55bc94bcaedf3 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Fri, 7 Jun 2024 15:55:25 +0200 Subject: [PATCH 02/25] build(installation): remove redundant exclamation marks and use new reNgine name --- install.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/install.sh b/install.sh index abf86bc6..7aaef548 100755 --- a/install.sh +++ b/install.sh @@ -9,7 +9,7 @@ log() { # Check for root privileges if [ "$(id -u)" -ne 0 ]; then - log "Error: Please run this script as root!" 1 + log "Error: please run this script as root!" 1 log "Example: sudo $0" 1 exit 1 fi @@ -36,13 +36,13 @@ case ${answer:0:1} in log "nano already installed, skipping." 2 else sudo apt update && sudo apt install nano -y - log "nano installed!!!" 2 + log "nano installed!" 2 fi nano .env ;; esac -log "\r\nInstalling reNgine and its dependencies" 4 +log "\r\nInstalling reNgine-ng and its dependencies" 4 log "=========================================================================" 4 log "\r\n#########################################################################" 4 @@ -50,7 +50,7 @@ log "Installing curl..." 4 if ! command -v curl 2> /dev/null; then apt update && apt install curl -y - log "CURL installed!!!" 2 + log "CURL installed!" 2 else log "CURL already installed, skipping." 2 fi @@ -61,7 +61,7 @@ log "Installing Docker..." 4 if ! command -v docker 2> /dev/null; then curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh - log "Docker installed!!!" 2 + log "Docker installed!" 2 else log "Docker already installed, skipping." 2 fi @@ -73,7 +73,7 @@ if ! command -v docker-compose 2> /dev/null; then curl -L "https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose - log "docker-compose installed!!!" 2 + log "docker-compose installed!" 2 else log "docker-compose already installed, skipping." 2 fi @@ -83,7 +83,7 @@ log "Installing make" 4 if ! command -v make 2> /dev/null; then apt install make -y - log "make installed!!!" 2 + log "make installed!" 2 else log "make already installed, skipping." 2 fi @@ -105,13 +105,13 @@ sleep 5 log "\r\n=========================================================================" 5 log "Generating certificates and building docker images" 5 log "=========================================================================" 5 -make certs && make build && log "reNgine is built" 2 || { log "reNgine installation failed!!" 1; exit 1; } +make certs && make build && log "reNgine-ng is built" 2 || { log "reNgine-ng installation failed!" 1; exit 1; } log "\r\n=========================================================================" 5 log "Docker containers starting, please wait as Celery container could take a while" 1 sleep 5 log "=========================================================================" 5 -make up && log "reNgine is installed!!!" 2 || { log "reNgine installation failed!!" 1; exit 1; } +make up && log "reNgine-ng is installed!" 2 || { log "reNgine-ng installation failed!" 1; exit 1; } log "\r\n#########################################################################" 4 @@ -119,4 +119,4 @@ log "Creating an account" 4 log "#########################################################################" 4 make username -log "\r\nThank you for installing reNgine, happy recon!!" 2 +log "\r\nThank you for installing reNgine-ng, happy recon!" 2 From 4a410d789e2d0971834fec23b54b28f326c6aff9 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Fri, 7 Jun 2024 16:15:16 +0200 Subject: [PATCH 03/25] build(docker): use Docker Compose V2 commands --- Makefile | 26 +++++++++++++------------- install.sh | 4 ++-- make.bat | 28 ++++++++++++++-------------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index f1b8d1d1..ddce9a88 100644 --- a/Makefile +++ b/Makefile @@ -13,48 +13,48 @@ SERVICES := db web proxy redis celery celery-beat .PHONY: setup certs up build username pull down stop restart rm logs certs: ## Generate certificates. - @${COMPOSE_PREFIX_CMD} docker-compose -f docker-compose.setup.yml run --rm certs + @${COMPOSE_PREFIX_CMD} docker compose -f docker-compose.setup.yml run --rm certs setup: ## Generate certificates. @make certs up: ## Build and start all services. - ${COMPOSE_PREFIX_CMD} docker-compose ${COMPOSE_ALL_FILES} up -d --build ${SERVICES} + ${COMPOSE_PREFIX_CMD} docker compose ${COMPOSE_ALL_FILES} up -d --build ${SERVICES} build: ## Build all services. - ${COMPOSE_PREFIX_CMD} docker-compose ${COMPOSE_ALL_FILES} build ${SERVICES} + ${COMPOSE_PREFIX_CMD} docker compose ${COMPOSE_ALL_FILES} build ${SERVICES} username: ## Generate Username (Use only after make up). - ${COMPOSE_PREFIX_CMD} docker-compose ${COMPOSE_ALL_FILES} exec web python3 manage.py createsuperuser + ${COMPOSE_PREFIX_CMD} docker compose ${COMPOSE_ALL_FILES} exec web python3 manage.py createsuperuser pull: ## Pull Docker images. docker login docker.pkg.github.com - ${COMPOSE_PREFIX_CMD} docker-compose ${COMPOSE_ALL_FILES} pull + ${COMPOSE_PREFIX_CMD} docker compose ${COMPOSE_ALL_FILES} pull down: ## Down all services. - ${COMPOSE_PREFIX_CMD} docker-compose ${COMPOSE_ALL_FILES} down + ${COMPOSE_PREFIX_CMD} docker compose ${COMPOSE_ALL_FILES} down stop: ## Stop all services. - ${COMPOSE_PREFIX_CMD} docker-compose ${COMPOSE_ALL_FILES} stop ${SERVICES} + ${COMPOSE_PREFIX_CMD} docker compose ${COMPOSE_ALL_FILES} stop ${SERVICES} restart: ## Restart all services. - ${COMPOSE_PREFIX_CMD} docker-compose ${COMPOSE_ALL_FILES} restart ${SERVICES} + ${COMPOSE_PREFIX_CMD} docker compose ${COMPOSE_ALL_FILES} restart ${SERVICES} rm: ## Remove all services containers. - ${COMPOSE_PREFIX_CMD} docker-compose $(COMPOSE_ALL_FILES) rm -f ${SERVICES} + ${COMPOSE_PREFIX_CMD} docker compose $(COMPOSE_ALL_FILES) rm -f ${SERVICES} test: - ${COMPOSE_PREFIX_CMD} docker-compose $(COMPOSE_ALL_FILES) exec celery python3 -m unittest tests/test_scan.py + ${COMPOSE_PREFIX_CMD} docker compose $(COMPOSE_ALL_FILES) exec celery python3 -m unittest tests/test_scan.py logs: ## Tail all logs with -n 1000. - ${COMPOSE_PREFIX_CMD} docker-compose $(COMPOSE_ALL_FILES) logs --follow --tail=1000 ${SERVICES} + ${COMPOSE_PREFIX_CMD} docker compose $(COMPOSE_ALL_FILES) logs --follow --tail=1000 ${SERVICES} images: ## Show all Docker images. - ${COMPOSE_PREFIX_CMD} docker-compose $(COMPOSE_ALL_FILES) images ${SERVICES} + ${COMPOSE_PREFIX_CMD} docker compose $(COMPOSE_ALL_FILES) images ${SERVICES} prune: ## Remove containers and delete volume data. @make stop && make rm && docker volume prune -f help: ## Show this help. - @echo "Make application docker images and manage containers using docker-compose files." + @echo "Make application docker images and manage containers using Docker Compose files." @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m (default: help)\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-12s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) diff --git a/install.sh b/install.sh index 7aaef548..46a677c2 100755 --- a/install.sh +++ b/install.sh @@ -67,9 +67,9 @@ else fi log "\r\n#########################################################################" 4 -log "Installing docker-compose" 4 +log "Installing Docker Compose" 4 -if ! command -v docker-compose 2> /dev/null; then +if ! command -v docker compose 2> /dev/null; then curl -L "https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose diff --git a/make.bat b/make.bat index 0a99cb6c..f3762231 100644 --- a/make.bat +++ b/make.bat @@ -6,30 +6,30 @@ set COMPOSE_ALL_FILES = -f docker-compose.yml set SERVICES = db web proxy redis celery celery-beat :: Generate certificates. -if "%1" == "certs" docker-compose -f docker-compose.setup.yml run --rm certs +if "%1" == "certs" docker compose -f docker-compose.setup.yml run --rm certs :: Generate certificates. -if "%1" == "setup" docker-compose -f docker-compose.setup.yml run --rm certs +if "%1" == "setup" docker compose -f docker-compose.setup.yml run --rm certs :: Build and start all services. -if "%1" == "up" docker-compose %COMPOSE_ALL_FILES% up -d --build %SERVICES% +if "%1" == "up" docker compose %COMPOSE_ALL_FILES% up -d --build %SERVICES% :: Build all services. -if "%1" == "build" docker-compose %COMPOSE_ALL_FILES% build %SERVICES% +if "%1" == "build" docker compose %COMPOSE_ALL_FILES% build %SERVICES% :: Generate Username (Use only after make up). -if "%1" == "username" docker-compose %COMPOSE_ALL_FILES% exec web python3 manage.py createsuperuser +if "%1" == "username" docker compose %COMPOSE_ALL_FILES% exec web python3 manage.py createsuperuser :: Pull Docker images. -if "%1" == "pull" docker login docker.pkg.github.com & docker-compose %COMPOSE_ALL_FILES% pull +if "%1" == "pull" docker login docker.pkg.github.com & docker compose %COMPOSE_ALL_FILES% pull :: Down all services. -if "%1" == "down" docker-compose %COMPOSE_ALL_FILES% down +if "%1" == "down" docker compose %COMPOSE_ALL_FILES% down :: Stop all services. -if "%1" == "stop" docker-compose %COMPOSE_ALL_FILES% stop %SERVICES% +if "%1" == "stop" docker compose %COMPOSE_ALL_FILES% stop %SERVICES% :: Restart all services. -if "%1" == "restart" docker-compose %COMPOSE_ALL_FILES% restart %SERVICES% +if "%1" == "restart" docker compose %COMPOSE_ALL_FILES% restart %SERVICES% :: Remove all services containers. -if "%1" == "rm" docker-compose %COMPOSE_ALL_FILES% rm -f %SERVICES% +if "%1" == "rm" docker compose %COMPOSE_ALL_FILES% rm -f %SERVICES% :: Tail all logs with -n 1000. -if "%1" == "logs" docker-compose %COMPOSE_ALL_FILES% logs --follow --tail=1000 %SERVICES% +if "%1" == "logs" docker compose %COMPOSE_ALL_FILES% logs --follow --tail=1000 %SERVICES% :: Show all Docker images. -if "%1" == "images" docker-compose %COMPOSE_ALL_FILES% images %SERVICES% +if "%1" == "images" docker compose %COMPOSE_ALL_FILES% images %SERVICES% :: Remove containers and delete volume data. -if "%1" == "prune" docker-compose %COMPOSE_ALL_FILES% stop %SERVICES% & docker-compose %COMPOSE_ALL_FILES% rm -f %SERVICES% & docker volume prune -f +if "%1" == "prune" docker compose %COMPOSE_ALL_FILES% stop %SERVICES% & docker compose %COMPOSE_ALL_FILES% rm -f %SERVICES% & docker volume prune -f :: Show this help. -if "%1" == "help" @echo Make application docker images and manage containers using docker-compose files only for windows. +if "%1" == "help" @echo Make application docker images and manage containers using Docker Compose files only for Windows. From 927774abf9e3294fcd0e677ace069ab587eadcae Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Fri, 7 Jun 2024 16:28:17 +0200 Subject: [PATCH 04/25] build(docker): fix leftover Docker Compose V1 commands --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 46a677c2..5b6ed250 100755 --- a/install.sh +++ b/install.sh @@ -73,9 +73,9 @@ if ! command -v docker compose 2> /dev/null; then curl -L "https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose - log "docker-compose installed!" 2 + log "Docker Compose installed!" 2 else - log "docker-compose already installed, skipping." 2 + log "Docker Compose already installed, skipping." 2 fi log "\r\n#########################################################################" 4 From d9ea8ac6b21cae672a15829445339a54b53c7923 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Fri, 7 Jun 2024 16:28:44 +0200 Subject: [PATCH 05/25] build(docker): update Docker Compose to 2.27.1 --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 5b6ed250..838a2bb1 100755 --- a/install.sh +++ b/install.sh @@ -70,7 +70,7 @@ log "\r\n####################################################################### log "Installing Docker Compose" 4 if ! command -v docker compose 2> /dev/null; then - curl -L "https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + curl -L "https://github.com/docker/compose/releases/download/v2.27.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose log "Docker Compose installed!" 2 From 1dc77d84f3b49ec939c70eb591ec7e1b60b523be Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Sat, 8 Jun 2024 13:41:56 +0200 Subject: [PATCH 06/25] build(install): change colours for better readability --- install.sh | 57 +++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/install.sh b/install.sh index 838a2bb1..11a623d4 100755 --- a/install.sh +++ b/install.sh @@ -20,16 +20,16 @@ cat web/art/reNgine.txt log "\r\nBefore running this script, please make sure Docker is running and you have made changes to the .env file." 1 log "Changing the postgres username & password from .env is highly recommended.\r\n" 1 -log "#########################################################################" 4 -log "Please note that this installation script is only intended for Linux" 3 -log "Only x86_64 platform are supported" 3 -log "#########################################################################\r\n" 4 +log "#########################################################################" 6 +log "Please note that this installation script is only intended for Linux" 6 +log "Only x86_64 platform are supported" 6 +log "#########################################################################\r\n" 6 tput setaf 1; read -p "Are you sure you made changes to the .env file (y/n)? " answer case ${answer:0:1} in y|Y|yes|YES|Yes ) - log "Continuing Installation!" 2 + log "Continuing installation!\n" 2 ;; * ) if [ -x "$(command -v nano)" ]; then @@ -42,11 +42,12 @@ case ${answer:0:1} in ;; esac -log "\r\nInstalling reNgine-ng and its dependencies" 4 -log "=========================================================================" 4 +log "=========================================================================" 6 +log "Installing reNgine-ng and its dependencies..." 6 +log "=========================================================================" 6 -log "\r\n#########################################################################" 4 -log "Installing curl..." 4 +log "\r\n#########################################################################" 6 +log "Installing curl..." 6 if ! command -v curl 2> /dev/null; then apt update && apt install curl -y @@ -56,8 +57,8 @@ else fi -log "\r\n#########################################################################" 4 -log "Installing Docker..." 4 +log "\r\n#########################################################################" 6 +log "Installing Docker..." 6 if ! command -v docker 2> /dev/null; then curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh @@ -66,8 +67,8 @@ else log "Docker already installed, skipping." 2 fi -log "\r\n#########################################################################" 4 -log "Installing Docker Compose" 4 +log "\r\n#########################################################################" 6 +log "Installing Docker Compose..." 6 if ! command -v docker compose 2> /dev/null; then curl -L "https://github.com/docker/compose/releases/download/v2.27.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose @@ -78,8 +79,8 @@ else log "Docker Compose already installed, skipping." 2 fi -log "\r\n#########################################################################" 4 -log "Installing make" 4 +log "\r\n#########################################################################" 6 +log "Installing make..." 6 if ! command -v make 2> /dev/null; then apt install make -y @@ -88,8 +89,8 @@ else log "make already installed, skipping." 2 fi -log "\r\n#########################################################################" 4 -log "Checking Docker status" 4 +log "\r\n#########################################################################" 6 +log "Checking Docker status..." 6 if docker info >/dev/null 2>&1; then log "Docker is running." 2 else @@ -98,25 +99,25 @@ else exit 1 fi -log "\r\n#########################################################################" 4 -log "Installing reNgine-ng, please be patient as it could take a while" 1 +log "\r\n#########################################################################" 6 +log "Installing reNgine-ng, please be patient as it could take a while..." 6 sleep 5 -log "\r\n=========================================================================" 5 -log "Generating certificates and building docker images" 5 -log "=========================================================================" 5 +log "\r\n=========================================================================" 6 +log "Generating certificates and building Docker images..." 6 +log "=========================================================================" 6 make certs && make build && log "reNgine-ng is built" 2 || { log "reNgine-ng installation failed!" 1; exit 1; } -log "\r\n=========================================================================" 5 -log "Docker containers starting, please wait as Celery container could take a while" 1 +log "\r\n=========================================================================" 6 +log "Docker containers starting, please wait as Celery container could take a while..." 6 sleep 5 -log "=========================================================================" 5 +log "=========================================================================" 6 make up && log "reNgine-ng is installed!" 2 || { log "reNgine-ng installation failed!" 1; exit 1; } -log "\r\n#########################################################################" 4 -log "Creating an account" 4 -log "#########################################################################" 4 +log "\r\n#########################################################################" 6 +log "Creating an account..." 6 +log "#########################################################################" 6 make username log "\r\nThank you for installing reNgine-ng, happy recon!" 2 From 2fd59aa6de00b5b77fcc8791fc9007cf18997493 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Sat, 8 Jun 2024 13:52:48 +0200 Subject: [PATCH 07/25] build(uninstall): replace echo by log --- scripts/uninstall.sh | 76 ++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index dd79b762..3bf8a521 100755 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -4,100 +4,100 @@ tput setaf 2; cat ../web/art/reNgine.txt tput setaf 3; -echo "" -echo "Uninstalling reNGine" +log "" +log "Uninstalling reNGine" if [ "$EUID" -ne 0 ] then - echo "" - echo "Error uninstalling reNGine, Please run this script as root!" - echo "Example: sudo ./uninstall.sh" + log "" + log "Error uninstalling reNGine, Please run this script as root!" + log "Example: sudo ./uninstall.sh" exit fi tput setaf 1; -echo "" +log "" read -p "This action will stop and remove all containers, volumes and networks of reNGine. Do you want to continue? [y/n] " -n 1 -r -echo "" +log "" if [[ $REPLY =~ ^[Yy]$ ]] then - echo "" + log "" tput setaf 3; - echo "Stopping reNGine" + log "Stopping reNGine" tput setaf 4; docker stop rengine-web-1 rengine-db-1 rengine-celery-1 rengine-celery-beat-1 rengine-redis-1 rengine-proxy-1 tput setaf 3; - echo "Stopped reNGine" - echo "" + log "Stopped reNGine" + log "" - echo "Removing all containers related to reNGine" + log "Removing all containers related to reNGine" tput setaf 4; docker rm rengine-web-1 rengine-db-1 rengine-celery-1 rengine-celery-beat-1 rengine-redis-1 rengine-proxy-1 tput setaf 3; - echo "Removed all containers related to reNGine" - echo "" + log "Removed all containers related to reNGine" + log "" - echo "Removing all volumes related to reNGine" + log "Removing all volumes related to reNGine" tput setaf 4; docker volume rm rengine_gf_patterns rengine_github_repos rengine_nuclei_templates rengine_postgres_data rengine_scan_results rengine_tool_config rengine_static_volume rengine_wordlist tput setaf 3; - echo "Removed all volumes related to reNGine" - echo "" + log "Removed all volumes related to reNGine" + log "" - echo "Removing all networks related to reNGine" + log "Removing all networks related to reNGine" tput setaf 4; docker network rm rengine_rengine_network rengine_default tput setaf 3; - echo "Removed all networks related to reNGine" - echo "" + log "Removed all networks related to reNGine" + log "" else tput setaf 2; - echo "" - echo "Exiting!" + log "" + log "Exiting!" exit 1 fi tput setaf 1; read -p "Do you want to remove Docker images related to reNGine? [y/n] " -n 1 -r -echo "" +log "" if [[ $REPLY =~ ^[Yy]$ ]] then - echo "" + log "" tput setaf 3; - echo "Removing all Docker images related to reNGine" + log "Removing all Docker images related to reNGine" tput setaf 4; docker image rm rengine-celery rengine-celery-beat rengine-certs docker.pkg.github.com/yogeshojha/rengine/rengine nginx:alpine redis:alpine postgres:12.3-alpine tput setaf 3; - echo "Removed all Docker images" - echo "" + log "Removed all Docker images" + log "" else tput setaf 2; - echo "" - echo "Skipping removal of Docker images" + log "" + log "Skipping removal of Docker images" fi tput setaf 1; read -p "Do you want to remove all Docker-related leftovers? [y/n] " -n 1 -r -echo "" +log "" if [[ $REPLY =~ ^[Yy]$ ]] then - echo "" + log "" tput setaf 3; - echo "Removing all Docker-related leftovers" + log "Removing all Docker-related leftovers" tput setaf 4; docker system prune -a -f tput setaf 3; - echo "Removed all Docker-related leftovers" - echo "" + log "Removed all Docker-related leftovers" + log "" else - echo "" - echo "Skipping removal of Docker-related leftovers" - echo "" + log "" + log "Skipping removal of Docker-related leftovers" + log "" fi tput setaf 2; -echo "Finished uninstalling." +log "Finished uninstalling." From 61390c24baf94045b4fbb533a7d79f7b24940324 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Sat, 8 Jun 2024 20:00:51 +0200 Subject: [PATCH 08/25] build(uninstall): use variables for setting colour --- scripts/uninstall.sh | 93 +++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 44 deletions(-) diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index 3bf8a521..4b31cb90 100755 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -1,81 +1,91 @@ #!/bin/bash -tput setaf 2; +# Define color codes. +# Using `tput setaf` at some places because the variable only works with log/echo + +COLOR_BLACK=0 +COLOR_RED=1 +COLOR_GREEN=2 +COLOR_YELLOW=3 +COLOR_BLUE=4 +COLOR_MAGENTA=5 +COLOR_CYAN=6 +COLOR_WHITE=7 +COLOR_DEFAULT=$COLOR_WHITE # Use white as default for clarity + +# Log messages in different colors +log() { + local color=${2:-$COLOR_DEFAULT} # Use default color if $2 is not set + if [ "$color" -ne $COLOR_DEFAULT ]; then + tput setaf "$color" + fi + printf "$1\r\n" + tput sgr0 # Reset text color +} + cat ../web/art/reNgine.txt -tput setaf 3; log "" -log "Uninstalling reNGine" +log "Uninstalling reNgine-ng..." $COLOR_CYAN -if [ "$EUID" -ne 0 ] +# Check for root privileges +if [ "$(whoami)" != "root" ] then log "" - log "Error uninstalling reNGine, Please run this script as root!" - log "Example: sudo ./uninstall.sh" + log "Error uninstalling reNgine-ng, Please run this script as root!" $COLOR_RED + log "Example: sudo ./uninstall.sh" $COLOR_RED exit fi -tput setaf 1; log "" -read -p "This action will stop and remove all containers, volumes and networks of reNGine. Do you want to continue? [y/n] " -n 1 -r + +tput setaf 1 +read -p "This action will stop and remove all containers, volumes and networks of reNgine-ng. Do you want to continue? [y/n] " -n 1 log "" if [[ $REPLY =~ ^[Yy]$ ]] then log "" - tput setaf 3; - log "Stopping reNGine" - tput setaf 4; + + log "Stopping reNgine-ng..." $COLOR_CYAN docker stop rengine-web-1 rengine-db-1 rengine-celery-1 rengine-celery-beat-1 rengine-redis-1 rengine-proxy-1 - tput setaf 3; - log "Stopped reNGine" + log "Stopped reNgine-ng" $COLOR_GREEN log "" - log "Removing all containers related to reNGine" - tput setaf 4; + log "Removing all containers related to reNgine-ng..." $COLOR_CYAN docker rm rengine-web-1 rengine-db-1 rengine-celery-1 rengine-celery-beat-1 rengine-redis-1 rengine-proxy-1 - tput setaf 3; - log "Removed all containers related to reNGine" + log "Removed all containers related to reNgine-ng" $COLOR_GREEN log "" - log "Removing all volumes related to reNGine" - tput setaf 4; + log "Removing all volumes related to reNgine-ng..." $COLOR_CYAN docker volume rm rengine_gf_patterns rengine_github_repos rengine_nuclei_templates rengine_postgres_data rengine_scan_results rengine_tool_config rengine_static_volume rengine_wordlist - tput setaf 3; - log "Removed all volumes related to reNGine" + log "Removed all volumes related to reNgine-ng" $COLOR_GREEN log "" - log "Removing all networks related to reNGine" - tput setaf 4; + log "Removing all networks related to reNgine-ng..." $COLOR_CYAN docker network rm rengine_rengine_network rengine_default - tput setaf 3; - log "Removed all networks related to reNGine" + log "Removed all networks related to reNgine-ng" $COLOR_GREEN log "" else - tput setaf 2; log "" - log "Exiting!" + log "Exiting!" $COLOR_DEFAULT exit 1 fi tput setaf 1; -read -p "Do you want to remove Docker images related to reNGine? [y/n] " -n 1 -r +read -p "Do you want to remove Docker images related to reNgine-ng? [y/n] " -n 1 -r log "" if [[ $REPLY =~ ^[Yy]$ ]] then log "" - tput setaf 3; - log "Removing all Docker images related to reNGine" - tput setaf 4; + log "Removing all Docker images related to reNgine-ng..." $COLOR_CYAN docker image rm rengine-celery rengine-celery-beat rengine-certs docker.pkg.github.com/yogeshojha/rengine/rengine nginx:alpine redis:alpine postgres:12.3-alpine - tput setaf 3; - log "Removed all Docker images" + log "Removed all Docker images" $COLOR_GREEN log "" else - tput setaf 2; log "" - log "Skipping removal of Docker images" + log "Skipping removal of Docker images" $COLOR_CYAN fi tput setaf 1; @@ -85,19 +95,14 @@ log "" if [[ $REPLY =~ ^[Yy]$ ]] then log "" - tput setaf 3; - log "Removing all Docker-related leftovers" - tput setaf 4; + log "Removing all Docker-related leftovers..." $COLOR_CYAN docker system prune -a -f - tput setaf 3; - log "Removed all Docker-related leftovers" + log "Removed all Docker-related leftovers" $COLOR_GREEN log "" else log "" - log "Skipping removal of Docker-related leftovers" + log "Skipping removal of Docker-related leftovers..." $COLOR_CYAN log "" fi - -tput setaf 2; -log "Finished uninstalling." +log "Finished uninstalling." $COLOR_GREEN From 45fc8961d3f8ac1f977af192caaf61662e87bdc1 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Sat, 8 Jun 2024 21:35:53 +0200 Subject: [PATCH 09/25] build(install): use variables for setting colour --- install.sh | 51 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/install.sh b/install.sh index 11a623d4..527e8275 100755 --- a/install.sh +++ b/install.sh @@ -1,42 +1,59 @@ #!/bin/bash -#log messages in different colors +# Define color codes. +# Using `tput setaf` at some places because the variable only works with log/echo + +COLOR_BLACK=0 +COLOR_RED=1 +COLOR_GREEN=2 +COLOR_YELLOW=3 +COLOR_BLUE=4 +COLOR_MAGENTA=5 +COLOR_CYAN=6 +COLOR_WHITE=7 +COLOR_DEFAULT=$COLOR_WHITE # Use white as default for clarity + +# Log messages in different colors log() { - tput setaf "$2" + local color=${2:-$COLOR_DEFAULT} # Use default color if $2 is not set + if [ "$color" -ne $COLOR_DEFAULT ]; then + tput setaf "$color" + fi printf "$1\r\n" tput sgr0 # Reset text color } # Check for root privileges -if [ "$(id -u)" -ne 0 ]; then - log "Error: please run this script as root!" 1 - log "Example: sudo $0" 1 - exit 1 +if [ "$(whoami)" != "root" ] + then + log "" + log "Error installing reNgine-ng: please run this script as root!" $COLOR_RED + log "Example: sudo ./install.sh" $COLOR_RED + exit fi -tput setaf 2; -cat web/art/reNgine.txt +log "" -log "\r\nBefore running this script, please make sure Docker is running and you have made changes to the .env file." 1 -log "Changing the postgres username & password from .env is highly recommended.\r\n" 1 +log "\r\nBefore running this script, please make sure Docker is running and you have made changes to the .env file." $COLOR_RED +log "Changing the postgres username & password from .env is highly recommended.\r\n" $COLOR_RED -log "#########################################################################" 6 -log "Please note that this installation script is only intended for Linux" 6 -log "Only x86_64 platform are supported" 6 -log "#########################################################################\r\n" 6 +log "#########################################################################" $COLOR_CYAN +log "Please note that this installation script is only intended for Linux" $COLOR_CYAN +log "Only x86_64 platform are supported" $COLOR_CYAN +log "#########################################################################\r\n" $COLOR_CYAN tput setaf 1; read -p "Are you sure you made changes to the .env file (y/n)? " answer case ${answer:0:1} in y|Y|yes|YES|Yes ) - log "Continuing installation!\n" 2 + log "Continuing installation...\n" $COLOR_CYAN ;; * ) if [ -x "$(command -v nano)" ]; then - log "nano already installed, skipping." 2 + log "nano already installed, skipping." $COLOR_CYAN else sudo apt update && sudo apt install nano -y - log "nano installed!" 2 + log "nano installed!" $COLOR_GREEN fi nano .env ;; From 51b18a55cdcfe9e537eca9ec9da9712f791f5f0c Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Sat, 8 Jun 2024 21:37:04 +0200 Subject: [PATCH 10/25] build(install): remove hashtags and equal signs --- install.sh | 59 +++++++++++++++++++----------------------------------- 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/install.sh b/install.sh index 527e8275..7e4e79b2 100755 --- a/install.sh +++ b/install.sh @@ -27,44 +27,39 @@ log() { if [ "$(whoami)" != "root" ] then log "" - log "Error installing reNgine-ng: please run this script as root!" $COLOR_RED - log "Example: sudo ./install.sh" $COLOR_RED + log "Error uninstalling reNgine-ng: please run this script as root!" $COLOR_RED + log "Example: sudo ./uninstall.sh" $COLOR_RED exit fi -log "" +cat web/art/reNgine.txt log "\r\nBefore running this script, please make sure Docker is running and you have made changes to the .env file." $COLOR_RED log "Changing the postgres username & password from .env is highly recommended.\r\n" $COLOR_RED -log "#########################################################################" $COLOR_CYAN -log "Please note that this installation script is only intended for Linux" $COLOR_CYAN -log "Only x86_64 platform are supported" $COLOR_CYAN -log "#########################################################################\r\n" $COLOR_CYAN +log "Please note that this installation script is only intended for Linux" $COLOR_RED +log "Only x86_64 platform are supported" $COLOR_RED tput setaf 1; read -p "Are you sure you made changes to the .env file (y/n)? " answer case ${answer:0:1} in y|Y|yes|YES|Yes ) - log "Continuing installation...\n" $COLOR_CYAN + log "Continuing installation!\n" 2 ;; * ) if [ -x "$(command -v nano)" ]; then - log "nano already installed, skipping." $COLOR_CYAN + log "nano already installed, skipping." 2 else sudo apt update && sudo apt install nano -y - log "nano installed!" $COLOR_GREEN + log "nano installed!" 2 fi nano .env ;; esac -log "=========================================================================" 6 -log "Installing reNgine-ng and its dependencies..." 6 -log "=========================================================================" 6 +log "Installing reNgine-ng and its dependencies..." $COLOR_CYAN -log "\r\n#########################################################################" 6 -log "Installing curl..." 6 +log "Installing curl..." $COLOR_CYAN if ! command -v curl 2> /dev/null; then apt update && apt install curl -y @@ -73,9 +68,7 @@ else log "CURL already installed, skipping." 2 fi - -log "\r\n#########################################################################" 6 -log "Installing Docker..." 6 +log "Installing Docker..." $COLOR_CYAN if ! command -v docker 2> /dev/null; then curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh @@ -84,8 +77,7 @@ else log "Docker already installed, skipping." 2 fi -log "\r\n#########################################################################" 6 -log "Installing Docker Compose..." 6 +log "Installing Docker Compose..." $COLOR_CYAN if ! command -v docker compose 2> /dev/null; then curl -L "https://github.com/docker/compose/releases/download/v2.27.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose @@ -96,8 +88,7 @@ else log "Docker Compose already installed, skipping." 2 fi -log "\r\n#########################################################################" 6 -log "Installing make..." 6 +log "Installing make..." $COLOR_CYAN if ! command -v make 2> /dev/null; then apt install make -y @@ -106,35 +97,27 @@ else log "make already installed, skipping." 2 fi -log "\r\n#########################################################################" 6 -log "Checking Docker status..." 6 +log "Checking Docker status..." $COLOR_CYAN if docker info >/dev/null 2>&1; then log "Docker is running." 2 else - log "Docker is not running. Please run docker and try again." 1 - log "You can run Docker service using: sudo systemctl start docker" 1 + log "Docker is not running. Please run docker and try again." $COLOR_RED + log "You can run Docker service using: sudo systemctl start docker" $COLOR_RED exit 1 fi -log "\r\n#########################################################################" 6 -log "Installing reNgine-ng, please be patient as it could take a while..." 6 +log "Installing reNgine-ng, please be patient as it could take a while..." $COLOR_CYAN sleep 5 -log "\r\n=========================================================================" 6 -log "Generating certificates and building Docker images..." 6 -log "=========================================================================" 6 +log "Generating certificates and building Docker images..." $COLOR_CYAN make certs && make build && log "reNgine-ng is built" 2 || { log "reNgine-ng installation failed!" 1; exit 1; } -log "\r\n=========================================================================" 6 -log "Docker containers starting, please wait as Celery container could take a while..." 6 +log "Docker containers starting, please wait as Celery container could take a while..." $COLOR_CYAN sleep 5 -log "=========================================================================" 6 -make up && log "reNgine-ng is installed!" 2 || { log "reNgine-ng installation failed!" 1; exit 1; } +make up && log "reNgine-ng is installed!" 2 || { log "reNgine-ng installation failed!" $COLOR_RED; exit 1; } -log "\r\n#########################################################################" 6 -log "Creating an account..." 6 -log "#########################################################################" 6 +log "Creating an account..." $COLOR_CYAN make username log "\r\nThank you for installing reNgine-ng, happy recon!" 2 From eb9fc893539c3e8f2b1193973c3817c0bbe93e88 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Sat, 8 Jun 2024 21:37:18 +0200 Subject: [PATCH 11/25] build(uninstall): fix typo --- scripts/uninstall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index 4b31cb90..916deccc 100755 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -32,7 +32,7 @@ log "Uninstalling reNgine-ng..." $COLOR_CYAN if [ "$(whoami)" != "root" ] then log "" - log "Error uninstalling reNgine-ng, Please run this script as root!" $COLOR_RED + log "Error uninstalling reNgine-ng: please run this script as root!" $COLOR_RED log "Example: sudo ./uninstall.sh" $COLOR_RED exit fi From f3ab232b4672b23ac9575e8020b8662bfebadb2b Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Sat, 8 Jun 2024 21:38:36 +0200 Subject: [PATCH 12/25] build(install): fix wrong error message --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 7e4e79b2..0d4b8b9a 100755 --- a/install.sh +++ b/install.sh @@ -27,8 +27,8 @@ log() { if [ "$(whoami)" != "root" ] then log "" - log "Error uninstalling reNgine-ng: please run this script as root!" $COLOR_RED - log "Example: sudo ./uninstall.sh" $COLOR_RED + log "Error installing reNgine-ng: please run this script as root!" $COLOR_RED + log "Example: sudo ./install.sh" $COLOR_RED exit fi From b641c18ff511b55416037ef17e2a12961dfed48f Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Sat, 8 Jun 2024 21:44:00 +0200 Subject: [PATCH 13/25] build(install): replace numbers by variable --- install.sh | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/install.sh b/install.sh index 0d4b8b9a..c3d5c743 100755 --- a/install.sh +++ b/install.sh @@ -35,23 +35,24 @@ fi cat web/art/reNgine.txt log "\r\nBefore running this script, please make sure Docker is running and you have made changes to the .env file." $COLOR_RED -log "Changing the postgres username & password from .env is highly recommended.\r\n" $COLOR_RED +log "Changing the PostgreSQL username & password from .env is highly recommended.\r\n" $COLOR_RED log "Please note that this installation script is only intended for Linux" $COLOR_RED log "Only x86_64 platform are supported" $COLOR_RED +log "" tput setaf 1; read -p "Are you sure you made changes to the .env file (y/n)? " answer case ${answer:0:1} in y|Y|yes|YES|Yes ) - log "Continuing installation!\n" 2 + log "Continuing installation!\n" $COLOR_GREEN ;; * ) if [ -x "$(command -v nano)" ]; then - log "nano already installed, skipping." 2 + log "nano already installed, skipping." $COLOR_GREEN else sudo apt update && sudo apt install nano -y - log "nano installed!" 2 + log "nano installed!" $COLOR_GREEN fi nano .env ;; @@ -63,18 +64,18 @@ log "Installing curl..." $COLOR_CYAN if ! command -v curl 2> /dev/null; then apt update && apt install curl -y - log "CURL installed!" 2 + log "CURL installed!" $COLOR_GREEN else - log "CURL already installed, skipping." 2 + log "CURL already installed, skipping." $COLOR_GREEN fi log "Installing Docker..." $COLOR_CYAN if ! command -v docker 2> /dev/null; then curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh - log "Docker installed!" 2 + log "Docker installed!" $COLOR_GREEN else - log "Docker already installed, skipping." 2 + log "Docker already installed, skipping." $COLOR_GREEN fi log "Installing Docker Compose..." $COLOR_CYAN @@ -83,23 +84,23 @@ if ! command -v docker compose 2> /dev/null; then curl -L "https://github.com/docker/compose/releases/download/v2.27.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose - log "Docker Compose installed!" 2 + log "Docker Compose installed!" $COLOR_GREEN else - log "Docker Compose already installed, skipping." 2 + log "Docker Compose already installed, skipping." $COLOR_GREEN fi log "Installing make..." $COLOR_CYAN if ! command -v make 2> /dev/null; then apt install make -y - log "make installed!" 2 + log "make installed!" $COLOR_GREEN else - log "make already installed, skipping." 2 + log "make already installed, skipping." $COLOR_GREEN fi log "Checking Docker status..." $COLOR_CYAN if docker info >/dev/null 2>&1; then - log "Docker is running." 2 + log "Docker is running." $COLOR_GREEN else log "Docker is not running. Please run docker and try again." $COLOR_RED log "You can run Docker service using: sudo systemctl start docker" $COLOR_RED @@ -110,14 +111,14 @@ log "Installing reNgine-ng, please be patient as it could take a while..." $COLO sleep 5 log "Generating certificates and building Docker images..." $COLOR_CYAN -make certs && make build && log "reNgine-ng is built" 2 || { log "reNgine-ng installation failed!" 1; exit 1; } +make certs && make build && log "reNgine-ng is built" $COLOR_GREEN || { log "reNgine-ng installation failed!" 1; exit 1; } log "Docker containers starting, please wait as Celery container could take a while..." $COLOR_CYAN sleep 5 -make up && log "reNgine-ng is installed!" 2 || { log "reNgine-ng installation failed!" $COLOR_RED; exit 1; } +make up && log "reNgine-ng is installed!" $COLOR_GREEN || { log "reNgine-ng installation failed!" $COLOR_RED; exit 1; } log "Creating an account..." $COLOR_CYAN make username -log "\r\nThank you for installing reNgine-ng, happy recon!" 2 +log "\r\nThank you for installing reNgine-ng, happy recon!" $COLOR_GREEN From 4558ae2f925fbc6f85f540c7bd18fa549c388014 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Mon, 10 Jun 2024 12:36:18 +0200 Subject: [PATCH 14/25] build(uninstall): don't show uninstalling string when not sudo --- scripts/uninstall.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index 916deccc..3daf01a0 100755 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -25,9 +25,6 @@ log() { cat ../web/art/reNgine.txt -log "" -log "Uninstalling reNgine-ng..." $COLOR_CYAN - # Check for root privileges if [ "$(whoami)" != "root" ] then @@ -37,6 +34,8 @@ if [ "$(whoami)" != "root" ] exit fi +log "" +log "Uninstalling reNgine-ng..." $COLOR_CYAN log "" tput setaf 1 From 97700ec8841fa8a98f3a221b7695744966f80106 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Mon, 10 Jun 2024 13:41:59 +0200 Subject: [PATCH 15/25] build(docker-compose): always use latest release Makes sure we don't need to manually update it --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index c3d5c743..8c1ab29a 100755 --- a/install.sh +++ b/install.sh @@ -45,7 +45,7 @@ tput setaf 1; read -p "Are you sure you made changes to the .env file (y/n)? " answer case ${answer:0:1} in y|Y|yes|YES|Yes ) - log "Continuing installation!\n" $COLOR_GREEN + log "\nContinuing installation!\n" $COLOR_GREEN ;; * ) if [ -x "$(command -v nano)" ]; then @@ -81,7 +81,7 @@ fi log "Installing Docker Compose..." $COLOR_CYAN if ! command -v docker compose 2> /dev/null; then - curl -L "https://github.com/docker/compose/releases/download/v2.27.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose log "Docker Compose installed!" $COLOR_GREEN From b4dd35d2b2f4000b26a813f907758207b92874dc Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Mon, 10 Jun 2024 14:08:34 +0200 Subject: [PATCH 16/25] build(update): add colours for output --- update.sh | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/update.sh b/update.sh index b29c9e77..223625d7 100755 --- a/update.sh +++ b/update.sh @@ -1,12 +1,39 @@ #!/bin/bash -echo "Do you want to apply your local changes after updating? (y/n)" -read answer +# Define color codes. +# Using `tput setaf` at some places because the variable only works with log/echo + +COLOR_BLACK=0 +COLOR_RED=1 +COLOR_GREEN=2 +COLOR_YELLOW=3 +COLOR_BLUE=4 +COLOR_MAGENTA=5 +COLOR_CYAN=6 +COLOR_WHITE=7 +COLOR_DEFAULT=$COLOR_WHITE # Use white as default for clarity + +# Log messages in different colors +log() { + local color=${2:-$COLOR_DEFAULT} # Use default color if $2 is not set + if [ "$color" -ne $COLOR_DEFAULT ]; then + tput setaf "$color" + fi + printf "$1\r\n" + tput sgr0 # Reset text color +} + +log +read -p "Do you want to apply your local changes after updating? (y/n) " answer if [[ $answer == "y" ]]; then make down && git stash save && git pull && git stash apply && make build && make up + tput setaf 2; + echo "Successfully updated" elif [[ $answer == "n" ]]; then make down && git stash && git stash drop && git pull && make build && make up + tput setaf 2; + echo "Successfully updated" else echo "Invalid input. Please enter 'y' or 'n'." fi From 67c60771450385fac7021389cda4a9e82f5d0889 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Mon, 10 Jun 2024 15:06:45 +0200 Subject: [PATCH 17/25] build(install/uninstall): fix typos --- install.sh | 9 ++------- update.sh | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/install.sh b/install.sh index 8c1ab29a..441232d9 100755 --- a/install.sh +++ b/install.sh @@ -61,7 +61,6 @@ esac log "Installing reNgine-ng and its dependencies..." $COLOR_CYAN log "Installing curl..." $COLOR_CYAN - if ! command -v curl 2> /dev/null; then apt update && apt install curl -y log "CURL installed!" $COLOR_GREEN @@ -70,7 +69,6 @@ else fi log "Installing Docker..." $COLOR_CYAN - if ! command -v docker 2> /dev/null; then curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh log "Docker installed!" $COLOR_GREEN @@ -79,7 +77,6 @@ else fi log "Installing Docker Compose..." $COLOR_CYAN - if ! command -v docker compose 2> /dev/null; then curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose @@ -90,7 +87,6 @@ else fi log "Installing make..." $COLOR_CYAN - if ! command -v make 2> /dev/null; then apt install make -y log "make installed!" $COLOR_GREEN @@ -102,7 +98,7 @@ log "Checking Docker status..." $COLOR_CYAN if docker info >/dev/null 2>&1; then log "Docker is running." $COLOR_GREEN else - log "Docker is not running. Please run docker and try again." $COLOR_RED + log "Docker is not running. Please run Docker and try again." $COLOR_RED log "You can run Docker service using: sudo systemctl start docker" $COLOR_RED exit 1 fi @@ -111,13 +107,12 @@ log "Installing reNgine-ng, please be patient as it could take a while..." $COLO sleep 5 log "Generating certificates and building Docker images..." $COLOR_CYAN -make certs && make build && log "reNgine-ng is built" $COLOR_GREEN || { log "reNgine-ng installation failed!" 1; exit 1; } +make certs && make build && log "reNgine-ng is built" $COLOR_GREEN || { log "reNgine-ng installation failed!" $COLOR_RED; exit 1; } log "Docker containers starting, please wait as Celery container could take a while..." $COLOR_CYAN sleep 5 make up && log "reNgine-ng is installed!" $COLOR_GREEN || { log "reNgine-ng installation failed!" $COLOR_RED; exit 1; } - log "Creating an account..." $COLOR_CYAN make username diff --git a/update.sh b/update.sh index 223625d7..32d95744 100755 --- a/update.sh +++ b/update.sh @@ -23,7 +23,6 @@ log() { tput sgr0 # Reset text color } -log read -p "Do you want to apply your local changes after updating? (y/n) " answer if [[ $answer == "y" ]]; then From 57babf5cc46b9d65ec8a529c05d0c04a4e6bf155 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Mon, 10 Jun 2024 16:13:10 +0200 Subject: [PATCH 18/25] build(install): install dependencies dynamically based on used repository --- install.sh | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/install.sh b/install.sh index 441232d9..8253a750 100755 --- a/install.sh +++ b/install.sh @@ -48,11 +48,19 @@ case ${answer:0:1} in log "\nContinuing installation!\n" $COLOR_GREEN ;; * ) - if [ -x "$(command -v nano)" ]; then - log "nano already installed, skipping." $COLOR_GREEN + if ! command -v nano &> /dev/null; then + . /etc/os-release + case "$ID" in + ubuntu|debian) sudo apt update && sudo apt install -y nano ;; + fedora) sudo dnf install -y nano ;; + centos|rhel) sudo yum install -y nano ;; + arch) sudo pacman -Sy nano ;; + opensuse|suse) sudo zypper install -y nano ;; + *) log "Unsupported Linux distribution. Please install nano manually." $COLOR_RED; exit 1 ;; + esac + [ $? -eq 0 ] && log "nano installed!" $COLOR_GREEN || { log "Failed to install nano." $COLOR_RED; exit 1; } else - sudo apt update && sudo apt install nano -y - log "nano installed!" $COLOR_GREEN + log "nano already installed, skipping." $COLOR_GREEN fi nano .env ;; @@ -61,9 +69,18 @@ esac log "Installing reNgine-ng and its dependencies..." $COLOR_CYAN log "Installing curl..." $COLOR_CYAN -if ! command -v curl 2> /dev/null; then - apt update && apt install curl -y - log "CURL installed!" $COLOR_GREEN + +if ! command -v curl &> /dev/null; then + . /etc/os-release + case "$ID" in + ubuntu|debian) sudo apt update && sudo apt install -y curl ;; + fedora) sudo dnf install -y curl ;; + centos|rhel) sudo yum install -y curl ;; + arch) sudo pacman -Sy curl ;; + opensuse|suse) sudo zypper install -y curl ;; + *) log "Unsupported Linux distribution. Please install curl manually." $COLOR_RED; exit 1 ;; + esac + [ $? -eq 0 ] && log "CURL installed!" $COLOR_GREEN || { log "Failed to install CURL." $COLOR_RED; exit 1; } else log "CURL already installed, skipping." $COLOR_GREEN fi @@ -86,10 +103,17 @@ else log "Docker Compose already installed, skipping." $COLOR_GREEN fi -log "Installing make..." $COLOR_CYAN -if ! command -v make 2> /dev/null; then - apt install make -y - log "make installed!" $COLOR_GREEN +if ! command -v make &> /dev/null; then + . /etc/os-release + case "$ID" in + ubuntu|debian) sudo apt update && sudo apt install -y make ;; + fedora) sudo dnf install -y make ;; + centos|rhel) sudo yum install -y make ;; + arch) sudo pacman -Sy make ;; + opensuse|suse) sudo zypper install -y make ;; + *) log "Unsupported Linux distribution. Please install make manually." $COLOR_RED; exit 1 ;; + esac + [ $? -eq 0 ] && log "make installed!" $COLOR_GREEN || { log "Failed to install make." $COLOR_RED; exit 1; } else log "make already installed, skipping." $COLOR_GREEN fi From 4fd579cf83fe4a5dae67855384111c0e5174d324 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Tue, 18 Jun 2024 20:17:23 +0200 Subject: [PATCH 19/25] build(docker): remove commented and empty line --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 5a0046ae..bb5b550a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,7 +36,6 @@ services: context: ./web restart: always entrypoint: /usr/src/app/celery-entrypoint.sh - # command: celery -A reNgine worker --autoscale=${MAX_CONCURRENCY},${MIN_CONCURRENCY} -l INFO volumes: - ./web:/usr/src/app - github_repos:/usr/src/github @@ -169,7 +168,6 @@ services: networks: - rengine_network - networks: rengine_network: From eb5f45f9b3f62eaa8e210ac2a117bcbce0151df8 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Tue, 18 Jun 2024 20:28:03 +0200 Subject: [PATCH 20/25] build(install): print URL of reNgine-ng after successful installation --- install.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/install.sh b/install.sh index cd58baa4..4af88277 100755 --- a/install.sh +++ b/install.sh @@ -13,6 +13,9 @@ COLOR_CYAN=6 COLOR_WHITE=7 COLOR_DEFAULT=$COLOR_WHITE # Use white as default for clarity +# Fetch the external IP address so that it can be printed later when the script has finished installing reNgine-ng +external_ip=$(curl -s https://ipecho.net/plain) + # Log messages in different colors log() { local color=${2:-$COLOR_DEFAULT} # Use default color if $2 is not set @@ -141,3 +144,6 @@ log "Creating an account..." $COLOR_CYAN make username log "\r\nThank you for installing reNgine-ng, happy recon!" $COLOR_GREEN + +log "\r\nIn case you're running this locally, reNgine-ng should be available at: https://127.0.0.1/" $COLOR_GREEN +log "In case you're running this on a server, reNgine-ng should be available at: https://$external_ip/" $COLOR_GREEN From 65eadcfcac67916dfd84cf074eb4129cbd166bc7 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Thu, 27 Jun 2024 10:56:06 +0200 Subject: [PATCH 21/25] fix(update-check): use reNgine-ng repo --- web/api/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/api/views.py b/web/api/views.py index 5aa77869..90b3facb 100644 --- a/web/api/views.py +++ b/web/api/views.py @@ -790,7 +790,7 @@ class RengineUpdateCheck(APIView): def get(self, request): req = self.request github_api = \ - 'https://api.github.com/repos/yogeshojha/rengine/releases' + 'https://api.github.com/repos/Security-Tools-Alliance/rengine-ng/releases' response = requests.get(github_api).json() if 'message' in response: return Response({'status': False, 'message': 'RateLimited'}) From ef162c62bbb28eef63574ade537aaef1c04703e1 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Thu, 27 Jun 2024 10:57:23 +0200 Subject: [PATCH 22/25] fix(banner): use reNgine-ng repo for issues --- web/scanEngine/forms.py | 2 +- web/templates/base/login.html | 2 +- web/templates/base/logout.html | 2 +- web/templates/report/template.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/scanEngine/forms.py b/web/scanEngine/forms.py index b4fb5455..cdf71a0f 100644 --- a/web/scanEngine/forms.py +++ b/web/scanEngine/forms.py @@ -568,7 +568,7 @@ def set_initial(self): self.initial['secondary_color'] = '#212121' self.initial['executive_summary_description'] = '''On **{scan_date}**, **{target_name}** engaged **{company_name}** to perform a security audit on their Web application. -**{company_name}** performed both Security Audit and Reconnaissance using automated tool reNgine. https://github.com/yogeshojha/rengine . +**{company_name}** performed both Security Audit and Reconnaissance using automated tool reNgine. https://github.com/Security-Tools-Alliance/rengine-ng/. ## Observations diff --git a/web/templates/base/login.html b/web/templates/base/login.html index 47ae02c0..535d663c 100644 --- a/web/templates/base/login.html +++ b/web/templates/base/login.html @@ -70,7 +70,7 @@

Login to reNgine

{{message}} {% endfor %} - If you have any issues or feature request, feel free to raise issue on Github. + If you have any issues or feature request, feel free to raise issue on Github.

{% endif %}
diff --git a/web/templates/base/logout.html b/web/templates/base/logout.html index f222a0a5..d067afd5 100644 --- a/web/templates/base/logout.html +++ b/web/templates/base/logout.html @@ -22,7 +22,7 @@
Thank you for using reNgine.

You have been successfully logged out!

-

For any issues or feature request, please feel free to raise issue on github

+

For any issues or feature request, please feel free to raise issue on github

diff --git a/web/templates/report/template.html b/web/templates/report/template.html index 9f353658..da556b81 100644 --- a/web/templates/report/template.html +++ b/web/templates/report/template.html @@ -442,7 +442,7 @@

{{report_name}} From c81f78ca4a2868588171e51f9fcae190c6c50e55 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Thu, 27 Jun 2024 11:00:15 +0200 Subject: [PATCH 23/25] build(version): bump to 2.0.6 --- web/art/reNgine.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/art/reNgine.txt b/web/art/reNgine.txt index 99971eea..6f0fa058 100644 --- a/web/art/reNgine.txt +++ b/web/art/reNgine.txt @@ -3,6 +3,6 @@ _ __ ___| \| | __ _ _ _ __ ___ | '__/ _ \ . ` |/ _` | | '_ \ / _ \ | | | __/ |\ | (_| | | | | | __/ - |_| \___|_| \_|\__, |_|_| |_|\___| v2.0.4-jasper + |_| \___|_| \_|\__, |_|_| |_|\___| v2.0.6 __/ | |___/ From 38c85ef443ad0cab1962194294062f2223f08196 Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Thu, 27 Jun 2024 12:38:46 +0200 Subject: [PATCH 24/25] build(install): dynamically print internal IPs --- install.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 4af88277..54fb31d5 100755 --- a/install.sh +++ b/install.sh @@ -13,8 +13,13 @@ COLOR_CYAN=6 COLOR_WHITE=7 COLOR_DEFAULT=$COLOR_WHITE # Use white as default for clarity -# Fetch the external IP address so that it can be printed later when the script has finished installing reNgine-ng +# Fetch the internal and external IP address so that it can be printed later when the script has finished installing reNgine-ng external_ip=$(curl -s https://ipecho.net/plain) +internal_ips=$(ip -4 -br addr | awk '$2 == "UP" {print $3} /^lo/ {print $3}') +formatted_ips="" +for ip in $internal_ips; do + formatted_ips="${formatted_ips}https://$ip\n" +done # Log messages in different colors log() { @@ -145,5 +150,5 @@ make username log "\r\nThank you for installing reNgine-ng, happy recon!" $COLOR_GREEN -log "\r\nIn case you're running this locally, reNgine-ng should be available at: https://127.0.0.1/" $COLOR_GREEN +log "\r\nIn case you're running this locally, reNgine-ng should be available at one of the following IPs:\n$formatted_ips" $COLOR_GREEN log "In case you're running this on a server, reNgine-ng should be available at: https://$external_ip/" $COLOR_GREEN From c5e305e42cbb4865afe9e44c411f4329356dc54c Mon Sep 17 00:00:00 2001 From: Anonymoussaurus <50231698+AnonymousWP@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:57:29 +0200 Subject: [PATCH 25/25] build(install): don't print subnetmask --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 54fb31d5..8136560e 100755 --- a/install.sh +++ b/install.sh @@ -15,7 +15,7 @@ COLOR_DEFAULT=$COLOR_WHITE # Use white as default for clarity # Fetch the internal and external IP address so that it can be printed later when the script has finished installing reNgine-ng external_ip=$(curl -s https://ipecho.net/plain) -internal_ips=$(ip -4 -br addr | awk '$2 == "UP" {print $3} /^lo/ {print $3}') +internal_ips=$(ip -4 -br addr | awk '$2 == "UP" {print $3} /^lo/ {print $3}' | cut -d'/' -f1) formatted_ips="" for ip in $internal_ips; do formatted_ips="${formatted_ips}https://$ip\n"