EDITED
my goal :
get “total” list of IP’s connected to port 80 in windows server.
TOTAL IP's
5 1.1.1.1
12 2.2.2.2
1 3.3.3.3
in centos, i found this
netstat -tn 2>/dev/null | grep :80 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head
but if windows server, is there any way do that using powershell or cmd?
*i get one example but its not reaching my goal :
netstat -n | find "80"
credit for example : https://mkyong.com/linux/list-all-ip-addresses-connected-to-your-server/
2
Answers
Get-NetTCPConnection
is the PowerShell equivalent and creates a robust object you can filter to your needs.In your example, you’re getting all connections to port 80 on your device, here’s what that looks like in PowerShell:
If you wanted to gather just the remote IP addresses, for instance:
If you need to group them to see how many sessions per IP, you can pipe into the
Group-Object
cmdlet like so:One quick and dirty way to find TCP sessions connected to port 80 is
You would obtain output similar to the following: