From 45a44e55ecd38c47287c257d9abe4ad2fa08e27e Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Wed, 6 Jul 2022 17:01:04 +0100 Subject: [PATCH] Bin: Analyse-headers: Add windows joke Requested "feature" by Scot, add a joke if used in WSL. Can be hidden with --nojoke in case you need profesionalism --- bin/.bin/webtest/analyse-headers | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/bin/.bin/webtest/analyse-headers b/bin/.bin/webtest/analyse-headers index 2ab9c632..0cc842b6 100755 --- a/bin/.bin/webtest/analyse-headers +++ b/bin/.bin/webtest/analyse-headers @@ -725,6 +725,7 @@ usage(){ -h, --help Display this help and exit -k, --insecure Ignores certificate errors --fetch-lots Updates domains from https://lots-project.com/ and exit + --nojoke Prevents script making windows joke " } @@ -767,12 +768,18 @@ unset options insecure="" +windowsjoke=false +if grep -q Microsoft /proc/version; then + windowsjoke=true +fi + # Read the options and set stuff while [[ $1 = -?* ]]; do case $1 in -h|--help) usage; exit;; -k|--insecure) insecure="-k" ;; --fetch-lots ) fetchLots; exit ;; + --nojoke ) windowsjoke=false ;; --) shift; break ;; *) die "invalid option: '$1'." ;; esac @@ -797,13 +804,17 @@ strict-transport-security content-security-policy x-xss-protection x-content-type-options -feature-policy permissions-policy +feature-policy cache-control" tmpfile="$(mktemp)" touch "$tmpfile" +if [ "$windowsjoke" == "true" ]; then + echo "Why would you use windows, do you hate yourself?" +fi + printKey echo "" @@ -830,8 +841,7 @@ while read -r line; do fi done<<<"$(echo "$headers" | sed '1d')" # We don't want the initial http banner - -echo -n "$missingHeaders" | while read -r line; do +echo "$missingHeaders" | while read -r line; do echo -e "${RED}$line${NC}" functionName="test_$line" "$functionName" >> "$tmpfile"