# #
# libloc - A library to determine the location of someone on the Internet #
# #
-# Copyright (C) 2017 IPFire Development Team <info@ipfire.org> #
+# Copyright (C) 2017-2021 IPFire Development Team <info@ipfire.org> #
# #
# This library is free software; you can redistribute it and/or #
# modify it under the terms of the GNU Lesser General Public #
list_networks_by_flags.add_argument("--anycast",
action="store_true", help=_("Anycasts"),
)
+ list_networks_by_flags.add_argument("--drop",
+ action="store_true", help=_("Hostile Networks safe to drop"),
+ )
list_networks_by_flags.add_argument("--family", choices=("ipv6", "ipv4"))
list_networks_by_flags.add_argument("--format",
choices=location.export.formats.keys(), default="list")
_("Anycast"), _("yes"),
))
+ # Hostile Network
+ if network.has_flag(location.NETWORK_FLAG_DROP):
+ print(format % (
+ _("Hostile Network safe to drop"), _("yes"),
+ ))
+
return ret
def handle_dump(self, db, ns):
location.NETWORK_FLAG_ANONYMOUS_PROXY : "is-anonymous-proxy:",
location.NETWORK_FLAG_SATELLITE_PROVIDER : "is-satellite-provider:",
location.NETWORK_FLAG_ANYCAST : "is-anycast:",
+ location.NETWORK_FLAG_DROP : "drop:",
}
# Iterate over all networks
if ns.anycast:
flags |= location.NETWORK_FLAG_ANYCAST
+ if ns.drop:
+ flags |= location.NETWORK_FLAG_DROP
+
if not flags:
raise ValueError(_("You must at least pass one flag"))
asns.append(object)
elif location.country_code_is_valid(object) \
- or object in ("A1", "A2", "A3"):
+ or object in ("A1", "A2", "A3", "XD"):
countries.append(object)
else:
# Default to exporting all countries
if not countries and not asns:
- countries = ["A1", "A2", "A3"] + [country.code for country in db.countries]
+ countries = ["A1", "A2", "A3", "XD"] + [country.code for country in db.countries]
# Select the output format
writer = self.__get_output_formatter(ns)