diff --git a/dnas/dnas/report.py b/dnas/dnas/report.py index 61e5dfb..47a3cad 100644 --- a/dnas/dnas/report.py +++ b/dnas/dnas/report.py @@ -473,6 +473,33 @@ def gen_txt_report(mrt_s: "mrt_stats", body: bool = True) -> list[str]: txt_report.append(text) + if mrt_s.most_unreg_origins: + text = ( + f"Prefixes with most unregistered origin ASNs per prefix: " + f"{len(mrt_s.most_unreg_origins)} prefix(es) had " + f"{len(mrt_s.most_unreg_origins[0].origin_asns)} bogon origin ASNs.\n" + ) + + txt_report.append(text) + + if body: + text = "" + for mrt_e in mrt_s.most_unreg_origins: + text += f"Prefix {mrt_e.prefix} from origin ASN(s)" + for asn in mrt_e.origin_asns: + if asn not in whois_cache: + whois_cache[asn] = whois.as_lookup(int(asn)) + as_name = whois_cache[asn] + if as_name: + text += f" AS{asn} ({as_name})" + else: + text += f" AS{asn}" + text += "\n" + text = text[0:-1] + text += "\n\n" + + txt_report.append(text) + return txt_report @staticmethod