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,11 +4,17 @@
cls
echo Monitoring TCP Connections...
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" (
netstat -an | findstr /c:"TCP" /c:"Active Connections"
netstat -an | findstr /c:"TCP"
) else if "%option%"=="e" (
netstat -an | findstr /c:"ESTABLISHED"
) 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.
)