How to(do I) write a network data consumption monitoring program that monitors all system processes and has control over them?


How do I write a program that alerts me when any app connects to the internet on Android or Windows?

My problem is my data subscription is getting drained. I don't know what apps are sucking it.

I can write a Hello World in any language, and I do understand OOP, databases, and the software development life cycle. However, I have no knowledge of networking in general.

I don't want to become a network administrator, but i want to be able to write networking applications that can do what I want to protect my systems.

I have tried many software, but they are either too complex or they just don't do what i want! How do I write networking software that controls my data usage, blocks apps from connecting to other systems/internet, and alerts me when connections are made to and from?

What programming libraries and frameworks do I use? What do I learn? I have used C++ before, but that was a long time ago.

Please consider me a 10-year-old interested in developing networking software for my own use.

 

Thanks for your time.

0
Mar 24 at 5:11 AM
User AvatarAgaba Akuh
#android#linux#windows#network-programming#system

Accepted Answer

Typically using router level metering is your best bet practically for narrowing down on what is causing the most traffic. Something like a pi-hole setup for your DNS on the router level to apply to all devices can help to see which machines are doing the most DNS requests and therefore creating the most traffic most likely but is just looking at DNS itself there not all traffic/bandwidth.

To observe/monitor all the packets you can use something like wireshark, it is a bit complicated to use since you do need to understand some networking terminology to properly filter the packets/traffic to see what you're looking for and isn't meant as a metrics tool really more-so packet level inspection.

EtherApe is a nice little GUI for visualizing overall traffic on a given network interface but would require you to basically use a machine as the router/man-in-the-middle so all the traffic can be monitored from one interface for this to be really useful for broader diagnostics. It is open source so you could take a look at the source code https://etherape.sourceforge.io/

About writing your own networking software, as much as I'm not a big fan of Python it does make working with sockets pretty straight-forward at least for simple cases but would broadly be looking for "proxy" projects written in languages you are familiar with for examples of real world code or look up tutorials on how to build a web server in X or how to build simple chat system with X language and can usually learn how to setup/teardown socket connections and pipe data across the wire.

Also there is this n-top system for network metrics gathering but is not trivial to setup either but they do have a "community edition" with source code available apparently so maybe worth looking at https://www.ntop.org/

User Avatarshaunhusain
Mar 24 at 5:47 AM
1