Blocking internet connection while button is pressed?

manteliukasx

Honorable
Jan 28, 2013
4
0
10,510
Hello. I wondering if it is possible to block internet connection, pref firewall access(inbound) only while you holding a button. For example if i hold mouse button 4 then my incoming connection to specified program is blocked.
 
Solution
G
no easy way springs to mind, you can control windows firewall via the command line netsh command with the advfirewall option for example

netsh advfirewall firewall add rule name="my program" dir=in action=deny program="C:\Program Files\myprogram.exe" enable=yes

would create a rule called my program denying incoming traffic to the program "C:\Program Files\myprogram.exe". You could create a batch file with this command and bind it to the mouse button with autohotkeys (http://www.autohotkey.com/)

one batch file to turn off access bound to pressing down the button, another batch file to turn it back on bound to releasing it. Can't see why it wouldn't work, but i've never tried it
G

Guest

Guest
no easy way springs to mind, you can control windows firewall via the command line netsh command with the advfirewall option for example

netsh advfirewall firewall add rule name="my program" dir=in action=deny program="C:\Program Files\myprogram.exe" enable=yes

would create a rule called my program denying incoming traffic to the program "C:\Program Files\myprogram.exe". You could create a batch file with this command and bind it to the mouse button with autohotkeys (http://www.autohotkey.com/)

one batch file to turn off access bound to pressing down the button, another batch file to turn it back on bound to releasing it. Can't see why it wouldn't work, but i've never tried it
 
Solution