ASN support #495
Labels
Priority: Low
This issue can probably be picked up by anyone looking to contribute to the project, as an entry fix
Status: Completed
Nothing further to be done with this issue. Awaiting to be closed.
Type: Enhancement
Most issues will probably ask for additions or changes.
Add function Whois from files IPASN.DAT, asn.json like
pyasn : https://github.com/hadiasghari/pyasn/
Example for python:
pyasn_util_asnames.py > asn.json; pyasn_util_download.py -4; rib=$(ls -t rib.*.bz2 | head -1); pyasn_util_convert.py --single $rib IPASN.DAT; rm -f $rib
import pyasn
asndb = pyasn.pyasn('IPASN.DAT',as_names_file='asn.json')
#whois
asn,cidr = asndb.lookup(ipaddrr)
asn_name = asndb.get_as_name(asn)
Who = f"{cidr} AS{asn} {asn_name}"
print(Who)
ip google for example:
[142.250.187.206 142.250.0.0/15 AS15169 GOOGLE, US]
The text was updated successfully, but these errors were encountered: