Пример #1
0
def create_default_ip_info_service() -> IpInfoService:
    as_repo = sas.create_default_as_repo()
    ip_asn = geoip2.database.Reader(
        resource_filename(
            "third_party/db-ip/dbip-asn-lite/dbip-asn-lite.mmdb"))
    ip_country = geoip2.database.Reader(
        resource_filename(
            "third_party/db-ip/dbip-country-lite/dbip-country-lite.mmdb"))
    return IpInfoService(as_repo, ip_asn, ip_country)
Пример #2
0
def create_default_ip_info_service() -> IpInfoService:
    as_repo = sas.create_default_as_repo()
    ip_asn = geoip2.database.Reader(
        resource_filename(
            "third_party/maxmind/GeoLite2-ASN/GeoLite2-ASN.mmdb"))
    ip_country = geoip2.database.Reader(
        resource_filename(
            "third_party/maxmind/GeoLite2-Country/GeoLite2-Country.mmdb"))
    return IpInfoService(as_repo, ip_asn, ip_country)
Пример #3
0
def create_default_as_repo() -> InMemoryAsRepository:
    as_repo = InMemoryAsRepository()

    as_info_filename = resource_filename(
        "third_party/caida.org/as-organizations/as-org2info.txt.gz")
    fill_as_info_from_filename(as_info_filename, as_repo)

    as_type_filename = resource_filename(
        "third_party/caida.org/as-classification/as2types.txt.gz")
    fill_as_type_from_filename(as_type_filename, as_repo)
    return as_repo
def create_default_ip_asn_map() -> IpToAsnMap:
    filename = resource_filename(
        "third_party/maxmind/GeoLite2-ASN_20171031/GeoLite2-ASN.mmdb")
    return GeoIp2IpToAsnMap(geoip2.database.Reader(filename))