{"id":21305568,"url":"https://github.com/tflanagan/node-iptables-country-block","last_synced_at":"2025-06-12T17:32:49.852Z","repository":{"id":57276666,"uuid":"244396287","full_name":"tflanagan/node-iptables-country-block","owner":"tflanagan","description":null,"archived":false,"fork":false,"pushed_at":"2020-03-02T23:35:08.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-20T22:53:01.836Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tflanagan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-02T14:49:15.000Z","updated_at":"2020-03-02T23:35:11.000Z","dependencies_parsed_at":"2022-09-17T02:13:33.049Z","dependency_job_id":null,"html_url":"https://github.com/tflanagan/node-iptables-country-block","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tflanagan/node-iptables-country-block","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tflanagan%2Fnode-iptables-country-block","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tflanagan%2Fnode-iptables-country-block/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tflanagan%2Fnode-iptables-country-block/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tflanagan%2Fnode-iptables-country-block/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tflanagan","download_url":"https://codeload.github.com/tflanagan/node-iptables-country-block/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tflanagan%2Fnode-iptables-country-block/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259512357,"owners_count":22869391,"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":[],"created_at":"2024-11-21T16:18:30.544Z","updated_at":"2025-06-12T17:32:49.808Z","avatar_url":"https://github.com/tflanagan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iptables-country-block\n\nInteract with `iptables`, block whole countries based on assigned ip blocks\n\n## Install\n\n```\n$ npm install [--global] iptables-country-block\n```\n\n## Usage\n\n### CLI\n\nNote: Most use cases requires `--global` installation\n\n```\n$ [sudo] iptables-country-block [\"\u003ccountry iso codes, space delimited\u003e\"[ \"\u003ciptables chain name\u003e\"[ \"\u003curl template of ip block sources\u003e\"]]]\n$ [sudo] iptables-country-block \"ru cn\" \"countryipblock\" \"https://raw.githubusercontent.com/herrbischoff/country-ip-blocks/master/ipv4/{isoCode}.cidr\"\n```\n\n### Require\n```js\nconst {\n\tcreateIptablesChain,\n\tgetCountryIPBlocks,\n\tiptables\n} = require('iptables-country-block');\n\nawait iptables('-N somechain');\n// or await createIptablesChain('somechain');\n\nconst ipBlocks = await getCountryIPBlocks(\n\t'https://raw.githubusercontent.com/herrbischoff/country-ip-blocks/master/ipv4/{isoCode}.cidr',\n\t'cn'\n);\n\nfor(let i = 0; i \u003c ipBlocks.length; ++i){\n\tawait iptables('-A somechain -s ' + ipBlocks[i] + ' -j DROP');\n}\n\n\nawait iptables('-I INPUT -j somechain');\nawait iptables('-I OUTPUT -j somechain');\nawait iptables('-I FORWARD -j somechain');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftflanagan%2Fnode-iptables-country-block","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftflanagan%2Fnode-iptables-country-block","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftflanagan%2Fnode-iptables-country-block/lists"}