added options for count

This commit is contained in:
Brad Ganley 2024-05-13 15:07:12 -05:00
parent 6a9e572fe2
commit 38b2412fa9

View File

@ -4,12 +4,18 @@
cls cls
echo Monitoring TCP Connections... echo Monitoring TCP Connections...
echo. echo.
set /p option="Enter 'a' for all TCP connections or 'e' for established connections: "
set /p option="Enter 'a' for all TCP connections, 'e' for established connections, 'ac' for all connections count, or 'ec' for established connections count: "
if "%option%"=="a" ( if "%option%"=="a" (
netstat -an | findstr /c:"TCP" /c:"Active Connections" netstat -an | findstr /c:"TCP"
) else if "%option%"=="e" ( ) else if "%option%"=="e" (
netstat -an | findstr /c:"ESTABLISHED" netstat -an | findstr /c:"ESTABLISHED"
)else ( ) 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 (
echo Invalid option. Please try again. echo Invalid option. Please try again.
) )
timeout /t 5 > nul timeout /t 5 > nul