Mark wrote:
> Hi all,
> 
> Is there some code somewhere (library/script) that I can look at
> that will help with the following:
> 
> I would like to monitor *all* traffic along the lines of
> http://www.bwmonitor.com/ on whatever network(s) is/are active at the
> time. Wireless and/or Ethernet.
> 
> Is there a way to monitor traffic in general moving across say wlan0
> rather than specific protocols/ports (HTTP, FTP, etc)?
> 
> A Ruby solution would be good but Java/Python/Perl/ would be OK as well.
> 
> (The pipe dream was that I was going to try to write something like this
> in all the languages above as a way to evaluate each of them).
> 
> (The even bigger pipe dream was that I could expand this to include a
> GUI and make it into an open source project eventually. Pretty much
> like 'Bandwidth Monitor' shown in the link above.)
> 
> 
> thanks,
>   
> 

There are literally hundreds of tools that do exactly that, many of them 
open source. However, as the saying goes, "With great power comes great 
responsibility."

1. You haven't specified what "all" means. Is it all the traffic in and 
out of one specific host, all the traffic in an enterprise, etc.? The 
more network segments you care about, the tougher the job becomes and 
the bigger the risks are.

2. There are, in addition to hundreds of tools, hundreds -- no, millions 
-- of privacy and security concerns associated with network monitoring.

A good place to start is with RRDTool, an open source package that runs 
on most platforms, including Windows, and has a Ruby binding.