Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv
- #SingleInstance Force
- SendMode Input
- SetWorkingDir %A_ScriptDir%
- toggled = 0
- If (!A_IsAdmin) {
- MsgBox,,,Remember to run the script as Administrator.
- ExitApp
- return
- }
- RemoveToolTip:
- SetTimer, RemoveToolTip, Off
- ToolTip
- return
- ~^x::
- Run, netsh advfirewall firewall set rule name="Block Inbound TCP" new enable="no",, hide
- Run, netsh advfirewall firewall set rule name="Block Inbound UDP" new enable="no",, hide
- Run, netsh advfirewall firewall set rule name="Block Outbound TCP" new enable="no",, hide
- Run, netsh advfirewall firewall set rule name="Block Outbound UDP" new enable="no",, hide
- ExitApp
- ~F11::
- if (toggled = 0) {
- Run, netsh advfirewall firewall set rule name="Block Inbound TCP" new enable="yes",, hide
- Run, netsh advfirewall firewall set rule name="Block Inbound UDP" new enable="yes",, hide
- Run, netsh advfirewall firewall set rule name="Block Outbound TCP" new enable="yes",, hide
- Run, netsh advfirewall firewall set rule name="Block Outbound UDP" new enable="yes",, hide
- Tooltip,ON,0,0,1
- toggled = 1
- return
- } else {
- Run, netsh advfirewall firewall set rule name="Block Inbound TCP" new enable="no",, hide
- Run, netsh advfirewall firewall set rule name="Block Inbound UDP" new enable="no",, hide
- Run, netsh advfirewall firewall set rule name="Block Outbound TCP" new enable="no",, hide
- Run, netsh advfirewall firewall set rule name="Block OutBound UDP" new enable="no",, hide
- Tooltip,OFF,0,0,1
- SetTimer, RemoveToolTip, 2500
- toggled = 0
- return
- }
- ~Home::
- MsgBox, 4, , This will add the required rules to the Windows firewall, do you want to proceed?
- IfMsgBox, No
- {
- return
- }
- IfMsgBox, Yes
- {
- Run, netsh advfirewall firewall add rule name="Block Inbound TCP" protocol=tcp dir=in enable=no action=block profile=any,, hide
- Run, netsh advfirewall firewall add rule name="Block Inbound UDP" protocol=udp dir=in enable=no action=block profile=any,, hide
- Run, netsh advfirewall firewall add rule name="Block Outbound TCP" protocol=tcp dir=out enable=no action=block profile=any,, hide
- Run, netsh advfirewall firewall add rule name="Block Outbound UDP" protocol=udp dir=out enable=no action=block profile=any,, hide
- sleep, 500
- MsgBox,,,Rules added.
- return
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement