2021-05-31 09:27:37 +02:00
|
|
|
#!/usr/bin/env bash
|
2019-04-18 10:06:01 +02:00
|
|
|
|
|
|
|
hs="$1"
|
|
|
|
len=${#hs}
|
|
|
|
echo "# ciphers: $((len/4))"
|
|
|
|
|
|
|
|
mapfile="etc/cipher-mapping.txt"
|
|
|
|
[ -s $mapfile ] || mapfile="../$mapfile"
|
|
|
|
[ -s $mapfile ] || exit 255
|
|
|
|
|
|
|
|
cip=""
|
|
|
|
first=true
|
|
|
|
|
|
|
|
for ((i=0; i<len ; i+=4)); do
|
|
|
|
printf "%02d" "$i"
|
|
|
|
echo -n ": ${hs:$i:4}"
|
|
|
|
grepstr="0x${hs:$i:2},0x${hs:$((i+2)):2}"
|
|
|
|
echo -n " --> $grepstr --> "
|
2019-05-06 19:35:12 +02:00
|
|
|
cip=$(grep -i -E "^ *${grepstr}" $mapfile | awk '{ print $3 }')
|
2020-01-14 17:38:02 +01:00
|
|
|
if [[ $grepstr == 0x00,0xff ]]; then
|
|
|
|
echo TLS_EMPTY_RENEGOTIATION_INFO_SCSV
|
|
|
|
else
|
|
|
|
echo $cip
|
|
|
|
fi
|
2019-04-18 10:06:01 +02:00
|
|
|
if "$first"; then
|
|
|
|
ciphers="$cip"
|
|
|
|
first=false
|
|
|
|
else
|
|
|
|
ciphers="$ciphers:$cip"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo
|
2020-01-22 10:52:07 +01:00
|
|
|
# remove leading : because of GREASE, and trailing because of TLS_EMPTY_RENEGOTIATION_INFO_SCSV
|
|
|
|
ciphers="${ciphers%:}"
|
|
|
|
echo ${ciphers#:}
|
2021-05-31 22:39:22 +02:00
|
|
|
|
|
|
|
# vim:ts=5:sw=5:expandtab
|