python libpcap equivalent

Grant Edwards invalid at invalid
Tue Feb 3 17:30:34 EST 2009


On 2009-02-03, Gabriel <dunmer at dreams.sk> wrote:

> I need to write a software router [yes, software equivalent to
> hardware box that is routing packets .)]. It's a school work..

> Question is: is possible write this kind of application in
> python?

Hmm.  It's going to be rather difficult, but you might be able
to.

> and if it's, what module should i use? I tried search for some
> libpcap equivalent in python and found pylibpcap, but can't
> find documentation and tutorial.

You can use pylibpcap to capture packets, and then use a raw
socket to send them out again on whatever interface you want.
You'll have to make sure that the host's OS's network stack
isn't going to process the packets at all.  I'm not sure how
you go about that.

The documentation for pylibpcap is built into the module. See
doc.i in the tarball.


-- 
Grant Edwards                   grante             Yow! I'd like some JUNK
                                  at               FOOD ... and then I want to
                               visi.com            be ALONE --



More information about the Python-list mailing list