INNER CODE UNIT · Python
fng_statistics_top_groups
rfc-st/humble · humble.py:351
def fng_statistics_top_groups(fng_lines, fng_incl):
"""Count fingerprint headers per service, related to `-f` option."""
top_groups_pattern = re.compile(RE_PATTERN[3])
fng_top_groups = Counter(match.strip() for line in fng_lines for match in
top_groups_pattern.findall(line))
fng_statistics_top_result(fng_top_groups, fng_incl)
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):