From b3ca61b3db88406b2ebc3017c86ab6cb110fd217 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Mon, 27 Jun 2022 15:03:06 +0100 Subject: [PATCH] BIN: Analyse Headers: improve warning if no lots file --- bin/.bin/webtest/analyse-headers | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/.bin/webtest/analyse-headers b/bin/.bin/webtest/analyse-headers index 07a59ae3..6160f865 100755 --- a/bin/.bin/webtest/analyse-headers +++ b/bin/.bin/webtest/analyse-headers @@ -388,6 +388,8 @@ attacks (XSS).\n\n" local reportURI=false local reportTO=false + [ -f "$lotsfile" ] || message+="WARNING: Lots file not available. Run with --fetch-lots in order to get it\n\n" + while read directive; do local directiveName="$(echo "$directive" | cut -d ' ' -f 1)" local directiveValue="$(echo "$directive" | cut -d ' ' -f 2-)" @@ -424,7 +426,7 @@ attacks" *) local domain="$(echo "$source" | sed -E 's/([^/]*:\/\/)?([^/]*).*/\2/')" lotsTags="$(lookup_lots "$domain")" - if [ -n "$lotsTags" ]; then + if [ $? -eq 0 ] && [ -n "$lotsTags" ]; then sourcemessage+="The LOTS project has marked ${ORANGE}${domain}${NC} with the tags: $lotsTags." fi if [ "$directiveName" == "script-src" ] && checkJsonp "$domain"; then