From d81ee1c801bd70bdb6c6e515a45a6bb589a0a4a5 Mon Sep 17 00:00:00 2001 From: Richard Soderberg Date: Sat, 5 Sep 2015 01:06:09 -0700 Subject: [PATCH] Refuse to proceed if no HOST[:PORT] is provided after the options. Prior to this patch, if the user fails to provide a host:port after specifying cipherscan options, the script runs sed on an empty variable (failing with a syntax error) and then asttempts to cipherscan the target ':443'. This adds a simple test to ensure that a target was actually provided. --- cipherscan | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cipherscan b/cipherscan index 361f4fa..1553ed1 100755 --- a/cipherscan +++ b/cipherscan @@ -1350,6 +1350,11 @@ done # echo parameters left: $@ +if (( $# < 1 )); then + echo "The final argument must be a valid HOST[:PORT], but none was provided." 1>&2 + exit 1 +fi + TEMPTARGET=$(sed -e 's/^.* //'<<<"${@}") HOST=$(sed -e 's/:.*//'<<<"${TEMPTARGET}") PORT=$(sed -e 's/.*://'<<<"${TEMPTARGET}")