dspruell / aslookup Goto Github PK
View Code? Open in Web Editor NEWPython client for IP to ASN lookup services
License: ISC License
Python client for IP to ASN lookup services
License: ISC License
Python 3.10.6
aslookup 1.4.0
Sample IP address (185.252.179.18) causes cymru parser to choke:
$ as-lookup -s cymru -r -v 185.252.179.18
[DEBUG] raw DNS record response: "46308 | 185.252.179.0/24 | BG | ripencc | 2018-03-28"
[DEBUG] raw DNS record response: "46308 | US | arin | 2023-04-05 |"
Traceback (most recent call last):
File "/home/dspruell/.local/bin/as-lookup", line 8, in <module>
sys.exit(main())
File "/home/dspruell/.local/pipx/venvs/aslookup/lib/python3.10/site-packages/aslookup/cli.py", line 105, in main
data = get_as_data(addr, service=args.service)
File "/home/dspruell/.local/pipx/venvs/aslookup/lib/python3.10/site-packages/aslookup/lookup.py", line 237, in get_as_data
asdata = get_cymru_data(asdata_text, extra=extra_data)
File "/home/dspruell/.local/pipx/venvs/aslookup/lib/python3.10/site-packages/aslookup/lookup.py", line 115, in get_cymru_data
as_name=fields[4],
IndexError: list index out of range
Seen from shadowserver parser:
$ as-lookup -s shadowserver -r -v 185.252.179.18
[DEBUG] raw DNS record response: "46308 | 185.252.179.0/24 | | US | "
[WARNING] no value for AS name; overriding with ISP
ASData(handle='AS46308', asn='46308', as_name='', rir=None, reg_date=None, prefix='185.252.179.0/24', cc='US', domain=None, isp='', data_source='shadowserver')
Enable the module to return a formatted text representation of output as currently implemented in the CLI, but as an output format from the API.
It looks like get_as_data
was deprecated in the current version from version 1.3.0
. Please include a handler to allow for prior compatibility.
Sometimes, lookups of IP addresses using Team Cymru's service results in an error; examples:
% as-lookup 37.128.207.56 45.84.0.83
37.128.207.56 AS42532 | LV | VEESP-LV-AS
45.84.0.83 Error in lookup from service cymru for IP 45.84.0.83 (origin_data response: v=spf1 mx -all)
% as-lookup 45.58.52.67 216.189.159.197 37.128.207.56
45.58.52.67 AS7489 | HK | HOSTUS-GLOBAL-AS HostUS
216.189.159.197 AS7489 | HK | HOSTUS-GLOBAL-AS HostUS
37.128.207.56 Error in lookup from service cymru for IP 37.128.207.56 (origin_data response: v=spf1 mx -all)
There appears to be inconsistency to the behavior; as noted above, two lookups involving the IP 37.128.207.56 were inconsistent, returning IP-BGP data the first time but resulting in the error the second time.
To further complicate things, sometimes after messing around with resolutions against caching resolvers manually, something changes and IP-BGP data resolves cleanly:
% as-lookup -s cymru 37.128.207.56
37.128.207.56 AS42532 | LV | VEESP-LV-AS
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.