Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

This script will help you block your program from internet access using the Windows firewall

License

NotificationsYou must be signed in to change notification settings

1999AZZAR/bash-firewall-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This script helps you block internet access for specific programs using the Windows firewall automatically.

What it does

  • The script blocks internet access for all.exe files in the script's directory and its subfolders.
  • It creates two firewall rules for each.exe file found: one for incoming connections and one for outgoing connections.

How to use

  1. Download this repository.
  2. Extract the downloaded files.
  3. Copy the extracted.bat file to the folder of the program(s) you want to block internet access for.
  4. Run the script as an administrator (right-click on the script and choose "Run as administrator").
  5. Once the script finishes running, you can safely delete the.bat file from the program folder.
  6. Internet access for the specified programs will now be blocked.

How it works

  • The script is written inbatch language, a scripting language for the Windows command line.
  • It uses thefor andnetsh commands to add firewall rules for each.exe file in the current directory and its subdirectories.
  • Thefor /R command searches through all subdirectories, and%%f represents the current file path.
  • Firewall rules are added using thenetsh advfirewall firewall add rule command.
  • Each rule blocks incoming and outgoing connections for a specific program.
  • The rule's name, direction, and program path are specified in the command.
  • The script includes thesetlocal enableextensions command to enable extensions andcd /d "%~dp0" to change to the script's directory.
  • Apause command is included so you can review the results before closing the command prompt.

Flowchart

graph LRsubgraph Initialize    A[Set Echo Off]    B[Enable Local Extensions]    C[Change Directory]endsubgraph Loop    D[Loop through files *.exe]    E[Add Outbound Firewall Rule]    F[Add Inbound Firewall Rule]endG[Display Pause Message]A --> B --> C --> D --> E --> F --> DD -->|Done| G
Loading

Note: 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.

Support

You can support me by buy me a coffee if u like to.

Buy Me A Coffee

About

This script will help you block your program from internet access using the Windows firewall

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp