1

I'm trying to get the AS ID for each IP address I get back from a traceroute output. What's the best way to do this? The only command I know right now is 'whois ip_addr' but that returns too much information, and is very difficult to parse (since I'm doing this all in a command line script).

I know there are many websites which give back the AS that an IP Address belongs to, but since I need this in a script, using the websites does not seem feasible.

yolo_coder
  • 11
  • 2
  • What do you mean by "the AS ID" for an IP address? The websites you are talking about do various different things and it's not clear what information you're asking for. If you mean the AS that is originating the most specific route that includes that IP, you have to be referring to some particular place because there's no "one true routing table" for the Internet to look at. Do you mean the AS authorized to send a route in some particular authority database? If so, which one? – David Schwartz Oct 24 '15 at 00:24

1 Answers1

0

RIRs provide various API to get back data about IP blocks. whois is the historical one. Some provided REST interfaces on top of it. But now you also have RDAP that gives you back JSON formatted content.

See for example:

Some interfaces do also allow you to specify what data you really want back.

Patrick Mevzek
  • 10,995
  • 16
  • 38
  • 54