INNER CODE UNIT · Python
fng_statistics_top_result
rfc-st/humble · humble.py:359
def fng_statistics_top_result(fng_top_groups, fng_incl):
"""Print the Top 20 services.
By total number of fingerprint headers, related to `-f` option.
"""
max_ln_len = max(len(content) for content, _ in
fng_top_groups.most_common(20))
print(f"{get_detail('[fng_top]', replace=True)} {fng_incl}\
{get_detail('[fng_top_2]', replace=True)}\n")
for content, count in fng_top_groups.most_common(20):
fng_global_pct = round(count / fng_incl * 100, 2)
fng_padding = " " * (max_ln_len - len(content))
print(f" [{content}]: {fng_padding}{fng_global_pct:.2f}% ({count})")
def fng_statistics_term(fng_term):
"""Count fingerprint headers per provided term.