Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 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.  
  20. ins:: ; Toggles the lag switch on and off
  21. {
  22. Run, netsh advfirewall firewall set rule name="Block Inbound" new enable="yes",, hide
  23. Run, netsh advfirewall firewall set rule name="Block Outbound" new enable="yes",, hide
  24. Tooltip,ON,0,0,1
  25. toggled = 1
  26. Sleep, 8300 ; 1000 is one second, 10000 is 10 seconds
  27. Run, netsh advfirewall firewall set rule name="Block Inbound" new enable="no",, hide
  28. Run, netsh advfirewall firewall set rule name="Block OutBound" new enable="no",, hide
  29. Tooltip,OFF,0,0,1
  30. toggled = 0
  31. SetTimer, RemoveToolTip, 2500
  32. return
  33. }
  34. home::
  35. {
  36. Run, netsh advfirewall firewall set rule name="Block Inbound" new enable="no",, hide
  37. Run, netsh advfirewall firewall set rule name="Block OutBound" new enable="no",, hide
  38. Tooltip,OFF,0,0,1
  39. SetTimer, RemoveToolTip, 2500
  40. Return
  41.  
  42. }
  43. ~^Home:: ; Adds the rules to the firewall
  44. MsgBox, 4, , This will add the required rules to the Windows firewall, do you want to proceed?
  45. IfMsgBox, No
  46. {
  47. return
  48. }
  49. IfMsgBox, Yes
  50. {
  51. Run, netsh advfirewall firewall add rule name="Block Inbound" protocol=any dir=in enable=no action=block profile=any,, hide
  52. Run, netsh advfirewall firewall add rule name="Block Outbound" protocol=any dir=out enable=no action=block profile=any,, hide
  53. sleep, 500
  54. MsgBox,,,Rules added.
  55. return
  56. }
  57.  
  58.  
  59.  
  60. Put all that into ahk
  61. Run as admin
  62. Control + Home
  63. Then when u wanna use it you press shift + tab and it will go for 10 sec
  64. If u wanna cancel before the 10 sec you press shift + mousewheel
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement