{"id":20601151,"url":"https://github.com/dagenix/netrange","last_synced_at":"2025-07-23T18:05:01.088Z","repository":{"id":42223709,"uuid":"345921583","full_name":"DaGenix/netrange","owner":"DaGenix","description":"netrange is a CLI utility that is able to fetch lists of IP ranges used by common cloud services, filter those lists by attributes provided by the cloud providers, and then optionally minimize the set of resulting ranges.","archived":false,"fork":false,"pushed_at":"2022-09-30T22:16:28.000Z","size":165,"stargazers_count":6,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-23T09:55:34.970Z","etag":null,"topics":["aws","azure","backblaze","cidr","cli","cloudflare","digitalocean","gcp","github","ip-ranges","rust-lang"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DaGenix.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-09T07:37:24.000Z","updated_at":"2025-06-08T12:37:35.000Z","dependencies_parsed_at":"2022-08-25T05:50:22.833Z","dependency_job_id":null,"html_url":"https://github.com/DaGenix/netrange","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/DaGenix/netrange","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaGenix%2Fnetrange","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaGenix%2Fnetrange/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaGenix%2Fnetrange/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaGenix%2Fnetrange/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DaGenix","download_url":"https://codeload.github.com/DaGenix/netrange/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaGenix%2Fnetrange/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266726610,"owners_count":23974926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","azure","backblaze","cidr","cli","cloudflare","digitalocean","gcp","github","ip-ranges","rust-lang"],"created_at":"2024-11-16T09:08:50.051Z","updated_at":"2025-07-23T18:05:01.064Z","avatar_url":"https://github.com/DaGenix.png","language":"Rust","readme":"# netrange\n\nnetrange is a CLI utility that is able to fetch lists of\nIP ranges used by common cloud services, filter those lists\nby attributes provided by the cloud providers, and then\noptionally minimize the set of resulting ranges.\n\n[![Crates.io](https://img.shields.io/crates/v/netrange.svg)](https://crates.io/crates/netrange)\n[![Bors enabled](https://bors.tech/images/badge_small.svg)](https://app.bors.tech/repositories/32984)\n\nThe following cloud services are supported:\n  - AWS\n  - Azure\n  - Cloudflare\n  - DigitalOcean\n  - Fastly\n  - GCP\n  - Github\n  - Google (all Google services, including GCP)\n\nAn example:\n\n```sh\nnetrange cloud get-merge aws --filter \"return service == 'EC2' and region == 'us-east-1'\"\n```\n\nwill download the current list of IP ranges being used by AWS,\nfilter out everything except those being used for EC2 servers\nin the us-east-1 region, and then minimize the result by merging\nany adjacent IP ranges.\n\n## Installation\n\nPrecompiled binaries are available from the [Release Pages](https://github.com/DaGenix/netrange/releases)\nfor Linux, Mac OS, and Windows (32 \u0026 64 bit).\n\nOr, you can compile from source:\n\n1. [Download and install Rust](https://www.rust-lang.org/learn/get-started).\n\n2.  Then run:\n    ```sh\n    cargo install netrange\n    ```\n\n## Merging and Reading\n\nnetrange support \"merge\" and \"read\" operations. Both operations\nwill read a set of ranges published by a cloud provider\nand write ranges, 1-per line to STDOUT. The \"merge\" operations\nwill, however, also minimize the output by merging adjacent\nranges. The \"read\" operations will not merge any ranges, however -\nwhatever the cloud service lists for ranges is what will be output.\n\n## Filtering and Selecting\n\nnetrange supports extracting a smaller set of ranges of interest\nfrom the full set of ranges published by the cloud services\nusing LUA scripts. There are two operations available:\nfiltering and selecting. A filter program should return\na False value for any ranges that should be thrown away and\na True value for other ranges. A select program runs after\nfiltering and it should return a True value for any ranges\nthat _must_ be present in the output and a False value for\nranges that _may_ be present in the output, but don't have to\nbe.\n\nAs an example,\n\n```sh\nnetrange cloud get-read aws --filter \"return service == 'EC2' and region == 'us-east-1'\"\n```\n\nCurrently returns 124 ranges, as this is the number of IP ranges\nthat AWS publishes for EC2 servers in the us-east-1 region.\n\n```sh\nnetrange cloud get-merge aws --filter \"return service == 'EC2' and region == 'us-east-1'\"\n```\n\nCurrently returns 112 ranges, as some of the 124 ranges that\nAWS publishes are adjacent and can be merged to produce a smaller\noutput set.\n\n```sh\nnetrange cloud get-merge aws --select \"return service == 'EC2' and region == 'us-east-1'\"\n```\n\nCurrently returns 90 ranges. We get the smaller number of output\nranges because we didn't throw away non-EC2 and non-us-east-1 ranges\nbut instead used them to minimize the output set: some EC2 ranges\nmay have gaps between them used by other services and by using those\nranges to fill in the gaps we can merge ranges more aggressively.\nThe tradeoff, of course, is that the output no longer represents\nonly the EC2 ranges.\n\nDifferent cloud services provide different attributes available\nfor filtering and selecting. The `cloud filter-help \u003cservice\u003e` subcommand\ncane be used to see which attributes are available for a particular\nservice.\n\n## Commands\n\n### Cloud Get\n\nThe `cloud get` subcommand will fetch the source file\nthat contains IP ranges published by the given service\nand write it to STDOUT. This will often be a JSON file - but\ncan be other formats as well.\n\nExample:\n\n```sh\nnetrange cloud get aws\n```\n\n### Cloud Read\n\nThe `cloud read` subcommand will read in the range file\nprovided by the service (which may have\nbeen retrieved by `cloud get`) and write all IP ranges,\n1-per line, to STDOUT.\n\nAdjacent ranges are _not_ merged in the output.\n\nThe ranges that are printed may optionally be filtered\nby attributes that the cloud service provides.\n\nExample:\n\n```sh\nnetrange cloud read aws aws-ip-ranges.json\n```\n\n### Cloud Merge\n\nThe `cloud merge` subcommand will read in the range file\nprovided by the service (which may have\nbeen retrieved by `cloud get`) and write all IP ranges,\n1-per line, to STDOUT.\n\nAdjacent ranges _are_ merged in the output.\n\nFilter and select LUA programs may be used to control\nwhich ranges are represented in the output.\n\nExample:\n\n```sh\nnetrange cloud merge aws aws-ip-ranges.json\n```\n\n### Cloud Get Read\n\nThe `cloud get-read` subcommand is a shortcut for\nfirst using the `cloud get` subcommand and then\nfeeding the result into the `cloud read` subcommand.\n\n```sh\nnetrange cloud cloud-get aws\n```\n\n### Cloud Get Merge\n\nThe `cloud get-merge` subcommand is a shortcut for\nfirst using the `cloud get` subcommand and then\nfeeding the result into the `cloud merge` subcommand.\n\n```sh\nnetrange cloud cloud-merge aws\n```\n\n### Cloud Filter Help\n\nThe `cloud filter-help` subcommand will print to\nSTDOUT information about what attributes are available\nfor filtering and selecting for the given cloud service.\n\n```sh\nnetrange cloud filter-help aws\n```\n\n### Merge\n\nThe `merge` subcommand will read in a list of IP\nranges from the given file (or STDIN if no file is\n\"-\"), merge adjacent ranges, and then print\nthe resulting ranges to STDOUT.\n\n```sh\nnetrange merge input-ranges.txt\n```\n\n## Minimum Rust version policy\n\nnetrange supports rustc 1.45 and later.\n\nThe minimum supported rustc version may be bumped with minor\nrevisions.\n\n## License\n\nThis project is licensed under either of\n\n * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or\n   https://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or\n   https://opensource.org/licenses/MIT)\n\nat your option.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagenix%2Fnetrange","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdagenix%2Fnetrange","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagenix%2Fnetrange/lists"}