Norwegian Honeynet Project


A chapter of the Honeynet Project

Country Lookup

June 19th, 2009 by Tor Inge Skaar (9) News,Tools

flags.globeWe’re pleased to announce a new service; CC2ASN – Country Lookup. This service will provide you with AS-numbers, IPv4 and IPv6 prefixes belonging to a specific country. The data is all based on publicly available information from the five RIRs in the world; ARIN, RIPE NCC, APNIC, LACNIC and AfriNIC. The database is updated once every day.

As input to this service, use ISO-3166-1 alpha-2 country codes (more info). Note that in addition to the ISO defined codes, the following two codes are also used when dealing with multi-regional networks; AP (asia-pacific) and EU (european union).

You may access the data either through the web-interface, or via your command line interface. A standard whois client can be used when the result set is “not too large”. The preferred way is to use a raw socket tool, like netcat. Here are some examples illustrating both ways:

whois -h atari.honeynor.no no
whois -h atari.honeynor.no ipv4 ke
echo "all us" | nc atari.honeynor.no 43

The first will list all AS-numbers registered for Norway, while the second example will list all IPv4 prefixes for Kenya. The last line uses netcat to fetch everything (ASN, IPv4 and IPv6) registered for USA (this query will fail when using a standard whois client).

For more information, please read the documentation (There are some caveats to be aware of, and more alternatives to download this data. It’s all in the docs).

9 Responses to “Country Lookup”

  1. Mmmm Says:

    Is there a possibility to search for AS number with a return of ipv6 and ipv6 numbers for that specific AS number?

  2. Tor Inge Skaar Says:

    No, this is not within the scope of this service. I’m not aware of any publicly accessible “ASN2IPv6″ services.

  3. Mmmm Says:

    But do you know of any ASN2IPv4 services then?

  4. Tor Inge Skaar Says:

    Sure. Robtex provides a web-based tool: http://www.robtex.com/as/as21000.html#bgp. Another one is located at https://www.dan.me.uk/bgplookup?asn=21000. (AS21000 was simply used as an example here).

  5. Mmmm Says:

    Thnx, see you in November. ;-)

  6. Daniel Austin MBCS Says:

    I will see if I can obtain some IPv6 BGP feeds, and modify my bgplookup tool to include IPv6 too.

    Give me a couple of weeks :-)

  7. Daniel Austin MBCS Says:

    Ok, my BGP lookup tool now lists both IPv4 and IPv6 prefixes.

    There’s no way to ask for a specific type right now, but it’s simple… if you only want IPv6 prefixes, only select items that contain “:” – if you only want IPv4 prefixes, only select items that contain “.” :-)

    Enjoy.

  8. Tor Inge Skaar Says:

    Daniel, very nice!

  9. Norwegian Honeynet Project » Blog Archive » Enhanced CC2ASN Says:

    [...] over 9 months we’ve run our CC2ASN service, allowing you to lookup up ISO-3166 country codes and get back [...]

Leave a Reply