Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hatamiarash7/asn-by-country

Get ASN delegations list of specific country
https://github.com/hatamiarash7/asn-by-country

asn asn-list asn-lookup bgp

Last synced: 12 days ago
JSON representation

Get ASN delegations list of specific country

Awesome Lists containing this project

README

        

# ASN By Country

[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![GitHub release](https://img.shields.io/github/release/hatamiarash7/ASN-By-Country.svg)](https://GitHub.com/hatamiarash7/ASN-By-Country/releases/) [![CodeQL](https://github.com/hatamiarash7/ASN-By-Country/actions/workflows/codeql-analysis.yml/badge.svg?branch=main)](https://github.com/hatamiarash7/ASN-By-Country/actions/workflows/codeql-analysis.yml) [![GitGuardian](https://github.com/hatamiarash7/ASN-By-Country/actions/workflows/gitguardian.yml/badge.svg?branch=main)](https://github.com/hatamiarash7/ASN-By-Country/actions/workflows/gitguardian.yml) [![Release](https://github.com/hatamiarash7/ASN-By-Country/actions/workflows/release.yml/badge.svg)](https://github.com/hatamiarash7/ASN-By-Country/actions/workflows/release.yml)

It's a simple script to get ASN delegations list of specific country. I'm using **RIR Delegations & RIPE NCC Allocations** from [here](https://www-public.imtbs-tsp.eu/~maigron/RIR_Stats/index.html).

## Usage

```bash
python main.py ... [options]
```

### Optional Arguments

- `--data-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

```bash
python main.py IR US FR

python main.py IR --data-type asn

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

### Docker

```bash
docker run --rm -v /results:/app/output_data hatamiarash7/asn-by-country:latest ... [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](https://en.cryptobadges.io/badge/micro/bc1qmmh6vt366yzjt3grjxjjqynrrxs3frun8gnxrz)](https://en.cryptobadges.io/donate/bc1qmmh6vt366yzjt3grjxjjqynrrxs3frun8gnxrz) [![Donate with Ethereum](https://en.cryptobadges.io/badge/micro/0x0831bD72Ea8904B38Be9D6185Da2f930d6078094)](https://en.cryptobadges.io/donate/0x0831bD72Ea8904B38Be9D6185Da2f930d6078094)

[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/D1D1WGU9)

## 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. 👍