{"id":16700049,"url":"https://github.com/clok/cidr","last_synced_at":"2025-03-23T14:31:44.254Z","repository":{"id":37255821,"uuid":"450640387","full_name":"clok/cidr","owner":"clok","description":"CLI tool for checking IPs against CIDR blocks","archived":false,"fork":false,"pushed_at":"2025-03-05T16:34:20.000Z","size":57,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T21:21:51.298Z","etag":null,"topics":["cidr","cli","filter","go","golang","ipv4","parser","pipe","validation"],"latest_commit_sha":null,"homepage":"https://clok.sh/cidr","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clok.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-21T21:08:48.000Z","updated_at":"2023-05-25T14:45:18.000Z","dependencies_parsed_at":"2023-12-03T01:26:07.673Z","dependency_job_id":"5fe1880d-792b-4e5c-8ea5-32175be80a1c","html_url":"https://github.com/clok/cidr","commit_stats":{"total_commits":53,"total_committers":4,"mean_commits":13.25,"dds":0.3584905660377359,"last_synced_commit":"1f3372df2c424329f8f69009d7375e69b7f1128e"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clok%2Fcidr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clok%2Fcidr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clok%2Fcidr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clok%2Fcidr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clok","download_url":"https://codeload.github.com/clok/cidr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245116002,"owners_count":20563264,"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","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":["cidr","cli","filter","go","golang","ipv4","parser","pipe","validation"],"created_at":"2024-10-12T18:09:10.629Z","updated_at":"2025-03-23T14:31:43.881Z","avatar_url":"https://github.com/clok.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cidr\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://github.com/clok/cidr/blob/master/LICENSE)\n[![Go Report Card](https://goreportcard.com/badge/clok/cidr)](https://goreportcard.com/report/clok/cidr)\n[![Coverage Status](https://coveralls.io/repos/github/clok/cidr/badge.svg)](https://coveralls.io/github/clok/cidr)\n[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white)](https://pkg.go.dev/github.com/clok/cidr?tab=overview)\n\nA CLI tool that is useful for quickly checking and filtering data by IP vs. CIDR blocks.\n\n\u003e Please see [the docs for details on the commands.](./docs/cidr.md)\n\n```text\n$ cidr --help\nNAME:\n   cidr - tool for checking IPs against CIDR blocks\n\nUSAGE:\n   cidr [global options] command [command options] [arguments...]\n\nAUTHOR:\n   Derek Smith \u003cderek@clokwork.net\u003e\n\nCOMMANDS:\n   check, c    Check IP against range of CIDR blocks\n   filter, f   Filters lines in log files of pipe input\n   version, v  Print version info\n   help, h     Shows a list of commands or help for one command\n\nGLOBAL OPTIONS:\n   --help, -h  show help (default: false)\n\nCOPYRIGHT:\n   (c) 2022 Derek Smith\n```\n\n- [Documentation](./docs/cidr.md)\n- [Use Cases](#use-cases)\n- [Installation](#installation)\n    - [Homebrew](#homebrewhttpsbrewsh-for-macos-users)\n    - [curl binary](#curl-binary)\n    - [docker](#dockerhttpswwwdockercom)\n- [Development](#development)\n- [Versioning](#versioning)\n- [Authors](#authors)\n- [License](#license)\n\n## Use Cases\n\nThe `check` command allows for a quick check of a list of IPs and Blocks.\n```text\n$ cidr check --blocks 172.12.0.0/16,172.10.0.0/16 --ips 172.12.1.56,171.10.123.57,172.10.0.255/32\n172.12.1.56/32 is in CIDR 172.12.0.0/16\n171.10.123.57/32 is NOT in CIDR set\n172.10.0.255/32 is in CIDR 172.10.0.0/16\n```\n\nThe `filter` command is useful for filtering large data sets like access log files.\n```text\n$ cidr filter --blocks 10.2.120.0/8,10.2.122.0/8,10.20.128.20/29 --path '/var/log/http/**/access*.log'\n\u003c outputs to STDOUT all lines that contain an IP that is within a CIDR blocks provided \u003e\n```\n\nThe `filter` command can also be used with a pipe.\n```text\n$ cidr filter --blocks 10.2.120.0/8,10.2.122.0/8,10.20.128.20/29 \u003c /var/log/http/access-20220120-18.log\n\u003c outputs to STDOUT all lines that contain an IP that is within a CIDR blocks provided \u003e\n```\n\nFinally, the `filter` command accepts the `--inverse, i` flag which will output all lines that DO NOT contain\nan IP within a CIDR block provided. If a line has multiple IP addresses within it, then ALL IPs must not be within\na CIDR block for the line to be output to `STDOUT`.\n```text\n$ cidr filter --blocks 10.2.120.0/8,10.2.122.0/8,10.20.128.20/29 --path '/var/log/http/**/access*.log' --inverse\n\u003c outputs to STDOUT all lines that DO NOT contain an IP that is within a CIDR blocks provided \u003e\n```\n\n## Installation\n\n### [Homebrew](https://brew.sh) (for macOS users)\n\n```\nbrew tap clok/cidr\nbrew install cidr\n```\n\n### curl binary\n\n```\n$ curl https://i.jpillora.com/clok/cidr! | bash\n```\n\n### [docker](https://www.docker.com/)\n\nThe compiled docker images are maintained\non [GitHub Container Registry (ghcr.io)](https://github.com/orgs/clok/packages/container/package/cidr). We maintain the\nfollowing tags:\n\n- `edge`: Image that is build from the current `HEAD` of the main line branch.\n- `latest`: Image that is built from the [latest released version](https://github.com/clok/cidr/releases)\n- `x.y.z` (versions): Images that are build from the tagged versions within Github.\n\n```bash\ndocker pull ghcr.io/clok/cidr\ndocker run -v \"$PWD\":/workdir ghcr.io/clok/cidr --version\n```\n\n### man page\n\nTo install `man` page:\n\n```\n$ cidr install-manpage\n```\n\n## Development\n\n1. Fork the [clok/cidr](https://github.com/clok/cidr) repo\n1. Use `go \u003e= 1.17`\n1. Branch \u0026 Code\n1. Run linters :broom: `golangci-lint run`\n    - The project uses [golangci-lint](https://golangci-lint.run/usage/install/#local-installation)\n1. Commit with a Conventional Commit\n1. Open a PR\n\n## Versioning\n\nWe employ [git-chglog](https://github.com/git-chglog/git-chglog) to manage the [CHANGELOG.md](CHANGELOG.md). For the\nversions available, see the [tags on this repository](https://github.com/clok/cidr/tags).\n\n## Authors\n\n* **Derek Smith** - [@clok](https://github.com/clok)\n\nSee also the list of [contributors](https://github.com/clok/cidr/contributors) who participated in this project.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclok%2Fcidr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclok%2Fcidr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclok%2Fcidr/lists"}