jhn431
April 1, 2011, 8:29pm
1
The following buttons quickly add and remove applications from windows firewall. (Works with Windows 7/Vista only)
Blocks selected application from accessing internet (Creates an inbound and outbound rule in windows firewall)
<?xml version="1.0"?>
<button backcol="none" display="both" icon_size="large" label_pos="right" separate="yes" textcol="none">
<label>Block Selected Apps from Internet</label>
<tip>blocks selected application</tip>
<icon1>%SystemRoot%\system32\imageres.dll ,100</icon1>
<function type="normal">
<instruction>@admin </instruction>
<instruction>netsh advfirewall firewall add rule name="%1" dir=out action=block program="%1"</instruction>
<instruction>netsh advfirewall firewall add rule name="%1" dir=in action=block program="%1"</instruction>
</function>
</button>
Removes selected application from windows firewall
<?xml version="1.0"?>
<button backcol="none" display="both" icon_size="large" label_pos="right" separate="yes" textcol="none">
<label>Remove Selected App(s) From Windows Firewall</label>
<tip>removes selected program from windows firewall</tip>
<icon1>%SystemRoot%\system32\imageres.dll ,101</icon1>
<function type="normal">
<instruction>@admin </instruction>
<instruction>netsh advfirewall firewall delete rule name="%1"</instruction>
</function>
</button>
Opens Windows Firewall
<?xml version="1.0"?>
<button backcol="none" display="both" icon_size="large" separate="yes" textcol="none">
<label>Windows Firewall Advanced</label>
<tip>Opens WIndows Firewall</tip>
<icon1>C:\Windows\System32\WF.msc,0</icon1>
<function type="normal">
<instruction>@admin </instruction>
<instruction>cd C:\Windows\System32</instruction>
<instruction>C:\Windows\System32\WF.msc</instruction>
</function>
</button>
Close toolbar
<?xml version="1.0"?>
<button backcol="none" display="icon" icon_size="large" textcol="none">
<label>Close </label>
<icon1>#close</icon1>
<function type="normal">
<instruction>Toolbar "WindowsFirewall" CLOSE</instruction>
</function>
</button>
Icon for close toolbar can be found here
https://resource.dopus.com/t/opus-9-unofficial-extra-icons-v1-1/4643/1
Leo
April 2, 2011, 12:04am
2
Would those netsh commands benefit from an @admin line at the start of them? I presume you need to be elevated to add or remove firewall rules and that netsh doesn't automatically prompt, since few command-line tools do. Haven't tried it myself, though, so maybe I'm wrong.
jhn431
April 2, 2011, 12:35am
3
I think it would help, thanks for the suggestion.
Hi there. Thanks to jhn431 for his work. Highly appreciated.
Although, I made some additions to his buttons:
Rule name changed to " ()" instead of fullpath.
it will show you a short Overview, and if there where any errors, it will inform you also.
if there are already rules for the program, it will delete it instead of creating a duplicate rule.
Blocks selected application from accessing internet (Creates an inbound and outbound rule in windows firewall)
<?xml version="1.0"?>
<button backcol="none" display="both" textcol="none">
<label>Add Selected To Windows Firewall</label>
<tip>blocks selected program</tip>
<icon1>%SystemRoot%\system32\imageres.dll ,100</icon1>
<function type="batch">
<instruction>@admin </instruction>
<instruction>@nofilenamequoting </instruction>
<instruction />
<instruction>TITLE Windows Firewall - block Program</instruction>
<instruction>echo ° Windows Firewall °</instruction>
<instruction>echo.</instruction>
<instruction>echo.</instruction>
<instruction>echo ° ° block following program:</instruction>
<instruction>echo °</instruction>
<instruction>echo ° ° {sourcepath|nopath|noterm} ({file})</instruction>
<instruction>echo.</instruction>
<instruction>echo.</instruction>
<instruction>echo.</instruction>
<instruction />
<instruction>netsh advfirewall firewall show rule "{sourcepath|nopath|noterm} ({file})" >nul</instruction>
<instruction>IF %errorlevel% == 0 (</instruction>
<instruction> echo ° remove existing Rules °</instruction>
<instruction> netsh advfirewall firewall delete rule name="{sourcepath|nopath|noterm} ({file})"</instruction>
<instruction> echo.</instruction>
<instruction>)</instruction>
<instruction />
<instruction>echo ° add new Rules °</instruction>
<instruction>netsh advfirewall firewall add rule name="{sourcepath|nopath|noterm} ({file})" dir=out action=block program="{filepath$}"</instruction>
<instruction>IF %errorlevel% == 1 (set out_error=1) ELSE (set out_error=0)</instruction>
<instruction>netsh advfirewall firewall add rule name="{sourcepath|nopath|noterm} ({file})" dir=in action=block program="{filepath$}"</instruction>
<instruction>IF %errorlevel% == 1 (set in_error=1) ELSE (set in_error=0)</instruction>
<instruction />
<instruction>echo.</instruction>
<instruction>IF "%out_error%;%in_error%" == "0;0" (echo ² Success! ²) ELSE (echo ° ERROR! °)</instruction>
<instruction>echo.</instruction>
<instruction>pause</instruction>
</function>
</button>
Removes selected application from windows firewall
<?xml version="1.0"?>
<button backcol="none" display="both" icon_size="large" label_pos="right" separate="yes" textcol="none">
<label>Remove Selected From Windows Firewall</label>
<tip>removes selected program from Windows Firewall</tip>
<icon1>%SystemRoot%\system32\imageres.dll ,101</icon1>
<function type="batch">
<instruction>@admin </instruction>
<instruction>@nofilenamequoting </instruction>
<instruction>TITLE Windows Firewall - allow Program</instruction>
<instruction>echo ° Windows Firewall °</instruction>
<instruction>echo.</instruction>
<instruction>echo.</instruction>
<instruction>echo ² allow following program:</instruction>
<instruction>echo ² ²</instruction>
<instruction>echo ² {sourcepath|nopath|noterm} ({file})</instruction>
<instruction>echo.</instruction>
<instruction>echo.</instruction>
<instruction>echo.</instruction>
<instruction>echo ° remove existing Rules °</instruction>
<instruction>netsh advfirewall firewall delete rule name="{sourcepath|nopath|noterm} ({file})"</instruction>
<instruction>echo.</instruction>
<instruction>echo.</instruction>
<instruction>IF %errorlevel% == 0 (echo ² Success! ²) ELSE (echo ° ERROR! °)</instruction>
<instruction>echo.</instruction>
<instruction>pause</instruction>
</function>
</button>
Leo
March 20, 2012, 12:55am
6
What are all of you running so often that you distrust enough to want to block from accessing the internet, yet trust enough to allow to run code on your computers?