Nmap Development 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 [1] 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[0] == 0xDE and ((tcp[tcpflags] & tcp-fin) != 0) " )


    -- go back to the event loop for a while
                    pcap:set_timeout(XXX) -- XXXms
                    pcap:pcap_register('aaa')
                    _, _, _, _, _ = 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?

[1]
http://ai.pjwstk.edu.pl/~majek/dump/os.nse (see fingerprints_match)

Cheers!
  Marek Majkowski

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: