2
0
mirror of https://github.com/mozilla/cipherscan.git synced 2026-02-06 07:05:15 +01:00

add support for collecting supported NPN protocols

This commit is contained in:
Hubert Kario
2016-09-16 23:06:34 +02:00
parent 74dd82e8ad
commit 6a906a6267
2 changed files with 47 additions and 13 deletions

View File

@@ -111,6 +111,7 @@ tickethint = defaultdict(int)
eccfallback = defaultdict(int)
eccordering = defaultdict(int)
ecccurve = defaultdict(int)
npn = defaultdict(int)
ocspstaple = defaultdict(int)
fallbacks = defaultdict(int)
# array with indexes of fallback names for the matrix report
@@ -174,6 +175,7 @@ for r,d,flist in os.walk(path):
tempeccfallback = "unknown"
tempeccordering = "unknown"
tempecccurve = {}
tempnpn = {}
tempfallbacks = {}
""" supported ciphers by the server under scan """
tempcipherstats = {}
@@ -500,6 +502,13 @@ for r,d,flist in os.walk(path):
elif protocol == 'TLSv1.2':
TLS1_2 = True
# save NPN protocols supported
if 'npn' in entry:
for proto in entry['npn']:
tempnpn[proto] = 1
if len(entry['npn']) == 1:
tempnpn[proto + ' Only'] = 1
""" save ECC curves stats """
if 'curves_ordering' in entry:
tempeccordering = entry['curves_ordering']
@@ -593,6 +602,9 @@ for r,d,flist in os.walk(path):
for s in tempecccurve:
ecccurve[s] += 1
for s in tempnpn:
npn[s] += 1
if ocsp_stapling is None:
ocspstaple['Unknown'] += 1
elif ocsp_stapling:
@@ -796,6 +808,12 @@ for stat in sorted(handshakestats):
percent = round(handshakestats[stat] / total * 100, 4)
sys.stdout.write(stat.ljust(25) + " " + str(handshakestats[stat]).ljust(10) + str(percent).ljust(4) + "\n")
print("\nSupported NPN protocols Count Percent ")
print("-------------------------+---------+--------")
for name, val in sorted(npn.items()):
percent = round(val / total * 100, 4)
sys.stdout.write(name.ljust(25) + " " + str(val).ljust(10) + str(percent).ljust(9) + "\n")
print("\nSupported PFS Count Percent PFS Percent")
print("-------------------------+---------+--------+-----------")
for stat in sorted(pfsstats):