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 network
Last synced: 6 months ago
JSON representation
Get ASN delegations list of specific country
- Host: GitHub
- URL: https://github.com/hatamiarash7/asn-by-country
- Owner: hatamiarash7
- License: mit
- Created: 2022-10-31T19:32:57.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-23T09:03:42.000Z (6 months ago)
- Last Synced: 2025-04-23T10:22:42.666Z (6 months ago)
- Topics: asn, asn-list, asn-lookup, bgp, network
- Language: Python
- Homepage:
- Size: 194 KB
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# ASN By Country
[](https://www.python.org/) [](https://GitHub.com/hatamiarash7/ASN-By-Country/releases/) [](https://github.com/hatamiarash7/ASN-By-Country/actions/workflows/codeql-analysis.yml) [](https://github.com/hatamiarash7/ASN-By-Country/actions/workflows/gitguardian.yml) [](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 💛
[](https://en.cryptobadges.io/donate/bc1qmmh6vt366yzjt3grjxjjqynrrxs3frun8gnxrz) [](https://en.cryptobadges.io/donate/0x0831bD72Ea8904B38Be9D6185Da2f930d6078094)
[](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. 👍