Nmap Development mailing list archives
Re: Nsock unconnected sockets
From: David Fifield <david () bamsoftware com>
Date: Tue, 5 Oct 2010 16:37:54 -0700
On Mon, Oct 04, 2010 at 11:01:50PM -0500, Kris Katterjohn wrote:
On 10/04/2010 10:18 PM, David Fifield wrote:On Mon, Oct 04, 2010 at 09:17:07PM -0500, Kris Katterjohn wrote:Well, given that scripts shouldn't be connecting multiple times (which leads me to believe there should be one connect() for each new_socket()), then a possibility is this: s = nmap.new_socket(<protocol>, <optional family>) s:connect(host, port) -- remove/deprecate protocol argThis has a little bit of a problem, though, which is the address family. Currently you can do s = nmap.new_socket() s:connect("::1", 80) and it will work fine. If OS socket creation always happens when new_socket is called, then it becomes necessary to declare the address family in advance (even if implicit). Consider that someone may give an address in a script argument--then it becomes necessary to analyze its address family before calling new_socket.Ah, good point! But isn't this also a problem with setup/sendto if you send to a user-given address?
Yes, you're right.
Another thing to consider is that at least one function, bind, needs to be called before the socket is connected.Sorry, but I'm not sure how this would be an issue. new_socket("tcp") bind("192.168.10.69", 31337) connect("192.168.10.1", 80) and new_socket("udp") bind("192.168.10.69", 31337) sendto("192.168.10.1", 53, "stuff") How would these not work? I suspect something may have to be moved around, but are these really not possible?
You're right, this is a better interface. I'll see what's needed to make it work. David Fifield _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Nsock unconnected sockets David Fifield (Oct 03)
- Re: Nsock unconnected sockets Kris Katterjohn (Oct 03)
- Re: Nsock unconnected sockets David Fifield (Oct 04)
- Re: Nsock unconnected sockets Kris Katterjohn (Oct 04)
- Re: Nsock unconnected sockets David Fifield (Oct 04)
- Re: Nsock unconnected sockets Kris Katterjohn (Oct 04)
- Re: Nsock unconnected sockets David Fifield (Oct 05)
- Re: Nsock unconnected sockets David Fifield (Oct 09)
- Re: Nsock unconnected sockets Kris Katterjohn (Oct 10)
- Re: Nsock unconnected sockets Ron (Oct 14)
- Re: Nsock unconnected sockets David Fifield (Oct 15)
- Re: Nsock unconnected sockets Patrik Karlsson (Oct 15)
- Re: Nsock unconnected sockets David Fifield (Oct 04)
- Re: Nsock unconnected sockets Kris Katterjohn (Oct 03)