首页/安全/应急响应速查/Get-NetTCPConnection 连接排查
本包目录(168 条)

Get-NetTCPConnection 连接排查

PowerShell 的网络连接查看:按状态过滤,结合 OwningProcess 直接定位到进程,输出比 netstat 更好处理。

应急响应速查安全更新于 2026-10-12
核心Get-NetTCPConnection
过滤-State Established / -RemoteAddress
定位进程OwningProcess + Get-Process
UDPGet-NetUDPEndpoint

外联与进程对照

外联与进程对照
Get-NetTCPConnection -State Established | Select-Object LocalAddress,LocalPort,RemoteAddress,RemotePort,OwningProcess | Sort-Object RemoteAddress
Get-NetTCPConnection -State Listen | Sort-Object LocalPort
Get-NetTCPConnection -State Established | Where-Object RemoteAddress -ne '127.0.0.1' | ForEach-Object { [pscustomobject]@{Remote="$($_.RemoteAddress):$($_.RemotePort)"; Proc=(Get-Process -Id $_.OwningProcess).ProcessName} }
很多正常业务也连公网:判断要看端口与进程组合,而不是有公网连接就判恶意。

易错点

  • 把 PID 复用当同一进程:要结合进程创建时间
  • 忘了 UDP:DNS 隧道与部分 C2 走 UDP,TCP 看不到

数据来源与参考

  • Microsoft Learn:Get-NetTCPConnection

相关工具

​‌‌​​‌​​​‌‌​‌‌‌‌​‌‌​​​‌‌​‌‌‌​​‌‌​​‌​‌‌‌​​‌‌‌​​​‌​‌‌​‌​​‌​‌‌‌​​​‌​‌‌​‌​​‌​‌‌​​​‌‌​‌‌‌​‌​​​‌‌​‌‌‌‌​​‌​‌‌‌​​‌‌​​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌​‌