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
master
Jonathan Hodgson 2 years ago
parent ec343a7fa8
commit 45a44e55ec
  1. 16
      bin/.bin/webtest/analyse-headers

@ -725,6 +725,7 @@ usage(){
-h, --help Display this help and exit -h, --help Display this help and exit
-k, --insecure Ignores certificate errors -k, --insecure Ignores certificate errors
--fetch-lots Updates domains from https://lots-project.com/ and exit --fetch-lots Updates domains from https://lots-project.com/ and exit
--nojoke Prevents script making windows joke
" "
} }
@ -767,12 +768,18 @@ unset options
insecure="" insecure=""
windowsjoke=false
if grep -q Microsoft /proc/version; then
windowsjoke=true
fi
# Read the options and set stuff # Read the options and set stuff
while [[ $1 = -?* ]]; do while [[ $1 = -?* ]]; do
case $1 in case $1 in
-h|--help) usage; exit;; -h|--help) usage; exit;;
-k|--insecure) insecure="-k" ;; -k|--insecure) insecure="-k" ;;
--fetch-lots ) fetchLots; exit ;; --fetch-lots ) fetchLots; exit ;;
--nojoke ) windowsjoke=false ;;
--) shift; break ;; --) shift; break ;;
*) die "invalid option: '$1'." ;; *) die "invalid option: '$1'." ;;
esac esac
@ -797,13 +804,17 @@ strict-transport-security
content-security-policy content-security-policy
x-xss-protection x-xss-protection
x-content-type-options x-content-type-options
feature-policy
permissions-policy permissions-policy
feature-policy
cache-control" cache-control"
tmpfile="$(mktemp)" tmpfile="$(mktemp)"
touch "$tmpfile" touch "$tmpfile"
if [ "$windowsjoke" == "true" ]; then
echo "Why would you use windows, do you hate yourself?"
fi
printKey printKey
echo "" echo ""
@ -830,8 +841,7 @@ while read -r line; do
fi fi
done<<<"$(echo "$headers" | sed '1d')" # We don't want the initial http banner done<<<"$(echo "$headers" | sed '1d')" # We don't want the initial http banner
echo "$missingHeaders" | while read -r line; do
echo -n "$missingHeaders" | while read -r line; do
echo -e "${RED}$line${NC}" echo -e "${RED}$line${NC}"
functionName="test_$line" functionName="test_$line"
"$functionName" >> "$tmpfile" "$functionName" >> "$tmpfile"

Loading…
Cancel
Save