scripts/tcpcon.bat

24 lines
584 B
Batchfile
Raw Normal View History

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" (
2024-05-13 20:10:31 +00:00
netstat -an | find /c /v ""
2024-05-13 20:07:12 +00:00
) 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