View Full Version : python network traffic monitor program

October 1st, 2009, 11:45 AM
I am a python beginner and I want to build a simple network monitor program that monitors the traffic of a specific port for example port 80 or port 25. When there is an activity on that specific port, it should show the transfer rate of the sending and receiving packet. Can I just do this through the /proc/net/ files, or do i need a library like pcap to do this?


October 1st, 2009, 01:01 PM
Ok, i havent been able to find any code, but if you look in the python documentation on the python website, you can find all sorts of things on http requesting and FTP monitoring, i suspect there is something about port listening in their somewhere.

October 1st, 2009, 08:43 PM
I couldn't find what you ask me to look for but I managed to find that I can monitor the overall bandwidth of incoming packets by calculating the bytes received in the /proc/net/dev file on an interface like (eth1). But I still don't know how to get the bandwidth on a specified port only. Any help would be appreciated. Thanks.