Advertisement
Guest User

Untitled

a guest
May 19th, 2017
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 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) {
  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::
  20. Run, netsh advfirewall firewall set rule name="Block Inbound TCP" new enable="no",, hide
  21. Run, netsh advfirewall firewall set rule name="Block Inbound UDP" new enable="no",, hide
  22. Run, netsh advfirewall firewall set rule name="Block Outbound TCP" new enable="no",, hide
  23. Run, netsh advfirewall firewall set rule name="Block Outbound UDP" new enable="no",, hide
  24. ExitApp
  25.  
  26. ~F11::
  27. if (toggled = 0) {
  28. Run, netsh advfirewall firewall set rule name="Block Inbound TCP" new enable="yes",, hide
  29. Run, netsh advfirewall firewall set rule name="Block Inbound UDP" new enable="yes",, hide
  30. Run, netsh advfirewall firewall set rule name="Block Outbound TCP" new enable="yes",, hide
  31. Run, netsh advfirewall firewall set rule name="Block Outbound UDP" new enable="yes",, hide
  32. Tooltip,ON,0,0,1
  33. toggled = 1
  34. return
  35. } else {
  36. Run, netsh advfirewall firewall set rule name="Block Inbound TCP" new enable="no",, hide
  37. Run, netsh advfirewall firewall set rule name="Block Inbound UDP" new enable="no",, hide
  38. Run, netsh advfirewall firewall set rule name="Block Outbound TCP" new enable="no",, hide
  39. Run, netsh advfirewall firewall set rule name="Block OutBound UDP" new enable="no",, hide
  40. Tooltip,OFF,0,0,1
  41. SetTimer, RemoveToolTip, 2500
  42. toggled = 0
  43. return
  44. }
  45.  
  46. ~Home::
  47. MsgBox, 4, , This will add the required rules to the Windows firewall, do you want to proceed?
  48. IfMsgBox, No
  49. {
  50. return
  51. }
  52. IfMsgBox, Yes
  53. {
  54. Run, netsh advfirewall firewall add rule name="Block Inbound TCP" protocol=tcp dir=in enable=no action=block profile=any,, hide
  55. Run, netsh advfirewall firewall add rule name="Block Inbound UDP" protocol=udp dir=in enable=no action=block profile=any,, hide
  56. Run, netsh advfirewall firewall add rule name="Block Outbound TCP" protocol=tcp dir=out enable=no action=block profile=any,, hide
  57. Run, netsh advfirewall firewall add rule name="Block Outbound UDP" protocol=udp dir=out enable=no action=block profile=any,, hide
  58. sleep, 500
  59. MsgBox,,,Rules added.
  60. return
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement