Read data traffic on Raspberry?
I have a hotspot on my Raspberry Pi and would like to read the data traffic of a connected device (192.168.4.13). I also have the MAC address. I've tried absolutely everything and can't seem to write this simple JS script that prints the data (rx and tx) to the console in MB/s. Does anyone know of a tool for this? Thanks in advance!
with the iptraf you can display all connections and the bandwidth you use.
or create a iptables rule in the mangle table for the IP address and then display the total traffic since creating the rule. If you call this regularly, you could calculate the bandwidth you use with some Grep and some calculation.
Thank you. I didn’t come any further with iptables, but I’m gonna look at that.
absolute overkill solution would be this: https://www.ntop.org/products/traffic-analysis/ntop/
What do you mean with js?
Oh that was the wrong…
does not have anything to do with my answers and simply reads out the entire network traffic of the wlan interface, but okay if it suits you.
So this: https://pastebin.com/2JUS6R3G
I’m just not a fan of Python. Basically, I use for all Kotlin, but for the project(which is also more complex) Javascript.
very beautiful, iptraf is of course the simplest, ntop is more complicated and is intended for a long-term and detailed analysis of network traffic.
what do you want with javascript on a Linux Console? Most smaller script stuff you can do with bash and the existing GNU tools and for more complex, more extensive things I take python.
Thank you. that works perfectly! I just know how I can thank you… have been trying around here for 3 hours.
If someone out here needs the same, here the code: https://pastebin.com/2JUS6R3G
Probably iptraf, that looks easier.
I mean Javascript. Of the two you proposed now, what would you take?