mirror of
https://github.com/mozilla/cipherscan.git
synced 2024-11-04 15:03:41 +01:00
Merge pull request #125 from tomato42/sort-cas-by-usage
sort CA's by count, not name
This commit is contained in:
commit
e5b747d29b
@ -19,6 +19,7 @@ import sys
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
import os
|
import os
|
||||||
from OpenSSL import crypto
|
from OpenSSL import crypto
|
||||||
|
from operator import itemgetter
|
||||||
|
|
||||||
invocations = defaultdict(int)
|
invocations = defaultdict(int)
|
||||||
|
|
||||||
@ -321,12 +322,12 @@ for stat in sorted(effective_security):
|
|||||||
|
|
||||||
print("\nRoot CAs Count Percent")
|
print("\nRoot CAs Count Percent")
|
||||||
print("---------------------------------------------+---------+-------")
|
print("---------------------------------------------+---------+-------")
|
||||||
for stat in sorted(root_CA):
|
for stat, val in sorted(root_CA.items(), key=itemgetter(1), reverse=True):
|
||||||
percent = round(root_CA[stat] / total * 100, 4)
|
percent = round(val / total * 100, 4)
|
||||||
sys.stdout.write(stat.ljust(45)[0:45] + " " + str(root_CA[stat]).ljust(10) + str(percent).ljust(4) + "\n")
|
sys.stdout.write(stat.ljust(45)[0:45] + " " + str(val).ljust(10) + str(percent).ljust(4) + "\n")
|
||||||
|
|
||||||
print("\nIntermediate CA Count Percent")
|
print("\nIntermediate CA Count Percent")
|
||||||
print("---------------------------------------------+---------+-------")
|
print("---------------------------------------------+---------+-------")
|
||||||
for stat in sorted(intermediate_CA):
|
for stat, val in sorted(intermediate_CA.items(), key=itemgetter(1), reverse=True):
|
||||||
percent = round(intermediate_CA[stat] / total * 100, 4)
|
percent = round(val / total * 100, 4)
|
||||||
sys.stdout.write(stat.ljust(45)[0:45] + " " + str(intermediate_CA[stat]).ljust(10) + str(percent).ljust(4) + "\n")
|
sys.stdout.write(stat.ljust(45)[0:45] + " " + str(val).ljust(10) + str(percent).ljust(4) + "\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user