Rick0

REGRAS_FIREWALL

Apr 1st, 2020 (edited)
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.79 KB | None | 0 0
  1. @echo off
  2. setlocal EnableDelayedExpansion
  3. TITLE CONFIGURANDO FIREWALL DO WINDOWS
  4. pushd "%~dp0"
  5. if not "%1"=="am_admin" (%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe start -verb runas '%0' am_admin & exit /b)
  6. ::VARIAVEIS
  7. ::SET "BKPF=%systemdrive%\%computername%_firewall.wfw"
  8. SET "CHROME=%PROGRAMFILES(X86)%\Google\Chrome\Application\chrome.exe"
  9. SET "FIREFOX=%PROGRAMFILES%\Mozilla Firefox\firefox.exe"
  10.  
  11. ECHO Fazendo Backup das regras do firewall
  12. if exist "%systemdrive%\%computername%_firewall.wfw" del /f /q "%systemdrive%\%computername%_firewall.wfw" >NUL
  13. netsh advfirewall export "%systemdrive%\%computername%_firewall.wfw"  2>&1
  14.  
  15. ECHO Excluindo regras do firewall
  16. netsh advfirewall firewall delete rule all  2>&1
  17. ::netsh advfirewall reset  2>&1
  18. ::netsh advfirewall firewall set rule all new enable=no  2>&1
  19. ECHO Libera DNS e Dhcp e Compartilhamento de arquivos e impressoras
  20. netsh firewall set service type="FILEANDPRINT" mode=enable  > nul
  21. netsh advfirewall firewall add rule name="Core Networking (DNS-Out)" dir=out action=allow protocol=UDP remoteport=53 program="c:\windows\system32\svchost.exe" service="dnscache"  2>&1
  22. netsh advfirewall firewall add rule name="Core Networking (DHCP-Out)" dir=out action=allow protocol=UDP localport=68 remoteport=67 program="c:\windows\system32\svchost.exe" service="dhcp"  >nul
  23.  
  24. ECHO Libera Acesso Firefox
  25. netsh advfirewall firewall add rule name="Firefox" dir=out action=allow program="%FIREFOX%"  2>&1
  26.  
  27. ECHO Libera Acesso Chrome
  28. netsh advfirewall firewall add rule name="Chrome" dir=out action=allow program="%CHROME%"  2>&1
  29.  
  30. ECHO Bloqueia entrada e saida do firewall
  31. netsh advfirewall set allprofiles firewallpolicy blockinbound,blockoutbound  2>&1
  32. pause & CLS & ECHO ABRINDO BACKUP DO FIREWALL & explorer "%systemdrive%" & TIMEOUT 3 & POPD
Add Comment
Please, Sign In to add comment