简体   繁体   中英

Get AS ID from IP Address

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM