How to Find the Link Between a Program and a Port
If you're using Linux, some (many?) distributions have a -p flag for their netstat program. BSD users are not so lucky. Fortunately, we have lsof.
Actually, anybody can have lsof. It is not a part of the default OpenBSD install, but can easily be installed as a binary package with the pkg_add program.
Just type:
$ sudo lsof | grep LISTEN
Your output will look like this:
python2.3 5196 root 5u IPv4 0xd20d2af0 0t0 TCP *:6601 (LISTEN) tcpserver 5858 root 3u IPv4 0xd20d24b0 0t0 TCP *:www (LISTEN) sshd 7050 root 4u IPv6 0xd20d2000 0t0 TCP *:ssh (LISTEN) sshd 7050 root 5u IPv4 0xd20d2190 0t0 TCP *:ssh (LISTEN) tcpserver 22594 root 3u IPv4 0xd20d27d0 0t0 TCP *:imaps (LISTEN)
And you can then pair the open port with the program that is on that port.
No comments:
Post a Comment