├── README.md └── WinMasterBlocker.bat /README.md: -------------------------------------------------------------------------------- 1 | ### 🟢🔵🔴 Contributions welcome in expanding the list of vendors and installation paths! 2 | 3 | 👉 If you know additional paths for app vendors or have information on other vendors, please consider contributing. (See the **Contributing** section below for details.) 4 | 5 | # 🔥 WinMasterBlocker 🔥 6 | 7 | ### Your all-in-one firewall control script for blocking Adobe, Corel, Autodesk, Maxon and more from phoning-home! 💻🚫 8 | 9 | ## What is this? 10 | 11 | Welcome to **WinMasterBlocker**—a nifty little batch script that slaps firewall rules on apps you probably don’t want connecting to the internet (like Adobe, Autodesk, Corel, Maxon and others). It’s your no-fuss way to get peace and quiet from those phoning-home apps. 🚫📡 12 | 13 | ## !IMP: Only Windows inbuilt commands & firewall cli is used to block the apps from internet access, NO third party tools or solutions are used for this script's functionality. 14 | 15 | --- 16 | 17 | ## Quick Start 18 | 19 | To run the script, simply download `WinMasterBlocker.bat` and **double-click** it or run the following command from the command line **as administrator**: 20 | 21 | ```bash 22 | WinMasterBlocker.bat 23 | ``` 24 | 25 | --- 26 | 27 | ## Usage 📜 28 | 29 | ### Running the script: 30 | 31 | 1. **Make sure you run this as admin!** It won't work otherwise _(netsh requires it)_. We’ll prompt you if you forget, don’t worry. 😎 32 | 2. **Double-click or run from the command line** 33 | 34 | ### Options in the menu: 35 | 36 | - **Block rules** for Adobe, Corel, Autodesk, etc. 37 | - **Remove firewall rules** (just the ones we added, don’t worry 😉). 38 | - You can pick whether to block **inbound**, **outbound**, or both kinds of traffic. Customizable and clean. 💪 39 | 40 | --- 41 | 42 | ## Contributing 👾 43 | 44 | We love contributions, PRs, and feature requests! If you’re one of those who likes to tinker and hack on scripts, here’s how you can get involved: 45 | 46 | ### Steps to contribute: 47 | 48 | 1. **Fork it** 🍴 – You know the drill. Fork this repo. 49 | 2. **Clone it** 🛠️ – Get the code to your local: 50 | ```bash 51 | git clone https://github.com/ph33nx/WinMasterBlocker 52 | ``` 53 | 3. **Create a branch** 🌿 – New features? Fixes? Start a new branch: 54 | ```bash 55 | git checkout -b my-cool-feature 56 | ``` 57 | 4. **Add your magic** ✨ – Modify `WinMasterBlocker.bat` or enhance the `README.md`. Make sure your changes are 💯 legit. 58 | 5. **Push your branch** 🚀 – Send it back up: 59 | ```bash 60 | git push origin my-cool-feature 61 | ``` 62 | 6. **Submit a Pull Request (PR)** 🤙 63 | 64 | ### Want to add more apps to block? 🛑 65 | 66 | Feel free to throw in more providers. Just add the app to the `providers[]` and `paths[]` arrays in the script. Got new paths for a provider? Add them in there too! We’re open to adding pretty much anything (the bigger the blacklist, the better). 💣 67 | 68 | ```batch 69 | :: Add new provider paths here 70 | set "vendors[7]=NewApp" 71 | set "paths[7]=C:\Program Files\NewApp;C:\Program Files (x86)\NewApp" 72 | ``` 73 | 74 | ### Checklist before sending that PR 🚧: 75 | 76 | - Make sure the script **runs on your machine** before submitting. Nobody likes broken code. 🛠️ 77 | - Follow the existing format for adding new providers or paths. 78 | - Respect the 💀 rule: **no hard-breaking changes**. 79 | 80 | --- 81 | 82 | ## License ⚖️ 83 | 84 | MIT License – this means you can do pretty much anything with this, but we’d love a shout-out if you find it useful. 🎉 85 | 86 | --- 87 | 88 | ## Contact 📫 89 | 90 | - **Author:** [ph33nx](https://github.com/ph33nx) 91 | - **Current Repo:** [WinMasterBlocker](https://github.com/ph33nx/WinMasterBlocker) 92 | - **Contributions welcomed!** - Especially for app vendors and their install locations. 93 | 94 | --- 95 | 96 | Feel free to copy, edit, or just stare at the code. 😎 97 | -------------------------------------------------------------------------------- /WinMasterBlocker.bat: -------------------------------------------------------------------------------- 1 | :: ################################################################ 2 | :: ## 🔥 WinMasterBlocker 🔥 # 3 | :: ################################################################ 4 | :: # Author: https://github.com/ph33nx # 5 | :: # Repo: https://github.com/ph33nx/WinMasterBlocker # 6 | :: # # 7 | :: # This script blocks inbound/outbound network access # 8 | :: # for major apps like Adobe, Autodesk, Corel, Maxon, # 9 | :: # and more using Windows Firewall. # 10 | :: # # 11 | :: # Features: # 12 | :: # - Block executables using windows firewall for popular # 13 | :: # vendors # 14 | :: # - Add or Delete inbound, outbound, or both types of rules # 15 | :: # - Avoids duplicate firewall rules # 16 | :: # - Logs skipped entries for existing rules # 17 | :: # # 18 | :: # Check out the repo to contribute: # 19 | :: # https://github.com/ph33nx/WinMasterBlocker # 20 | :: ################################################################ 21 | 22 | @echo off 23 | setlocal enabledelayedexpansion 24 | 25 | :: Array of vendors and their paths 26 | set "vendors[0]=Adobe" 27 | set "paths[0]=C:\Program Files\Adobe;C:\Program Files\Common Files\Adobe;C:\Program Files (x86)\Adobe;C:\Program Files (x86)\Common Files\Adobe;C:\ProgramData\Adobe" 28 | 29 | set "vendors[1]=Corel" 30 | set "paths[1]=C:\Program Files\Corel;C:\Program Files\Common Files\Corel;C:\Program Files (x86)\Corel" 31 | 32 | set "vendors[2]=Autodesk" 33 | set "paths[2]=C:\Program Files\Autodesk;C:\Program Files (x86)\Common Files\Macrovision Shared;C:\Program Files (x86)\Common Files\Autodesk Shared" 34 | 35 | set "vendors[3]=Maxon" 36 | set "paths[3]=C:\Program Files\Maxon;C:\Program Files (x86)\Maxon;C:\ProgramData\Maxon" 37 | 38 | set "vendors[4]=Red Giant" 39 | set "paths[4]=C:\Program Files\Red Giant;C:\Program Files (x86)\Red Giant" 40 | 41 | :: Check if script is run as administrator 42 | :check_admin 43 | net session >nul 2>&1 44 | if %errorlevel% neq 0 ( 45 | echo. 46 | echo This script must be run as Administrator. 47 | echo Attempting to re-launch with elevated privileges... 48 | powershell -Command "Start-Process '%~f0' -Verb RunAs" 49 | exit /b 50 | ) 51 | 52 | :: If admin, proceed with script 53 | echo Running with Administrator privileges... 54 | goto menu 55 | 56 | :: Main menu for user selection 57 | :menu 58 | cls 59 | echo Choose a vendor to block or delete rules: 60 | echo. 61 | 62 | :: Iterate through defined vendors 63 | set i=0 64 | :vendor_loop 65 | if not defined vendors[%i%] goto after_vendor_list 66 | echo !i!: !vendors[%i%]! 67 | set /a i+=1 68 | goto vendor_loop 69 | 70 | :after_vendor_list 71 | echo 99: Delete all firewall rules (added by this script) 72 | echo. 73 | 74 | set /p "choice=Enter your choice (0-99): " 75 | 76 | :: Validate if choice is a number between 0 and 99 77 | set /a test_choice=%choice% 2>nul 78 | if "%choice%" neq "%test_choice%" ( 79 | echo Invalid input, please enter a valid number. 80 | pause 81 | goto menu 82 | ) 83 | 84 | :: Dynamic input validation based on the number of vendors 85 | set max_choice=!i! 86 | if "%choice%"=="00" ( 87 | goto end 88 | ) else if "%choice%"=="99" ( 89 | goto delete_menu 90 | ) else if %choice% lss %max_choice% ( 91 | goto process_vendor 92 | ) else ( 93 | echo Invalid choice, try again. 94 | pause 95 | goto menu 96 | ) 97 | 98 | :: Menu for deleting rules (inbound, outbound, both) 99 | :delete_menu 100 | cls 101 | echo Select which firewall rules to DELETE (added by this script): 102 | echo 1: Delete Outbound rules 103 | echo 2: Delete Inbound rules 104 | echo 3: Delete All 105 | echo. 106 | 107 | set /p "delete_choice=Enter your choice (1-3): " 108 | if "%delete_choice%"=="1" ( 109 | goto delete_outbound 110 | ) else if "%delete_choice%"=="2" ( 111 | goto delete_inbound 112 | ) else if "%delete_choice%"=="3" ( 113 | goto delete_both 114 | ) else ( 115 | echo Invalid choice, try again. 116 | pause 117 | goto delete_menu 118 | ) 119 | 120 | :: Delete Outbound rules 121 | :delete_outbound 122 | cls 123 | echo Deleting all outbound firewall rules (added by this script)... 124 | for /f "tokens=*" %%r in ('powershell -command "(Get-NetFirewallRule | where {$_.DisplayName -like '*-block'}).DisplayName"') do ( 125 | for %%D in (out) do ( 126 | netsh advfirewall firewall delete rule name="%%r" dir=%%D 127 | ) 128 | ) 129 | echo Outbound rules deleted successfully. 130 | goto firewall_check 131 | 132 | :: Delete Inbound rules 133 | :delete_inbound 134 | cls 135 | echo Deleting all inbound firewall rules (added by this script)... 136 | for /f "tokens=*" %%r in ('powershell -command "(Get-NetFirewallRule | where {$_.DisplayName -like '*-block'}).DisplayName"') do ( 137 | for %%D in (in) do ( 138 | netsh advfirewall firewall delete rule name="%%r" dir=%%D 139 | ) 140 | ) 141 | echo Inbound rules deleted successfully. 142 | goto firewall_check 143 | 144 | :: Delete Both Inbound and Outbound rules 145 | :delete_both 146 | cls 147 | echo Deleting all inbound and outbound firewall rules (added by this script)... 148 | for /f "tokens=*" %%r in ('powershell -command "(Get-NetFirewallRule | where {$_.DisplayName -like '*-block'}).DisplayName"') do ( 149 | for %%D in (in out) do ( 150 | netsh advfirewall firewall delete rule name="%%r" dir=%%D 151 | ) 152 | ) 153 | echo Inbound and Outbound rules deleted successfully. 154 | goto firewall_check 155 | 156 | :: Process each vendor's paths and block executables 157 | :process_vendor 158 | cls 159 | set "selected_vendor=!vendors[%choice%]!" 160 | set "selected_paths=!paths[%choice%]!" 161 | 162 | :: Initialize rule counter and a flag to track if any valid path was found 163 | set "rule_count=0" 164 | set "any_valid_path=false" 165 | 166 | echo Blocking executables for %selected_vendor% with paths %selected_paths%... 167 | 168 | :: Loop through each path and perform a deep nested search for executables 169 | for %%P in ("%selected_paths:;=" "%") do ( 170 | set "current_path=%%~P" 171 | echo Checking path: "!current_path!" 172 | 173 | if exist "!current_path!" ( 174 | set "any_valid_path=true" 175 | echo Path exists: "!current_path!" - Searching for executables... 176 | 177 | set "exe_found_in_path=false" 178 | 179 | :: Use pushd/popd to make current_path the root of the recursive search 180 | pushd "!current_path!" 181 | for /R %%F in (*.exe) do ( 182 | set "current_exe=%%F" 183 | set "exe_found_in_path=true" 184 | echo Found executable: "!current_exe!" 185 | call :check_and_block "!current_exe!" "!selected_vendor!" 186 | ) 187 | popd 188 | 189 | :: Check if any executables were found in the current path 190 | if "!exe_found_in_path!"=="false" ( 191 | echo No executables found in path: "!current_path!" 192 | ) 193 | 194 | ) else ( 195 | echo Path not found: "!current_path!" 196 | ) 197 | ) 198 | 199 | :: Final check after loop - notify if no valid directories were found 200 | if "!any_valid_path!"=="false" ( 201 | echo No valid directories found for %selected_vendor%. 202 | ) else if %rule_count%==0 ( 203 | echo No executable files found to block for %selected_vendor%. 204 | ) 205 | 206 | echo. 207 | echo Completed blocking for %selected_vendor%. 208 | echo Total rules added: %rule_count% 209 | pause 210 | goto menu 211 | 212 | 213 | :: Function to check if a rule exists, and add it if not 214 | :check_and_block 215 | set "exe_path=%~1" 216 | set "vendor_name=%~2" 217 | set "rule_name=%~n1 %vendor_name%-block" 218 | 219 | echo Checking rule for: "%exe_path%" 220 | 221 | :: Check if the rule already exists 222 | for /f "tokens=*" %%r in ('powershell -command "(Get-NetFirewallRule | where {$_.DisplayName -eq '%rule_name%'}).DisplayName"') do ( 223 | if "%%r"=="%rule_name%" ( 224 | echo Rule for "%exe_path%" already exists, skipping... 225 | goto :continue 226 | ) 227 | ) 228 | 229 | :: Add rule if it doesn’t exist 230 | echo Blocking: "%~n1" 231 | netsh advfirewall firewall add rule name="%rule_name%" dir=out program="%exe_path%" action=block 232 | netsh advfirewall firewall add rule name="%rule_name%" dir=in program="%exe_path%" action=block 233 | 234 | :: Increment rule count for each rule added 235 | set /a rule_count+=1 236 | 237 | :continue 238 | goto :eof 239 | 240 | :: Notify user to check Windows Firewall with Advanced Security 241 | :firewall_check 242 | echo. 243 | echo All changes completed. You can verify the new rules in "Windows Firewall with Advanced Security" 244 | echo. 245 | pause 246 | goto menu 247 | 248 | :end 249 | endlocal 250 | exit /b 251 | --------------------------------------------------------------------------------