Crates.io | fire-scope |
lib.rs | fire-scope |
version | 0.1.7 |
created_at | 2025-04-03 18:15:16.297374+00 |
updated_at | 2025-08-20 11:59:07.066897+00 |
description | This tool is a CLI application and library that collects and aggregates corresponding IP addresses by specifying country codes and AS numbers, and outputs them to a file in TXT or nftables format.It supports RIR file download and whois AS number query, and also has a function to extract overlapping parts of country codes and AS numbers in CIDR units. |
homepage | |
repository | https://github.com/Neuron-Grid/fire-scope |
max_upload_size | |
id | 1618801 |
size | 152,516 |
This CLI application is used to retrieve the latest address allocation files provided by each Regional Internet Registry (RIR) and output the IPv4/v6 address blocks corresponding to the specified country code to a text file. It can also retrieve the specified AS number and also output it to a text file.
When specifying the -c
option, data is retrieved from the following
When specifying the -a
option, data is retrieved from the following
RIPEstat Announced Prefixes API (primary)
ARIN RDAP OriginAS networks (fallback)
$ cargo install fire-scope
-c
or -a
must be specified.$ fire-scope -c jp us
$ fire-scope -a 0000 1234
$ fire-scope -c jp us -a 0000 1234 -o
-c
: Specify one or more country codes.
-a
: Specify one or more AS numbers.
-h
: Display help.
-v
: Display version.
-o
: Output the overlapping IP addresses among the IPv4/v6 addresses of the specified country code(s) and AS number(s).
-c
and -a
must be specified.Tuning options
--format {txt|nft}
: Output format (default: txt
).--max-retries <N>
: HTTP retry attempts (default: 6).--max-backoff-sec <SEC>
: Cap for exponential backoff per retry (default: 16).--http-timeout-secs <SEC>
: Overall HTTP timeout (default: 20).--connect-timeout-secs <SEC>
: Connect timeout (default: 10).--concurrency <N>
: Max concurrent AS queries (default: 5).--continue-on-partial
: Continue processing with successfully downloaded RIR files even if some fail (default: off = strict).--continue-on-partial
, it proceeds using successfully downloaded files (and prints warnings).fire-scope -c jp --format nft
This creates IPv4_JP.nft
/ IPv6_JP.nft
with
define IPv4_JP = { ... }
/ define IPv6_JP = { ... }
.
include "/etc/nftables/IPv4_JP.nft"
include "/etc/nftables/IPv6_JP.nft"
table inet filter {
chain input {
type filter hook input priority 0;
ip saddr $IPv4_JP accept
ip6 saddr $IPv6_JP accept
}
}
Place the generated files in an appropriate path and include
them.
-c
/-a
), network/HTTP failure (strict mode), no usable RIR files, file write error, etc.-c
nor -a
are specified, the command exits with a non-zero code.-c/--country
accepts only alphabetic ISO-like codes (length 2–3).Content-Length
is missing).--max-retries
and --max-backoff-sec
if needed.rustup update stable
is recommended.fire-scope -c jp us --max-retries 3 --max-backoff-sec 8 --continue-on-partial
fire-scope -a 1234 65000 -C 10