I know there are tools to inspect packets (e.g. wireshark) or to simulate latency/packet loss (e.g. netem), but they all seem to require administrative permissions to inspect/modify packets.
I'm looking for something which could intercept packets for a single application and be usable by a standard (non-root) user.
I'd like some kind of valgrind
tool for network, where you use it to wrap your application and it intercepts network requests to inspect/modify them.
My main use case is to enable students to use such tools on university computers in a simple way (i.e. without needing virtual machines or support from the administrators).
Do such tools exist? Otherwise, what prevents them from actually existing in the first place?
Note: tools such as setcap
, which need to be configured by system administrators and may grant too many powers to the users (e.g. inspecting every packet, and not just the ones generated by their applications) aren't suitable.
Edit: OK, so after some research, I found out about the LD_PRELOAD trick, which could be used as a poor man's wrapper to intercept specific library functions (e.g. connect
, sendto
, etc.) and count/modify packets. Apparently the reason why there are not so many non-root tools based on this is because:
- it's not useful for security purposes (it can be easily circumvented), and
- most people during useful things with network already need root access anyway, so outside very specific applications tailored for learning, there is no real demand.
But this is technically feasible, in case any curious students are willing to develop such applications themselves.
Another technique would be to code a valgrind plug-in to deal with this and use valgrind to run the program. But it seems way overkill, so no sane people have done it.
Could someone more knowledgeable than me just confirm if my previous statements are correct?