[Twisted-Python] RAW Sockets, IP in UDP

Hi all, I am new to this list, but I have some hopefully simple questions for you. I need to implement a listening RAW sockets which gives me all packets at that particular interface. Next, I need to put this data into a normal UDP container to send it to another host, where it is unpacked again. I am studying all the docs now, but any hints would be greatly appreciated! Thx in advance.

Hi, 2008/10/21 Lars Reimann <lars.reimann@googlemail.com>:
Low level packet handling part of Twisted (twisted.pair) isn't really usable for your use case and hasn't been updated for a quite a long time. As it comes to receiving and sending raw packets you have a few options to choose from.If you don't care about portability you can just use AF_PACKET socket from python's standard library which is supported only on linux.Otherwise you need to use one of many python libpcap wrappers like pypcap, pylibcap or python-pcapy.Not all of them support sending packets.If you choose one that doesn't you can always use python bindings for libdnet. After all that you still have to choose packet parsing/contruction library like dpkt, umit umpa or scapy. -- Kuba

On Tue, 2008-10-21 at 20:47 +0200, Lars Reimann wrote:
Hi Lars, I had similar issues with the twisted.pair code, so I wrote up my own implementation to do ICMP using Twisted. Grab this file: http://www.seafelt.com/software/sources/seafelt-backend_2.1.2-1.tar.gz extract it, and look at lib/seafelt/icmp.py for some code you might be able to use. -- Justin Warren <daedalus@eigenmagic.com>

Hi, 2008/10/21 Lars Reimann <lars.reimann@googlemail.com>:
Low level packet handling part of Twisted (twisted.pair) isn't really usable for your use case and hasn't been updated for a quite a long time. As it comes to receiving and sending raw packets you have a few options to choose from.If you don't care about portability you can just use AF_PACKET socket from python's standard library which is supported only on linux.Otherwise you need to use one of many python libpcap wrappers like pypcap, pylibcap or python-pcapy.Not all of them support sending packets.If you choose one that doesn't you can always use python bindings for libdnet. After all that you still have to choose packet parsing/contruction library like dpkt, umit umpa or scapy. -- Kuba

On Tue, 2008-10-21 at 20:47 +0200, Lars Reimann wrote:
Hi Lars, I had similar issues with the twisted.pair code, so I wrote up my own implementation to do ICMP using Twisted. Grab this file: http://www.seafelt.com/software/sources/seafelt-backend_2.1.2-1.tar.gz extract it, and look at lib/seafelt/icmp.py for some code you might be able to use. -- Justin Warren <daedalus@eigenmagic.com>
participants (3)
-
Justin Warren
-
Kuba Konczyk
-
Lars Reimann