go-netstat icon indicating copy to clipboard operation
go-netstat copied to clipboard

Process.Name or Process.Pid can not be filtered

Open championwang2020 opened this issue 4 years ago • 2 comments

The following code will throw panic: "tabs, err := netstat.TCPSocks(func(s *netstat.SockTabEntry) bool { return s.Process.Pid == 6720 })" or "tabs, err := netstat.TCPSocks(func(s *netstat.SockTabEntry) bool { return s.Process.Pname == "chrome" })" panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x511799]

championwang2020 avatar Jun 07 '20 09:06 championwang2020

The following code will throw panic: "tabs, err := netstat.TCPSocks(func(s *netstat.SockTabEntry) bool { return s.Process.Pid == 6720 })" or "tabs, err := netstat.TCPSocks(func(s *netstat.SockTabEntry) bool { return s.Process.Pname == "chrome" })" panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x511799]

Same issue. Always throws panic when runs TCPsocks but not UDPsocks.

Rex0519 avatar Dec 16 '21 02:12 Rex0519

The following code will throw panic: "tabs, err := netstat.TCPSocks(func(s *netstat.SockTabEntry) bool { return s.Process.Pid == 6720 })" or "tabs, err := netstat.TCPSocks(func(s *netstat.SockTabEntry) bool { return s.Process.Pname == "chrome" })" panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x511799]

Same issue. Always throws panic when runs TCPsocks but not UDPsocks.

check https://github.com/cakturk/go-netstat/pull/13

zkscpqm avatar Jan 17 '22 17:01 zkscpqm