Dailydave mailing list archives

Re: DNS Speculation


From: marc_bevand () rapid7 com
Date: Mon, 28 Jul 2008 09:45:33 -0700

Philippe Biondi <phil () secdev org> wrote on 07/26/2008 01:00:57 PM:

Did you do something like:

for i in range(500):
     send(pkt)
or
while True:
     send(pkt)

In this case the "optimised" way to do it would be (resp.) :

send(pkt*500)

Passing a list of packets to send() was the first optimization I tried.
But it was still too slow.

At last resort, you have the sendpfast() function which Bryan
spoke about.

I didn't try sendpfast(), but, yes, according to Bryan this seems to
be the solution.

Or did the problem was that the time between creating the packet and 
having it hit the wire is too big because most of the initialisation 
done by send() could have been done before ?

In this case, the way to do it would be to avoid send()'
high-levelness and directly use scapy layer 3 socket:

s = conf.L3socket()
while True:
   ** do stuff, create pkt **
   s.send(pkt)

This is the 2nd optimization I tried, and the fastest scapy exploit I
could come up with. But even when stracing it, I could see extra system
calls being called between the sendto(). IIRC this 2nd optimization
allowed me to send packets at a rate about 2 or 3 times faster than my
first Python version, but it was still about twice as slow as my C
implementation.

In any cases, I'm interested by feedback on improvements this could 
provide.

I think sendpfast() is a good solution for this case.

-marc
_______________________________________________
Dailydave mailing list
Dailydave () lists immunitysec com
http://lists.immunitysec.com/mailman/listinfo/dailydave


Current thread: