Merhaba
bir windows sunucumda bir ip ye binlerce tcp connection geliyor fakat gelen normal ip lerde var, belirli bir sayının üzerinde connection yapan ip leri nasıl görebilirim netstat ile veya benzer tool ile ?
teşekkürler
binlerce connection
3
●126
- 29-07-2024, 15:14:21pws.exe
netstat -an | Select-String "TCP" | ForEach-Object { $ip = $_ -match "\s+(\d+\.\d+\.\d+\.\d+):\d+\s+" | Out-Null if ($ip) { $matches[1] } } | Group-Object | Where-Object {$_.Count -gt 100} | Sort-Object Count -Descending | Select-Object Count, Name-gt 100 sana 100 üzerinde connectionı olan ip'leri verir yerine istediğin rakamı yaz. - 31-07-2024, 22:16:16Çok teşekkür ederim desteğiniz için, bunu stat.ps1 adında bir dosya içine kaydettim çalıştırdım fakat bir sonuç vermedi,
Out-null kısmından dolayı mı acaba, gt değerini 1 yapsamda boş dönüyor.
teşekkürler
zihniates adlı üyeden alıntı: mesajı görüntüle - 02-08-2024, 17:27:19selam, powershell için şunu deneyebilirsin.djcenk adlı üyeden alıntı: mesajı görüntüle
$netstatOutput = netstat -an | Select-String "TCP" $ipConnections = @() foreach ($line in $netstatOutput) { if ($line -match "\s+(\d+\.\d+\.\d+\.\d+):\d+\s+") { $ipConnections += $matches[1] } } $groupedIPs = $ipConnections | Group-Object | Where-Object { $_.Count -gt 100 } | Sort-Object Count -Descending | Select-Object Count, Name $groupedIPs