Skip to content

Commit 888fae3

Browse files
committed
define vars, add comments
1 parent df165bb commit 888fae3

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

testssl.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,7 +1792,7 @@ filter_input() {
17921792
# Currently it is being used by check_revocation_crl() only.
17931793
#
17941794
http_get() {
1795-
local proto z
1795+
local proto="" foo=""
17961796
local node="" query=""
17971797
local dl="$2"
17981798
local useragent="$UA_STD"
@@ -1845,7 +1845,7 @@ http_get() {
18451845
printf -- "%b" "GET $proto://$node/$query HTTP/1.0\r\nUser-Agent: $useragent\r\nHost: $node\r\nAccept: */*\r\n\r\n" >&33
18461846
fi
18471847
else
1848-
IFS=/ read -r proto z node query <<< "$1"
1848+
IFS=/ read -r proto foo node query <<< "$1"
18491849
exec 33<>/dev/tcp/$node/80
18501850
printf -- "%b" "GET /$query HTTP/1.0\r\nUser-Agent: $useragent\r\nHost: $node\r\nAccept: */*\r\n\r\n" >&33
18511851
fi
@@ -1920,21 +1920,22 @@ http_get_header() {
19201920
# arg1: URL
19211921
# arg2: extra http header
19221922
#
1923+
# return codes:
1924+
# 0: all fine
1925+
# 1: got stuck within HEADER_MAXSLEEP
1926+
# 3: got stuck within HEADER_MAXSLEEP and PROXY was defined
1927+
#
19231928
http_header_printf() {
19241929
local request_header="$2"
19251930
local useragent="$UA_STD"
19261931
local tmpfile=$TEMPDIR/$NODE.$NODEIP.http_header_printf.log
19271932
local errfile=$TEMPDIR/$NODE.$NODEIP.http_header_printf-err.log
1928-
local - ret=0
1933+
local -i ret=0
1934+
local proto="" foo="" node="" query=""
19291935

19301936
[[ $DEBUG -eq 0 ]] && errfile=/dev/null
19311937

19321938
IFS=/ read -r proto foo node query <<< "$1"
1933-
echo $proto
1934-
echo $foo
1935-
echo $node
1936-
echo $query
1937-
19381939
exec 33<>/dev/tcp/$node/80
19391940
printf -- "%b" "HEAD ${proto}//${node}/${query} HTTP/1.1\r\nUser-Agent: ${useragent}\r\nHost: ${node}\r\n${request_header}\r\nAccept: */*\r\n\r\n\r\n" >&33 2>$errfile &
19401941
wait_kill $! $HEADER_MAXSLEEP
@@ -17683,7 +17684,6 @@ run_opossum() {
1768317684
local jsonID="opossum"
1768417685
local cwe="CWE-74"
1768517686
local -i ret=0
17686-
# we need to talk http here!
1768717687
local uri=$URI
1768817688
local service="$SERVICE"
1768917689

@@ -17700,9 +17700,10 @@ run_opossum() {
1770017700
HTTP)
1770117701
uri=${URI/https:\/\//}
1770217702
response=$(http_header_printf http://${uri} 'Upgrade: TLS/1.0\r\n\r\nClose\r\n')
17703+
# In any case we use $response but we handle the return codes
1770317704
case $? in
1770417705
0) ret=0 ;;
17705-
*) ret=7 ;;
17706+
1|3) ret=7 ;; # got stuck
1770617707
esac
1770717708
if [[ $response =~ Upgrade:\ TLS ]]; then
1770817709
prln_svrty_critical "VULNERABLE (NOT ok)"

0 commit comments

Comments
 (0)