Nmap Development mailing list archives

Re: Two NSE questions


From: David Fifield <david () bamsoftware com>
Date: Wed, 30 Sep 2009 21:13:52 -0600

On Tue, Sep 29, 2009 at 03:33:34PM -0500, Ron wrote:
On 09/29/2009 03:24 PM, David Fifield wrote:
Ron, if you propose an interface for setting the source address I'll
look into writing the binding. Just show me a snippet of your code as it
would work with the new function, and any other cases you think need to
be handled.

I'm not particularly picky with how it should work, but the most logical  
(to me) would be to change the connect() function from this:

connect(hostid, port, protocol)

To this:

connect(hostid, port, protocol, lhostid, lport)

I'm not sure if setting the local address makes sense, but setting the  
local port in a connect call would be ideal. Another option would be:

local socket = nmap.new_socket()
set_local_port(socket, 67)
connect(host, 68, 'udp')
...

That's a little uglier, in my mind, but it is sufficiently usable.

Hmm, I like the second option because it's like the way to set a
timeout. I also think of a source address as a property of a socket, not
of a connection. But I think I would make it a method of a socket
object, like this:

local socket = nmap.new_socket()
socket:set_local_port(67)
connect(host, 68, 'udp')

David Fifield

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


Current thread: