[Twisted-Python] twisted linux netfilter_log protocol

2013-10-01 Thread David Stainton
Hi, I am wondering how I should combine various twisted interfaces in a way that makes sense. It probably shows here... that I'm new to twisted. The Linux iptables can log packets to the netfilter_log which can give access to user space. I wrote a simple twisted Reader (IReadDescriptor implementa

[Twisted-Python] Conch - Why does one piece of code "fail" while another works

2013-10-01 Thread Donald Stufft
I have two pieces of code (see: https://gist.github.com/dstufft/9dc9978dc0af77e82f0c) one "works" (in that it fails verifying the host key like i'd expect) and one doesn't ("it never tries to verify the host key and just exists immediately). I don't understand *why* though, why does the connect

Re: [Twisted-Python] raw socket IWriteDescriptor

2013-10-01 Thread David Stainton
Oh I was having trouble because my fileno() method was not returning the correct descriptor. But I fixed it... Thanks for the excellent suggestion for improving performance! I've implemented that change. It works great! On Tue, Oct 1, 2013 at 5:38 AM, wrote: > On 07:30 am, dstainton...@gmail.

Re: [Twisted-Python] raw socket IWriteDescriptor

2013-10-01 Thread exarkun
On 07:30 am, dstainton...@gmail.com wrote: Hi, I'm trying to implement an IWriteDescriptor using raw sockets. So far this is what I wrote... but it doesn't work: https://github.com/david415/hushTCP/blob/master/hush_writer.py Am I doing something obviously wrong here? I certainly am able to use

Re: [Twisted-Python] raw socket IWriteDescriptor

2013-10-01 Thread Marco Giusti
On Tue, Oct 01, 2013 at 01:05:47AM -0700, David Stainton wrote: > I add the socket to the reactor in the constructor like this: > reactor.addWriter(self) > BTW is that OK? Or is it better to add it to the reactor outside of the > constructor? twisted.internet.stdio.StandardIO do that so it is not

Re: [Twisted-Python] raw socket IWriteDescriptor

2013-10-01 Thread Phil Mayers
On 01/10/13 09:05, David Stainton wrote: I just now realized that my fileno() method was incorrect. It now returns the descriptor instead of the python socket: return self.socket.fileno() I add the socket to the reactor in the constructor like this: reactor.addWriter(self) Oops sorry didn't s

Re: [Twisted-Python] AMP Argument.toBox's proto argument is a locator, not the proto?

2013-10-01 Thread Laurens Van Houtven
On Tue, Oct 1, 2013 at 12:59 AM, Glyph wrote: > Most of the code I can think of that wants to use that really wants the * > transport* rather than the "protocol", > Yes, but having the protocol would also immediately give you access to the transport, and, from what I understand in most cases of

Re: [Twisted-Python] raw socket IWriteDescriptor

2013-10-01 Thread David Stainton
I just now realized that my fileno() method was incorrect. It now returns the descriptor instead of the python socket: return self.socket.fileno() I add the socket to the reactor in the constructor like this: reactor.addWriter(self) BTW is that OK? Or is it better to add it to the reactor outside

Re: [Twisted-Python] raw socket IWriteDescriptor

2013-10-01 Thread Phil Mayers
On 10/01/2013 08:30 AM, David Stainton wrote: Hi, I'm trying to implement an IWriteDescriptor using raw sockets. So far this is what I wrote... but it doesn't work: https://github.com/david415/hushTCP/blob/master/hush_writer.py Am I doing something obviously wrong here? I don't see you tryin

[Twisted-Python] raw socket IWriteDescriptor

2013-10-01 Thread David Stainton
Hi, I'm trying to implement an IWriteDescriptor using raw sockets. So far this is what I wrote... but it doesn't work: https://github.com/david415/hushTCP/blob/master/hush_writer.py Am I doing something obviously wrong here? I certainly am able to use raw socket + scapy correctly without Twisted