voir quels ports sont utilisés
Get-Process -Id (Get-NetTCPConnection -LocalPort portNumber).OwningProcess
Frantic Fish
Get-Process -Id (Get-NetTCPConnection -LocalPort portNumber).OwningProcess
#With nmap:
nmap -p- "0.0.0.0"
# check each service:
sudo lsof -i -P | grep LISTEN | grep $PORT_NUMBER
import socketserver
with socketserver.TCPServer(("localhost", 0), None) as s:
free_port = s.server_address[1]