Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JackSlateur/perl-ip2as
IP to ASN mapping
https://github.com/JackSlateur/perl-ip2as
Last synced: about 2 months ago
JSON representation
IP to ASN mapping
- Host: GitHub
- URL: https://github.com/JackSlateur/perl-ip2as
- Owner: JackSlateur
- License: gpl-2.0
- Created: 2017-03-10T13:06:13.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-04-26T10:29:29.000Z (9 months ago)
- Last Synced: 2024-08-08T18:25:09.055Z (5 months ago)
- Language: Perl
- Size: 14.6 MB
- Stars: 10
- Watchers: 2
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - JackSlateur/perl-ip2as - IP to ASN mapping (others)
README
What is ip2as
===ip2as is a small perl module to help map IP adresses to ASN. Both IP version are supported transparently.
Prerequisites
---- Perl (5.14 required)
- libnet-patricia-perl
- libjson-xs-perl (optional, you should use it)How to use
---- First, create a json with a list of prefix -> ASN. tools/ip2asn.json is provided full a snapshot of the current internet view.
- Load the json:
```perl
ip2as::init('path/to/mapping.json');
```
- Do some queries:
```perl
print ip2as::getas4ip('8.8.8.8'); #prints 15169
print ip2as::getas4ip('2001:4f8:1:10:0:1991:8:25'); #prints 1280
```
- When nothing is found, getas4ip returns undef.Known bugs
---This is not really a code-bug, but the default file contains stupid data due to misinformation from the RIPE (and some bad folks):
```perl
print ip2as::getas4ip('::') . "\n"; #prints 29049
print ip2as::getas4ip('10.0.0.1') . "\n"; #prints 15576
```That specific issue is now fixed (by static exclusion), it remains sensitive to bad data.