Discussion:
similar behaviour to Linux "netstat -lpn" ?
Илья Шипицин
2012-04-03 14:21:08 UTC
Permalink
Hello!

I'd like to see every program (with program name) that listen something on
network. I can achive that on Linux by running "netstat -lpn", like that

server:~# netstat -lpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address
State PID/Program name
tcp 0 0 0.0.0.0:25 0.0.0.0:*
LISTEN 411/master
tcp 0 0 0.0.0.0:445 0.0.0.0:*
LISTEN 428/smbd
tcp 0 0 0.0.0.0:139 0.0.0.0:*
LISTEN 428/smbd
tcp 0 0 0.0.0.0:111 0.0.0.0:*
LISTEN 263/portmap
tcp 0 0 127.0.0.1:20209 0.0.0.0:*
LISTEN 8547/dkim-filter
tcp 0 0 0.0.0.0:22 0.0.0.0:*
LISTEN 343/sshd
tcp6 0 0 :::22 :::*
LISTEN 343/sshd
udp 0 0 0.0.0.0:111 0.0.0.0:*
263/portmap
udp 0 0 0.0.0.0:37764 0.0.0.0:*
8547/dkim-filter
udp 0 0 127.0.0.2:137 0.0.0.0:*
421/nmbd
udp 0 0 192.168.7.21:137 0.0.0.0:*
421/nmbd
udp 0 0 0.0.0.0:137 0.0.0.0:*
421/nmbd
udp 0 0 127.0.0.2:138 0.0.0.0:*
421/nmbd
udp 0 0 192.168.7.21:138 0.0.0.0:*
421/nmbd
udp 0 0 0.0.0.0:138 0.0.0.0:*
421/nmbd


is there similar things for OpenBSD ?

Cheers,
Ilya Shipitsin
Paul de Weerd
2012-04-03 14:45:21 UTC
Permalink
Hi Ilya,

On Tue, Apr 03, 2012 at 08:21:08PM +0600, ???? ??????? wrote:
| Hello!
|
| I'd like to see every program (with program name) that listen something on
| network. I can achive that on Linux by running "netstat -lpn", like that
|
| server:~# netstat -lpn
| Active Internet connections (only servers)
| Proto Recv-Q Send-Q Local Address Foreign Address
| State PID/Program name
| tcp 0 0 0.0.0.0:25 0.0.0.0:*
| LISTEN 411/master

<SNIP>

| is there similar things for OpenBSD ?

Try fstat(1):

[***@office414] $ fstat | grep *:22
root sshd 11320 3* internet6 stream tcp 0xfffffe8126c99230 *:22
root sshd 11320 4* internet stream tcp 0xfffffe8126c99460 *:22

Good luck.

Paul 'WEiRD' de Weerd
--
++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
http://www.weirdnet.nl/
Theo de Raadt
2012-04-03 16:07:26 UTC
Permalink
Post by Илья Шипицин
I'd like to see every program (with program name) that listen something on
network. I can achive that on Linux by running "netstat -lpn", like that
server:~# netstat -lpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address
State PID/Program name
tcp 0 0 0.0.0.0:25 0.0.0.0:*
LISTEN 411/master
tcp 0 0 0.0.0.0:445 0.0.0.0:*
LISTEN 428/smbd
tcp 0 0 0.0.0.0:139 0.0.0.0:*
LISTEN 428/smbd
tcp 0 0 0.0.0.0:111 0.0.0.0:*
LISTEN 263/portmap
tcp 0 0 127.0.0.1:20209 0.0.0.0:*
LISTEN 8547/dkim-filter
tcp 0 0 0.0.0.0:22 0.0.0.0:*
LISTEN 343/sshd
tcp6 0 0 :::22 :::*
LISTEN 343/sshd
udp 0 0 0.0.0.0:111 0.0.0.0:*
263/portmap
udp 0 0 0.0.0.0:37764 0.0.0.0:*
8547/dkim-filter
udp 0 0 127.0.0.2:137 0.0.0.0:*
421/nmbd
udp 0 0 192.168.7.21:137 0.0.0.0:*
421/nmbd
udp 0 0 0.0.0.0:137 0.0.0.0:*
421/nmbd
udp 0 0 127.0.0.2:138 0.0.0.0:*
421/nmbd
udp 0 0 192.168.7.21:138 0.0.0.0:*
421/nmbd
udp 0 0 0.0.0.0:138 0.0.0.0:*
421/nmbd
is there similar things for OpenBSD ?
You can find out the same if you use fstat and correlate the sockets.

We won't be adding more features to netsat to handle this though.
Tomas Bodzar
2012-04-04 07:50:28 UTC
Permalink
Post by Илья Шипицин
Hello!
I'd like to see every program (with program name) that listen something on
network. I can achive that on Linux by running "netstat -lpn", like that
server:~# netstat -lpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address B B B B B Foreign Address
State B B B PID/Program name
tcp B B B B 0 B B B 0 0.0.0.0:25 B B B B B B B 0.0.0.0:*
LISTEN B B B 411/master
tcp B B B B 0 B B B 0 0.0.0.0:445 B B B B B B 0.0.0.0:*
LISTEN B B B 428/smbd
tcp B B B B 0 B B B 0 0.0.0.0:139 B B B B B B 0.0.0.0:*
LISTEN B B B 428/smbd
tcp B B B B 0 B B B 0 0.0.0.0:111 B B B B B B 0.0.0.0:*
LISTEN B B B 263/portmap
tcp B B B B 0 B B B 0 127.0.0.1:20209 B B B B 0.0.0.0:*
LISTEN B B B 8547/dkim-filter
tcp B B B B 0 B B B 0 0.0.0.0:22 B B B B B B B 0.0.0.0:*
LISTEN B B B 343/sshd
tcp6 B B B 0 B B B 0 :::22 B B B B B B B B B :::*
LISTEN B B B 343/sshd
udp B B B B 0 B B B 0 0.0.0.0:111 B B B B B B 0.0.0.0:*
263/portmap
udp B B B B 0 B B B 0 0.0.0.0:37764 B B B B B 0.0.0.0:*
8547/dkim-filter
udp B B B B 0 B B B 0 127.0.0.2:137 B B B B B 0.0.0.0:*
421/nmbd
udp B B B B 0 B B B 0 192.168.7.21:137 B B B B 0.0.0.0:*
421/nmbd
udp B B B B 0 B B B 0 0.0.0.0:137 B B B B B B 0.0.0.0:*
421/nmbd
udp B B B B 0 B B B 0 127.0.0.2:138 B B B B B 0.0.0.0:*
421/nmbd
udp B B B B 0 B B B 0 192.168.7.21:138 B B B B 0.0.0.0:*
421/nmbd
udp B B B B 0 B B B 0 0.0.0.0:138 B B B B B B 0.0.0.0:*
421/nmbd
is there similar things for OpenBSD ?
http://www.feyrer.de/NetBSD/bx/blosxom.cgi/nb_20101002_2009.html
Post by Илья Шипицин
Cheers,
Ilya Shipitsin
Loading...