mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-09-08 04:52:53 +02:00
Changed parameter to --reqheader for custom HTTP headers.
This commit is contained in:
22
testssl.sh
22
testssl.sh
@ -162,7 +162,7 @@ QUIET=${QUIET:-false} # don't output the banner. By doing this
|
||||
SSL_NATIVE=${SSL_NATIVE:-false} # we do per default bash sockets where possible "true": switch back to "openssl native"
|
||||
ASSUME_HTTP=${ASSUME_HTTP:-false} # in seldom cases (WAF, old servers, grumpy SSL) service detection fails. "True" enforces HTTP checks
|
||||
BASICAUTH=${BASICAUTH:-""} # HTTP basic auth credentials can be set here like user:pass
|
||||
CUSTOMHTTPHEADER=${CUSTOMHTTPHEADER:-""} # HTTP custom request header can be set here like Header: content. Can be used multiple times.
|
||||
REQHEADER=${REQHEADER:-""} # HTTP custom request header can be set here like Header: content. Can be used multiple times.
|
||||
BUGS=${BUGS:-""} # -bugs option from openssl, needed for some BIG IP F5
|
||||
WARNINGS=${WARNINGS:-""} # can be either off or batch
|
||||
DEBUG=${DEBUG:-0} # 1: normal output the files in /tmp/ are kept for further debugging purposes
|
||||
@ -374,7 +374,7 @@ TLS_NOW="" # Similar
|
||||
TLS_DIFFTIME_SET=false # Tells TLS functions to measure the TLS difftime or not
|
||||
NOW_TIME=""
|
||||
HTTP_TIME=""
|
||||
CUSTOMHTTPHEADERS=()
|
||||
REQHEADERS=()
|
||||
GET_REQ11=""
|
||||
START_TIME=0 # time in epoch when the action started
|
||||
END_TIME=0 # .. ended
|
||||
@ -19250,7 +19250,7 @@ tuning / connect options (most also can be preset via environment variables):
|
||||
--phone-out allow to contact external servers for CRL download and querying OCSP responder
|
||||
--add-ca <CA files|CA dir> path to <CAdir> with *.pem or a comma separated list of CA files to include in trust check
|
||||
--basicauth <user:pass> provide HTTP basic auth information.
|
||||
--customhttpheader <header> add custom http request headers
|
||||
--reqheader <header> add custom http request headers
|
||||
|
||||
output options (can also be preset via environment variables):
|
||||
--quiet don't output the banner. By doing this you acknowledge usage terms normally appearing in the banner
|
||||
@ -19403,7 +19403,7 @@ SHOW_EACH_C: $SHOW_EACH_C
|
||||
SSL_NATIVE: $SSL_NATIVE
|
||||
ASSUME_HTTP $ASSUME_HTTP
|
||||
BASICAUTH: $BASICAUTH
|
||||
CUSTOMHTTPHEADER: $CUSTOMHTTPHEADER
|
||||
REQHEADER: $REQHEADER
|
||||
SNEAKY: $SNEAKY
|
||||
OFFENSIVE: $OFFENSIVE
|
||||
PHONE_OUT: $PHONE_OUT
|
||||
@ -20527,7 +20527,7 @@ determine_service() {
|
||||
local ua
|
||||
local protocol
|
||||
local basicauth_header=""
|
||||
local customhttpheader=""
|
||||
local reqheader=""
|
||||
|
||||
# Check if we can connect to $NODEIP:$PORT. Attention: This ALWAYS uses sockets. Thus timeouts for --ssl-=native do not apply
|
||||
if ! fd_socket 5; then
|
||||
@ -20555,10 +20555,10 @@ determine_service() {
|
||||
if [[ -n "$BASICAUTH" ]]; then
|
||||
basicauth_header="Authorization: Basic $(safe_echo "$BASICAUTH" | $OPENSSL base64 2>/dev/null)\r\n"
|
||||
fi
|
||||
if [[ -n "$CUSTOMHTTPHEADERS" ]]; then
|
||||
customhttpheader="$(join_by "\r\n" "${CUSTOMHTTPHEADERS[@]}")\r\n" #Add all required custom http headers to one string with newlines
|
||||
if [[ -n "$REQHEADERS" ]]; then
|
||||
reqheader="$(join_by "\r\n" "${REQHEADERS[@]}")\r\n" #Add all required custom http headers to one string with newlines
|
||||
fi
|
||||
GET_REQ11="GET $URL_PATH HTTP/1.1\r\nHost: $NODE\r\nUser-Agent: $ua\r\n${basicauth_header}${customhttpheader}Accept-Encoding: identity\r\nAccept: text/*\r\nConnection: Close\r\n\r\n"
|
||||
GET_REQ11="GET $URL_PATH HTTP/1.1\r\nHost: $NODE\r\nUser-Agent: $ua\r\n${basicauth_header}${reqheader}Accept-Encoding: identity\r\nAccept: text/*\r\nConnection: Close\r\n\r\n"
|
||||
# returns always 0:
|
||||
service_detection $OPTIMAL_PROTO
|
||||
else # STARTTLS
|
||||
@ -22210,10 +22210,10 @@ parse_cmd_line() {
|
||||
BASICAUTH="$(parse_opt_equal_sign "$1" "$2")"
|
||||
[[ $? -eq 0 ]] && shift
|
||||
;;
|
||||
--customhttpheader|--customhttpheader=*)
|
||||
CUSTOMHTTPHEADER="$(parse_opt_equal_sign "$1" "$2")"
|
||||
--reqheader|--reqheader=*)
|
||||
REQHEADER="$(parse_opt_equal_sign "$1" "$2")"
|
||||
[[ $? -eq 0 ]] && shift
|
||||
CUSTOMHTTPHEADERS+=("$CUSTOMHTTPHEADER")
|
||||
REQHEADERS+=("$REQHEADER")
|
||||
;;
|
||||
(--) shift
|
||||
break
|
||||
|
Reference in New Issue
Block a user