mailing list archives
Re: [NSE] WHOIS - Attempts to queue coroutines to limit the number of whois queries.
From: majek04 <majek04+nmap-dev () gmail com>
Date: Wed, 9 Apr 2008 03:32:52 +0200
On Fri, Feb 15, 2008 at 3:54 AM, jah <jah () zadkiel plus com> wrote:
My problem is; how to make a coroutine wait?
In os.nse  I use this solution, based on pcap (raw sockets):
-- hack used only to go back to event loop
local pcap = nmap.new_socket()
function pcap_callback() return 'xxx' end
pcap:pcap_open(interface, 64, 0, pcap_callback,
"tcp == 0xDE and ((tcp[tcpflags] & tcp-fin) != 0) " )
-- go back to the event loop for a while
pcap:set_timeout(XXX) -- XXXms
_, _, _, _, _ = pcap:pcap_receive()
I'm going to go and do some reading about how to utilise raw packet
network I/O and see if I can get any success there, but I should be most
grateful for any predictions as to its usefulness, in this context, in
the meantime. If anyone has any thoughts on how I might bend coroutines
to my will without having to do something to the API (which I'm not
currently qualified to attempt - although I am learning C/C++ and should
be so qualified sometime in 2012) then I'd love to hear those thoughts.
But we really should create something more standard, like nmap.sleep().
Maybe it's a good idea for SoC?
http://ai.pjwstk.edu.pl/~majek/dump/os.nse (see fingerprints_match)
Sent through the nmap-dev mailing list
Archived at http://SecLists.Org