{"id":22432714,"url":"https://github.com/1999azzar/bash-firewall-script","last_synced_at":"2025-10-16T01:31:46.063Z","repository":{"id":112727547,"uuid":"481713038","full_name":"1999AZZAR/bash-firewall-script","owner":"1999AZZAR","description":"This script will help you block your program from internet access using the Windows firewall","archived":false,"fork":false,"pushed_at":"2023-10-10T15:47:42.000Z","size":32,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-12-05T22:12:37.563Z","etag":null,"topics":["firewall","firewall-script","internet-connection","windows"],"latest_commit_sha":null,"homepage":"https://en.wikipedia.org/wiki/Firewall_(computing)","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1999AZZAR.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,"governance":null}},"created_at":"2022-04-14T18:40:52.000Z","updated_at":"2024-07-29T09:52:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"e093d26f-7475-4739-8a8d-3ad172ef68c7","html_url":"https://github.com/1999AZZAR/bash-firewall-script","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999AZZAR%2Fbash-firewall-script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999AZZAR%2Fbash-firewall-script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999AZZAR%2Fbash-firewall-script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999AZZAR%2Fbash-firewall-script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1999AZZAR","download_url":"https://codeload.github.com/1999AZZAR/bash-firewall-script/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236664577,"owners_count":19185516,"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":["firewall","firewall-script","internet-connection","windows"],"created_at":"2024-12-05T22:12:39.167Z","updated_at":"2025-10-16T01:31:45.704Z","avatar_url":"https://github.com/1999AZZAR.png","language":"HTML","funding_links":["https://www.buymeacoffee.com/azzar"],"categories":[],"sub_categories":[],"readme":"# Block Programs from Internet using Firewall\n\nThis script helps you block internet access for specific programs using the Windows firewall automatically.\n\n## What it does\n- The script blocks internet access for all `.exe` files in the script's directory and its subfolders.\n- It creates two firewall rules for each `.exe` file found: one for incoming connections and one for outgoing connections.\n\n## How to use\n1. Download this repository.\n2. Extract the downloaded files.\n3. Copy the extracted `.bat` file to the folder of the program(s) you want to block internet access for.\n4. Run the script as an administrator (right-click on the script and choose \"Run as administrator\").\n5. Once the script finishes running, you can safely delete the `.bat` file from the program folder.\n6. Internet access for the specified programs will now be blocked.\n\n## How it works\n- The script is written in `batch` language, a scripting language for the Windows command line.\n- It uses the `for` and `netsh` commands to add firewall rules for each `.exe` file in the current directory and its subdirectories.\n- The `for /R` command searches through all subdirectories, and `%%f` represents the current file path.\n- Firewall rules are added using the `netsh advfirewall firewall add rule` command.\n- Each rule blocks incoming and outgoing connections for a specific program.\n- The rule's name, direction, and program path are specified in the command.\n- The script includes the `setlocal enableextensions` command to enable extensions and `cd /d \"%~dp0\"` to change to the script's directory.\n- A `pause` command is included so you can review the results before closing the command prompt.\n\n## Flowchart\n\n```mermaid\ngraph LR\n\nsubgraph Initialize\n    A[Set Echo Off]\n    B[Enable Local Extensions]\n    C[Change Directory]\nend\n\nsubgraph Loop\n    D[Loop through files *.exe]\n    E[Add Outbound Firewall Rule]\n    F[Add Inbound Firewall Rule]\nend\n\nG[Display Pause Message]\n\nA --\u003e B --\u003e C --\u003e D --\u003e E --\u003e F --\u003e D\nD --\u003e|Done| G\n```\n\nNote: Be cautious when using this script, as it blocks all internet access for the specified programs. Make sure to have backup copies of the files you want to block.\n\n## Support\n\nYou can support me by buy me a coffee if u like to.\n\n\u003cdiv align=\"left\"\u003e\n\u003c!--   \u003ch4\u003eAnd you can also support me by \u003ca href=\"https://www.buymeacoffee.com/azzar\" target=\"_blank\"\u003ebuying me coffee\u003c/a\u003e\u003c/h4\u003e --\u003e\n  \u003ca href=\"https://www.buymeacoffee.com/azzar\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" style=\"height: 42px !important;width: 151.9px !important; margin-top: 50px !important;\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1999azzar%2Fbash-firewall-script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1999azzar%2Fbash-firewall-script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1999azzar%2Fbash-firewall-script/lists"}