Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BGP ASN Lookup with Python

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!

like image 630
gamarga Avatar asked Sep 26 '26 21:09

gamarga


2 Answers

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('==============')
like image 63
Al Pha Avatar answered Sep 30 '26 15:09

Al Pha


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

like image 38
A-y Avatar answered Sep 30 '26 16:09

A-y



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!