From 4b591b64028b88d3454342636e20c12a044105e0 Mon Sep 17 00:00:00 2001 From: Yimura <24669514+Yimura@users.noreply.github.com> Date: Thu, 15 Feb 2024 21:16:33 +0100 Subject: [PATCH] fix(wordlist): crash if ADD_WORDLIST_N_RULES build arg isn't set to true --- wordlists/Dockerfile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/wordlists/Dockerfile b/wordlists/Dockerfile index cd04430..9ea8650 100644 --- a/wordlists/Dockerfile +++ b/wordlists/Dockerfile @@ -5,15 +5,19 @@ ARG ADD_WORDLIST_N_RULES=false USER root WORKDIR /opt/wordlists -RUN [[ "$ADD_WORDLIST_N_RULES" == "true" ]] && git clone https://github.com/danielmiessler/SecLists.git --depth 1 +RUN [[ "$ADD_WORDLIST_N_RULES" == "true" ]] && git clone https://github.com/danielmiessler/SecLists.git --depth 1 ||\ + echo "Skip pulling SecLists, ADD_WORDLIST_N_RULES build arg is not set to true" WORKDIR /opt/rules -RUN [[ "$ADD_WORDLIST_N_RULES" == "true" ]] && git clone https://github.com/NotSoSecure/password_cracking_rules.git --depth=1 +RUN [[ "$ADD_WORDLIST_N_RULES" == "true" ]] && git clone https://github.com/NotSoSecure/password_cracking_rules.git --depth=1 ||\ + echo "Skip pulling password_cracking_rules, ADD_WORDLIST_N_RULES build arg is not set to true" WORKDIR /opt/wordlists -RUN find . -type f -iname '*.tar.gz' -exec tar -xf {} \; -exec rm -f {} \; &&\ - find ./SecLists -maxdepth 1 -type d ! -path './SecLists/Passwords' ! -path './SecLists' -exec rm -rf {} \; +RUN [[ "$ADD_WORDLIST_N_RULES" == "true" ]] && find . -type f -iname '*.tar.gz' -exec tar -xf {} \; -exec rm -f {} \; &&\ + find ./SecLists -maxdepth 1 -type d ! -path './SecLists/Passwords' ! -path './SecLists' -exec rm -rf {} \; ||\ + echo "SecLists was not pulled, skipping optimisation step." WORKDIR /opt/rules -RUN find . -iname '*.rule' -exec mv {} . \; &&\ - find . -maxdepth 1 -type d ! -path '.' -exec rm -rf {} \; +RUN [[ "$ADD_WORDLIST_N_RULES" == "true" ]] && find . -iname '*.rule' -exec mv {} . \; &&\ + find . -maxdepth 1 -type d ! -path '.' -exec rm -rf {} \; ||\ + echo "password_cracking_rules was not pulled, skipping optimisation step."