2
0
mirror of https://github.com/mozilla/cipherscan.git synced 2024-12-26 04:33:42 +01:00

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

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