Re: Measuring bytes of packet sent from python application

2009-01-09 Thread Jonathan Gardner
On Jan 5, 6:08 pm, Grant Edwards wrote: > On 2009-01-05, Kangkook Jee wrote: > > I'm still struggling to solve it within python process since > > it looks cleaner but it doesn't seems to be easy at all. > > I don't why adding bunches of code to your app would be > "cleaner" than gathering data us

Re: Measuring bytes of packet sent from python application

2009-01-05 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Kangkook Jee wrote: > That seems like a good solution for my issue but how can I distinguish > traffics from my application to others? I use nethogs on Ubuntu. If you use Intrepid, you can press 'm' to make it change amongst different displays (eg cu

Re: Measuring bytes of packet sent from python application

2009-01-05 Thread alex goretoy
You can alot run "lsof -i -T -n" from popen2 to see what applications use what port and addr they are connected to. In order to see all jobs though it needs to be ran as root. This way you can find out what ports and such Then perform tcp dump thru popen2 and filter for port and addr. This is just

Re: Measuring bytes of packet sent from python application

2009-01-05 Thread Grant Edwards
On 2009-01-05, Kangkook Jee wrote: > I'd like to measure number of bytes sent(or recv'd) from my > python application. Does anyone have any idea how can I > achieve this? Aside from tcpdump/wireshark, you can set up iptables rules to enable accounting for traffic based on IP addresses and ports.

Re: Measuring bytes of packet sent from python application

2009-01-05 Thread Grant Edwards
On 2009-01-05, Kangkook Jee wrote: > Jonathan Gardner wrote: >> On Jan 5, 2:26 pm, Kangkook Jee wrote: >>> I'd like to measure number of bytes sent(or recv'd) from my python >>> application. Does anyone have any idea how can I achieve this? >>> >>> I tried to do this by tracing some socket calls

Re: Measuring bytes of packet sent from python application

2009-01-05 Thread Grant Edwards
On 2009-01-05, Jonathan Gardner wrote: > On Jan 5, 2:26 pm, Kangkook Jee wrote: >> >> I'd like to measure number of bytes sent(or recv'd) from my >> python application. Does anyone have any idea how can I >> achieve this? >> >> I tried to do this by tracing some socket calls (send, sendto, >> sen

Re: Measuring bytes of packet sent from python application

2009-01-05 Thread Steven D'Aprano
On Mon, 05 Jan 2009 18:23:10 -0500, Kangkook Jee wrote: > Jonathan Gardner wrote: >> On Jan 5, 2:26 pm, Kangkook Jee wrote: >>> I'd like to measure number of bytes sent(or recv'd) from my python >>> application. Does anyone have any idea how can I achieve this? >>> >>> I tried to do this by traci

Re: Measuring bytes of packet sent from python application

2009-01-05 Thread alex goretoy
Have you looked into scapy? www.secdev.org/projects/*scapy*/ There's another one, it comes with python I think. Can't seem to remember the name. I may be mistaken though. -Alex Goretoy http://www.alexgoretoy.com somebodywhoca...@gmail.com On Mon, Jan 5, 2009 at 11:23 PM, Kangkook Jee wrote:

Re: Measuring bytes of packet sent from python application

2009-01-05 Thread James Mills
On Tue, Jan 6, 2009 at 8:26 AM, Kangkook Jee wrote: > I'd like to measure number of bytes sent(or recv'd) from my python > application. Does anyone have any idea how can I achieve this? > > I tried to do this by tracing some socket calls (send, sendto, sendAll) > using 'metaclass' but I could fin

Re: Measuring bytes of packet sent from python application

2009-01-05 Thread Jonathan Gardner
On Jan 5, 3:23 pm, Kangkook Jee wrote: > Jonathan Gardner wrote: > > A good universal tool on the Linux platform is tcpdump. It takes some > > learning, but is very useful for this kind of task. You can use a tool > > like ethereal to visualize the data that tcpdump gathers. > > That seems like a

Re: Measuring bytes of packet sent from python application

2009-01-05 Thread Kangkook Jee
Jonathan Gardner wrote: On Jan 5, 2:26 pm, Kangkook Jee wrote: I'd like to measure number of bytes sent(or recv'd) from my python application. Does anyone have any idea how can I achieve this? I tried to do this by tracing some socket calls (send, sendto, sendAll) using 'metaclass' but I cou

Re: Measuring bytes of packet sent from python application

2009-01-05 Thread Jonathan Gardner
On Jan 5, 2:26 pm, Kangkook Jee wrote: > I'd like to measure number of bytes sent(or recv'd) from my python > application. Does anyone have any idea how can I achieve this? > > I tried to do this by tracing some socket calls (send, sendto, sendAll) >   using 'metaclass' but I could find exactly pl

Measuring bytes of packet sent from python application

2009-01-05 Thread Kangkook Jee
Hi, all I'd like to measure number of bytes sent(or recv'd) from my python application. Does anyone have any idea how can I achieve this? I tried to do this by tracing some socket calls (send, sendto, sendAll) using 'metaclass' but I could find exactly place that I can put this in. My appli