mirror of
https://github.com/mozilla/cipherscan.git
synced 2024-11-22 06:13:42 +01:00
Merge pull request #97 from tomato42/uri-handling
handle hostnames that are URIs
This commit is contained in:
commit
035d8c0a19
10
cipherscan
10
cipherscan
@ -1916,10 +1916,18 @@ unset PARAMS[-1]
|
|||||||
# Refuse to proceed if the hostname starts with a hyphen, since hostnames can't
|
# Refuse to proceed if the hostname starts with a hyphen, since hostnames can't
|
||||||
# begin with a hyphen and this likely means we accidentally parsed an option as
|
# begin with a hyphen and this likely means we accidentally parsed an option as
|
||||||
# a hostname.
|
# a hostname.
|
||||||
if [[ -z $TARGET || $TARGET =~ ^[-:] || $TARGET =~ :.*[^0-9] ]]; then
|
if [[ -z $TARGET || $TARGET =~ ^[-:] ]]; then
|
||||||
echo "The final argument '$TARGET' is not a valid HOST[:PORT]." 1>&2
|
echo "The final argument '$TARGET' is not a valid HOST[:PORT]." 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
# Handle Targets that are URIs
|
||||||
|
if [[ $TARGET =~ /([^/]+)(/|$) ]]; then
|
||||||
|
TARGET="${BASH_REMATCH[1]}"
|
||||||
|
fi
|
||||||
|
if [[ $TARGET =~ :.*[^0-9] ]]; then
|
||||||
|
echo "Final argument is not a valid HOST[:PORT]" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
if ! [[ $TARGET =~ : ]]; then
|
if ! [[ $TARGET =~ : ]]; then
|
||||||
sni_target=$TARGET
|
sni_target=$TARGET
|
||||||
TARGET="${TARGET}:443"
|
TARGET="${TARGET}:443"
|
||||||
|
Loading…
Reference in New Issue
Block a user