Skip to content

Get ASN delegations list of specific country

License

Notifications You must be signed in to change notification settings

hatamiarash7/ASN-By-Country

Repository files navigation

ASN By Country

made-with-python GitHub release CodeQL GitGuardian Release

It's a simple script to get ASN delegations list of specific country. I'm using RIR Delegations & RIPE NCC Allocations from here.

Usage

python main.py <country_code_1> <country_code_2> ... [options]

Optional Arguments

  • --data-type <type>: Specify which type of data to fetch. The options are:

    • asn: Retrieve only AS numbers (default).
    • ipv4: Retrieve only IPv4 addresses.
    • ipv6: Retrieve only IPv6 addresses.
    • all: Retrieve AS numbers, IPv4 addresses, and IPv6 addresses.

    Default: asn

Examples

python main.py IR US FR

python main.py IR --data-type asn

python main.py IR US --data-type all

Docker

docker run --rm  -v /results:/app/output_data hatamiarash7/asn-by-country:latest <country_code_1> <country_code_2> ... [options]

Result

The output of the ASN By Country script will be generated in the output_data directory. The following files will be created based on the specified country codes, and they will contain ASN delegation information for both IPv4 and IPv6 addresses.

File List and Descriptions

File Name Description
{Country}_asn_list.csv Contains a list of ASN delegations for specified country.
{Country}_ipv4_list.csv Contains IPv4-specific ASN delegations for specified country.
{Country}_ipv6_list.csv Contains IPv6-specific ASN delegations for specified country.
asn_ranges.txt Contains a list of all ASN ranges across countries.
ipv4_ranges.txt Contains a list of all IPv4 ranges.
ipv6_ranges.txt Contains a list of all IPv6 ranges.

Support 💛

Donate with Bitcoin Donate with Ethereum

ko-fi

Contributing 🤝

Don't be shy and reach out to us if you want to contribute 😉

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

Issues

Each project may have many problems. Contributing to the better development of this project by reporting them. 👍