2024-05-13 20:04:11 +00:00
@ echo off
: loop
cls
echo Monitoring TCP Connections...
echo .
2024-05-13 20:07:12 +00:00
set /p option = " Enter 'a' for all TCP connections, 'e' for established connections, 'ac' for all connections count, or 'ec' for established connections count: "
2024-05-13 20:04:11 +00:00
if " %option% " == " a " (
2024-05-13 20:07:12 +00:00
netstat -an | findstr /c:" TCP "
2024-05-13 20:04:11 +00:00
) else if "%option%"=="e" (
netstat -an | findstr /c:" ESTABLISHED "
2024-05-13 20:07:12 +00:00
) else if "%option%"=="ac" (
netstat -an | findstr /c:" TCP " /c:" Active Connections "
) else if "%option%"=="ec" (
netstat -an | findstr /c:" ESTABLISHED " | find /c /v " "
) else (
2024-05-13 20:04:11 +00:00
echo Invalid option. Please try again.
)
timeout /t 5 > nul
goto loop