Re: similar behaviour to Linux netstat -lpn ?

2012-04-04 Thread Tomas Bodzar
On Tue, Apr 3, 2012 at 4:21 PM, PP;QQ P(P8P?P8QP8P= chipits...@gmail.com 
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 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


 Cheers,
 Ilya Shipitsin



Re: similar behaviour to Linux netstat -lpn ?

2012-04-03 Thread Paul de Weerd
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
| tcp0  0 0.0.0.0:25  0.0.0.0:*
| LISTEN  411/master

SNIP

| is there similar things for OpenBSD ?

Try fstat(1):

[pweerd@office414] $ fstat | grep *:22
root sshd   113203* internet6 stream tcp 0xfe8126c99230 *:22
root sshd   113204* internet stream tcp 0xfe8126c99460 *:22

Good luck.

Paul 'WEiRD' de Weerd

-- 
[++-]+++.+++[---].+++[+
+++-].++[-]+.--.[-]
 http://www.weirdnet.nl/ 



Re: similar behaviour to Linux netstat -lpn ?

2012-04-03 Thread Theo de Raadt
 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
 tcp0  0 0.0.0.0:25  0.0.0.0:*
 LISTEN  411/master
 tcp0  0 0.0.0.0:445 0.0.0.0:*
 LISTEN  428/smbd
 tcp0  0 0.0.0.0:139 0.0.0.0:*
 LISTEN  428/smbd
 tcp0  0 0.0.0.0:111 0.0.0.0:*
 LISTEN  263/portmap
 tcp0  0 127.0.0.1:20209 0.0.0.0:*
 LISTEN  8547/dkim-filter
 tcp0  0 0.0.0.0:22  0.0.0.0:*
 LISTEN  343/sshd
 tcp6   0  0 :::22   :::*
 LISTEN  343/sshd
 udp0  0 0.0.0.0:111 0.0.0.0:*
 263/portmap
 udp0  0 0.0.0.0:37764   0.0.0.0:*
 8547/dkim-filter
 udp0  0 127.0.0.2:137   0.0.0.0:*
 421/nmbd
 udp0  0 192.168.7.21:1370.0.0.0:*
 421/nmbd
 udp0  0 0.0.0.0:137 0.0.0.0:*
 421/nmbd
 udp0  0 127.0.0.2:138   0.0.0.0:*
 421/nmbd
 udp0  0 192.168.7.21:1380.0.0.0:*
 421/nmbd
 udp0  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.