listeners icon indicating copy to clipboard operation
listeners copied to clipboard

Feature Requests: Support for UDP protocol and also details on network connections.

Open puffyCid opened this issue 1 year ago • 8 comments

Hey thanks for creating this really cool library!

In the README its mention that it supports TCP only. Is it feasible to include UDP as well?

In addition, currently it only includes processes that are listening on a port. Is it feasible to include all network connections, both listening and estblashied?
Similar to the netstat output below

Proto   Local Address          Foreign Address        (state)
tcp  10.123.123.123:54459   185.199.108.133:443    ESTABLISHED
tcp  10.123.123.123:54458   185.199.109.154:443    ESTABLISHED
tcp  127.0.0.1.8384          *.*                   LISTEN
udp  *.56612                 *.*

Feature Request Summary

  • Support for UDP protocol
  • Include details on all network connections

If these requests are out of scope, no worries. Feel free to close the issue Let me know if additional info is required.

Thanks!

puffyCid avatar May 18 '24 15:05 puffyCid

Is it feasible to include UDP as well? ... In addition, currently it only includes processes that are listening on a port. Is it feasible to include all network connections, both listening and estblashied?

Yes, it is feasible. However, at the moment just TCP is included since UDP is connectionless and the concept of listener doesn't really apply. And as the name of the library suggests, only connections in the listen state are reported (this is on purpose). However, I could consider extending the scope of this library in the future.

I'll leave this issue open as a reminder, thanks 🙌

GyulyVGC avatar May 21 '24 08:05 GyulyVGC

UDP is connectionless and the concept of listener doesn't really apply.

But UDP servers "listen" for packets, like DNS-servers listen on port 53, for example. Don't they?

Revertron avatar Oct 31 '24 22:10 Revertron

But UDP servers "listen" for packets, like DNS-servers listen on port 53, for example. Don't they?

UDP ports are either open or close, they don't have other possible states. So you could consider an open UDP port as "listening", but the concept is different since UDP just sends datagrams and doesn't establish connections.

GyulyVGC avatar Oct 31 '24 22:10 GyulyVGC

Are you accepting contributions to this project? I believe you started this library to extend Sniffnet with PID. I was thinking of adding UID to Sniffnet - I once did but it was not cross-platform - until I came across your library. This feature would be of great importance especially in the context of many users connected to the system - like servers. Of course, this feature - as well as UDP - would change the scope of this library.

islameehassan avatar Feb 03 '25 18:02 islameehassan

Hi @islameehassan

It would be awesome if you could help!

Yeah, I'm planning to use this library with Sniffnet in case it gets accurate enough. The criteria is to at least support Windows, Linux, and macOS.

From what I've learnt so far, the most difficult part is to get process names for all the connections we are monitoring in Sniffnet.

It's fine to change the scope of this library if we'll get a good solution to this problem, don't worry about that.

GyulyVGC avatar Feb 03 '25 20:02 GyulyVGC

@islameehassan a problem you'll probably face is that in general there is no process information available for most of the connections... this is why I was just focusing on the TCP in listen state. You'll notice that most of the connections established by Sniffnet are not there.

GyulyVGC avatar Feb 04 '25 08:02 GyulyVGC

@islameehassan a problem you'll probably face is that in general there is no process information available for most of the connections... this is why I was just focusing on the TCP in listen state. You'll notice that most of the connections established by Sniffnet are not there.

Yes, I noticed that. I modified the get_all example to run in an infinite loop to get all current and previous listeners, while at the same time running Sniffnet, setting the protocol filter to TCP. The difference was huge, which was apparent even without doing this experiment. But when I added SYN_SENT state (in tcp_listeners.rs in Linux), the difference largely decreased (compared to LISTEN only), and all connections got process information. Still, there were many connections in Sniffnet not shown by get_all.

islameehassan avatar Feb 04 '25 11:02 islameehassan

Thank you, I'm happy you had some progress at least.

GyulyVGC avatar Feb 04 '25 13:02 GyulyVGC