Simple script to convert ASN to IP to be used with firewall#27
Open
webysther wants to merge 4 commits intobrianhama:masterfrom
Open
Simple script to convert ASN to IP to be used with firewall#27webysther wants to merge 4 commits intobrianhama:masterfrom
webysther wants to merge 4 commits intobrianhama:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a Python script that converts Autonomous System Numbers (ASNs) to IP CIDR blocks for use with firewall configurations, specifically designed to work as a netset in nftables.
Key Changes:
- New script that reads ASN numbers from a file, queries an external API to retrieve associated IP ranges, and outputs them to a blocklist file
- Uses the ipinfo.app API to fetch CIDR blocks for each ASN
- Implements deduplication of CIDR blocks using a set
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,23 @@ | |||
| import requests | |||
There was a problem hiding this comment.
The script lacks any documentation explaining its purpose, usage, or requirements. Consider adding a module-level docstring explaining what the script does, what input format is expected, and what output is produced. This is especially important for security-related tools like firewall configuration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Works as a netset in nftables.
PS: This can be expanded in future to run an action to update the list like others blocklists
Log