mirror of
https://github.com/mozilla/cipherscan.git
synced 2024-11-23 06:33:41 +01:00
sort reported TLS session ticket hint using natural sort
This commit is contained in:
parent
3bab715012
commit
144e6ea2f7
@ -14,6 +14,12 @@ import json
|
|||||||
import sys
|
import sys
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
|
def natural_sort(l):
|
||||||
|
convert = lambda text: int(text) if text.isdigit() else text.lower()
|
||||||
|
alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ]
|
||||||
|
return sorted(l, key = alphanum_key)
|
||||||
|
|
||||||
report_untrused=False
|
report_untrused=False
|
||||||
|
|
||||||
@ -340,7 +346,7 @@ for stat in sorted(pfsstats):
|
|||||||
|
|
||||||
print("\nTLS session ticket hint Count Percent ")
|
print("\nTLS session ticket hint Count Percent ")
|
||||||
print("-------------------------+---------+--------")
|
print("-------------------------+---------+--------")
|
||||||
for stat in sorted(tickethint):
|
for stat in natural_sort(tickethint):
|
||||||
percent = round(tickethint[stat] / total * 100, 4)
|
percent = round(tickethint[stat] / total * 100, 4)
|
||||||
sys.stdout.write(stat.ljust(25) + " " + str(tickethint[stat]).ljust(10) + str(percent).ljust(9) + "\n")
|
sys.stdout.write(stat.ljust(25) + " " + str(tickethint[stat]).ljust(10) + str(percent).ljust(9) + "\n")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user