Problem with internet add-on when firewall is disabled
-
Hello
I'm doing tests with internet add-on with option block by firewall (I do not want to change routing) on windows computers.
It doesn't work because the three firewalls are disabled on our computers.
Would it be possible to modify the add-on so that:- when blocking is enabled, the add-on verifies and store firewall state
- it activates firewall and then applies rules
- when blocking is disabled, it restores firewall initial state
?
Exemple of batch script to do that:
@echo off
:: Script pour activer le pare-feu Windows s'il est désactivé,
:: puis le réactiver s'il était initialement activé:: Chemin du fichier temporaire pour sauvegarder l'état initial
set "tempfile=%temp%\firewall_state.txt":: Sauvegarde l'état initial de chaque profil
(
for %%p in (Domain,Private,Public) do (
echo Verifying profile %%p...
netsh advfirewall show %%pprofile state | find "ON" >nul
if errorlevel 1 (
echo %%p=OFF
) else (
echo %%p=ON
)
)
) > "%tempfile%":: Active le pare-feu pour chaque profil s'il est désactivé
for %%p in (Domain,Private,Public) do (
netsh advfirewall show %%pprofile state | find "ON" >nul
if errorlevel 1 (
echo Firewall is disabled for profile %%p.
echo Firewall activation for profile %%p...
netsh advfirewall set %%pprofile state on
) else (
echo Firewall already activated for profile %%p.
)
)echo Firewall activated for all profiles
echo Press any key to return to initial state...
pause:: Rétablit l'état initial
for /f "tokens=1,2 delims==" %%a in (%tempfile%) do (
if "%%b"=="OFF" (
echo Go back profile %%a to OFF...
netsh advfirewall set %%aprofile state off
)
):: Nettoyage
del "%tempfile%" 2>nulecho Initial state restored
Thanks in advance
JM Biansan