Skip to content

ssw/arin_agreement_status

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
February 27, 2024 10:36
February 28, 2024 15:20
February 29, 2024 07:41
February 29, 2024 07:40
February 28, 2024 14:10

ARINAgreementChecker

The ARINAgreementChecker class is designed to check if an IP prefix is covered by an ARIN (American Registry for Internet Numbers) agreement. It handles downloading, extracting, and processing ARIN's network data to determine if a given IP prefix falls under ARIN's agreement, utilizing a radix tree structure for efficient IP prefix searching.

Features

  • Downloads and processes ARIN's network data.
  • Utilizes a radix tree for efficient searching of IP prefixes.
  • Checks if an IP prefix is covered by ARIN's agreement.
  • Retrieves the organization handle and name for a given IP prefix using the return_org_handle_and_org_name method.
  • Determines the network handles associated with a given IP prefix using the prefix_network_handles method.

Dependencies

  • os
  • time
  • pandas
  • radix
  • ipaddress
  • requests
  • zipfile
  • json

Installation

Ensure you have Python installed on your system. You will also need to install the required dependencies, which can be done via pip:

pip install -r requirements.txt

Note: py-radix may be the package name for the radix tree functionality, depending on the source.

Usage

To use the ARINAgreementChecker class, instantiate it and call its methods with the appropriate IP prefix:

checker = ARINAgreementChecker(force_data_refresh=False)
ip_address = '192.0.2.1'  # Example IP address
is_covered = checker.covered_by_arin_agreement(ip_address)
print(f'Is {ip_address} covered by ARIN agreement? {is_covered}')

# To get network handles associated with an IP prefix
network_handles = checker.prefix_network_handles('192.12.186.0/23')
print(f'Network Handles: {network_handles}')

Methods Overview

  • covered_by_arin_agreement(ip_address): Checks if the given IP address is covered by ARIN's agreement.
  • return_org_handle_and_org_name(prefix): Returns the organization handle and name for a given IP prefix.
  • is_from_ARIN(prefix): Checks if an IP prefix is from ARIN.
  • prefix_network_handles(prefix): Returns a list of network handles associated with a given IP prefix.

Contributing

Contributions to improve the ARINAgreementChecker are welcome. Please feel free to fork the repository, make your changes, and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages