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.
This commit is contained in:
Richard Soderberg 2015-09-05 01:06:09 -07:00
parent 28555b03f0
commit d81ee1c801
1 changed files with 5 additions and 0 deletions

View File

@ -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}")