Skip to content

Instantly share code, notes, and snippets.

@imesut
Created March 14, 2022 18:21
Show Gist options
  • Save imesut/bc6db0448a81122e9e6687cd6dae6f6b to your computer and use it in GitHub Desktop.
Save imesut/bc6db0448a81122e9e6687cd6dae6f6b to your computer and use it in GitHub Desktop.
This script blocks the incoming and outcoming network traffic for the exe files in the runned script or subfolders. Should be runned as administrator.
:: Thanks to https://security.stackexchange.com/a/87516/275653
@ setlocal enableextensions
@ cd /d "%~dp0"
for /R %%a in (*.exe) do (
netsh advfirewall firewall add rule name="Blocked with Batchfile %%a" dir=out program="%%a" action=block enable=yes profile=any
netsh advfirewall firewall add rule name="Blocked with Batchfile %%a" dir=in program="%%a" action=block enable=yes profile=any
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment