--- id: pyasn version: "1.6.2" license: MIT license_treatment: permissive maintenance: dormant --- # pyasn — Offline IP address to Autonomous System Number lookup module. License: permissive · Maintenance: dormant · Downloads: 94.0K/mo ## What it is and what it does pyasn is a C-and-Python extension module that maps IP addresses to their originating Autonomous System Numbers using offline, precomputed databases. It uses a radix tree data structure to store and query IP prefixes efficiently, supporting both IPv4 and IPv6. Unlike online lookup services (whois, dig, JSON APIs), pyasn trades initial database load time for much faster per-lookup performance, making it suitable for bulk or repeated queries. The package includes utility scripts to download BGP MRT/RIB archives and convert them into local IPASN database files, enabling historical lookups by date. Initial database loading is the most expensive operation; the documentation recommends caching loaded databases when performing multiple historical lookups. The module has no runtime dependencies and compiles on Linux and Windows, though Windows builds require Microsoft Visual C++. Use it for: - Bulk IP geolocation and routing analysis in network security or research without repeated online API calls. - Historical network routing analysis by loading IPASN databases from different dates to track AS ownership changes. - Building custom BGP prefix lookup tools by converting your own MRT archives into queryable databases. - Offline network traffic classification and AS-path analysis in environments without external API access. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. pyasn performs fast offline IP address to Autonomous System Number (ASN) lookups using prebuilt databases from BGP archives, supporting both current and historical queries. Yes, if you need offline IP-to-ASN lookups and can tolerate high installation friction (C compiler required). The package is stable and has no known vulnerabilities, but maintenance is dormant—last release was over a year ago. Install only if bulk or historical lookups justify the upfront compilation cost over simpler online alternatives. ## Install pip install pyasn uv add pyasn poetry add pyasn ## Installing pyasn Before you install: Installation requires a C compiler and build tools (high friction); the package is dormant with the last release over a year ago, though the repository remains active with a recent commit in December 2024. License in practice: MIT license permits commercial and private use with minimal restrictions; you must include the license notice in distributions. Quickstart: pip install pyasn import pyasn asndb = pyasn.pyasn('ipasn_20140513.dat') result = asndb.lookup('8.8.8.8') print(result) # (15169, '8.8.8.0/24') Requires a C compiler and build tools (build-essential on Ubuntu/Debian, Microsoft Visual C++ on Windows); IPASN database file must be downloaded or built separately using pyasn_util_download.py and pyasn_util_convert.py. Verify before relying: - Whether the package maintains compatibility with Python versions beyond 3.11 given dormant maintenance status. - Current state of gzip support for IPASN data files mentioned as 'new in v1.6' and any performance implications. - Availability and freshness of public IPASN data files for download via the provided utility scripts. ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: high - Maintenance: dormant - Downloads: 94.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags IP to ASN lookup, offline autonomous system number, BGP prefix lookup, IP geolocation routing, historical IP routing data, radix tree IP lookup, ASN database query, bgp-routing, offline-lookup, network-analysis [View on SkillFed](https://skillfed.io/packages/pyasn) · [View on PyPI](https://pypi.org/project/pyasn/)