Re: libpcap and python

2010-02-02 Thread gashero
On 2月1日, 下午8时47分, Mag Gam magaw...@gmail.com wrote:
 Hello All,

 I used tcpdump to capture data on my network. I would like to analyze
 the data using python -- currently using ethereal and wireshark.

 I would like to get certain type of packets (I can get the hex code
 for them), what is the best way to do this? Lets say I want to capture
 all events of `ping localhost`

 TIA

You need python module pypcap or pcapy to capture the packet, and
the you can use Python to analyze it.
To decode the internet packet you can use dpkt.

Good Luck!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: libpcap and python

2010-02-01 Thread Grant Edwards
On 2010-02-01, Mag Gam magaw...@gmail.com wrote:
 Hello All,

 I used tcpdump to capture data on my network. I would like to analyze
 the data using python -- currently using ethereal and wireshark.

 I would like to get certain type of packets (I can get the hex code
 for them), what is the best way to do this? Lets say I want to capture
 all events of `ping localhost`

http://www.google.com/search?q=python+pcap

-- 
Grant Edwards   grante Yow! My face is new, my
  at   license is expired, and I'm
   visi.comunder a doctor's care
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: libpcap and python

2010-02-01 Thread Terry Reedy

On 2/1/2010 7:47 AM, Mag Gam wrote:

Hello All,

I used tcpdump to capture data on my network. I would like to analyze
the data using python -- currently using ethereal and wireshark.

I would like to get certain type of packets (I can get the hex code
for them), what is the best way to do this? Lets say I want to capture
all events of `ping localhost`


The following is pretty straightforward.

def process(dump, wanted, func):
  for packet in dump:
if packet_type(packet) == wanted:
  func(packet)

Perhaps you can ask a more specific question.

Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list