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) { ; Checks if the script has been ran as Admin
- MsgBox,,,Remember to run the script as Administrator.
- ExitApp
- return
- }
- RemoveToolTip:
- SetTimer, RemoveToolTip, Off
- ToolTip
- return
- ~^x:: ; Used to close the script, also disables rules in case pushed while lagging
- Run, netsh advfirewall firewall set rule name="Block Inbound" new enable="no",, hide
- Run, netsh advfirewall firewall set rule name="Block Outbound" new enable="no",, hide
- ExitApp
- ~F11:: ; Toggles the lag switch on and off
- if (toggled = 0) {
- Run, netsh advfirewall firewall set rule name="Block Inbound" new enable="yes",, hide
- Run, netsh advfirewall firewall set rule name="Block Outbound" new enable="yes",, hide
- Tooltip,ON,0,0,1
- toggled = 1
- return
- } else {
- Run, netsh advfirewall firewall set rule name="Block Inbound" new enable="no",, hide
- Run, netsh advfirewall firewall set rule name="Block OutBound" new enable="no",, hide
- Tooltip,OFF,0,0,1
- toggled = 0
- SetTimer, RemoveToolTip, 2500
- return
- }
- ~End:: ; Adds the rules to the firewall
- 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" protocol=any dir=in enable=no action=block profile=any,, hide
- Run, netsh advfirewall firewall add rule name="Block Outbound" protocol=any 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