BGP ASN Lookup with Python

不打扰是莪最后的温柔 提交于 2019-12-04 13:49:36

问题


Does anyone know of a Python module or a solution for how I could lookup company info (Name preferably) via the ASN (autonomous system number) number?

There are lots of IP to ASN tools but that is not what I require.

ASN needs to be the input - company name output.

This website has the sort of info I need: http://bgp.potaroo.net/cgi-bin/as-report?as=AS5607&view=2.0

Any ideas are appreciated!


回答1:


That information is available publicly on the CIDR-Report website.

This url has all the info you need and is updated daily. Big file, it might take a while to load : http://www.cidr-report.org/as2.0/autnums.html




回答2:


Try this, it's maybe what you need

from cymruwhois import Client
import ipresolved
domain='facebook.com'
ips=ipresolved.getipresolvedfromdomain(domain)
c=Client()
for i in ips.json()['resolutions']:
    ip=i['ip_address']
    print('ip : '+ip)
    r=c.lookup(ip)
    print('asn number: ',r.asn)
    print('asn owener : ',r.owner)
    print('==============')


来源:https://stackoverflow.com/questions/29476991/bgp-asn-lookup-with-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!