scripts/tcpcon.bat

24 lines
611 B
Batchfile

@echo off
:loop
cls
echo Monitoring TCP Connections...
echo.
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"
) 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.
)
timeout /t 5 > nul
goto loop