Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. #NoEnv
  2. #SingleInstance Force
  3. SendMode Input
  4. SetWorkingDir %A_ScriptDir%
  5.  
  6. toggled = 0
  7.  
  8. If (!A_IsAdmin) { ; Checks if the script has been ran as Admin
  9. MsgBox,,,Remember to run the script as Administrator.
  10. ExitApp
  11. return
  12. }
  13.  
  14. RemoveToolTip:
  15. SetTimer, RemoveToolTip, Off
  16. ToolTip
  17. return
  18.  
  19. ~^x:: ; Used to close the script, also disables rules in case pushed while lagging
  20. Run, netsh advfirewall firewall set rule name="Block Inbound" new enable="no",, hide
  21. Run, netsh advfirewall firewall set rule name="Block Outbound" new enable="no",, hide
  22. ExitApp
  23.  
  24. ~F11:: ; Toggles the lag switch on and off
  25. if (toggled = 0) {
  26. Run, netsh advfirewall firewall set rule name="Block Inbound" new enable="yes",, hide
  27. Run, netsh advfirewall firewall set rule name="Block Outbound" new enable="yes",, hide
  28. Tooltip,ON,0,0,1
  29. toggled = 1
  30. return
  31. } else {
  32. Run, netsh advfirewall firewall set rule name="Block Inbound" new enable="no",, hide
  33. Run, netsh advfirewall firewall set rule name="Block OutBound" new enable="no",, hide
  34. Tooltip,OFF,0,0,1
  35. toggled = 0
  36. SetTimer, RemoveToolTip, 2500
  37. return
  38. }
  39.  
  40. ~End:: ; Adds the rules to the firewall
  41. MsgBox, 4, , This will add the required rules to the Windows firewall, do you want to proceed?
  42. IfMsgBox, No
  43. {
  44. return
  45. }
  46. IfMsgBox, Yes
  47. {
  48. Run, netsh advfirewall firewall add rule name="Block Inbound" protocol=any dir=in enable=no action=block profile=any,, hide
  49. Run, netsh advfirewall firewall add rule name="Block Outbound" protocol=any dir=out enable=no action=block profile=any,, hide
  50. sleep, 500
  51. MsgBox,,,Rules added.
  52. return
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement