Nmap Development mailing list archives

Re: ncat broadcast support?


From: Daniel Miller <bonsaiviking () gmail com>
Date: Fri, 14 May 2010 11:52:31 -0500

Compiled this on Win32 (Microsoft Visual C++ 2010 Express). It wouldn't build at first, due to some linker errors and a whole slew of error constants referenced in a system include file not being defined (I ended up copy-and-pasting the definitions from elsewhere. Not pretty, and not correct, but it shouldn't have affected this, since the constants weren't referenced anywhere else).

Oddly, though, I had success sending broadcast messages both with and without the new --broadcast flag on Windows! Can anyone confirm with an unpatched build that this works? Maybe Windows sockets don't need SO_BROADCAST set? I just don't know enough about it.

Dan

On 05/13/2010 05:19 PM, Daniel Miller wrote:
On 05/13/2010 03:32 PM, Daniel Miller wrote:
On 05/12/2010 05:53 PM, Fyodor wrote:
My initial thought is that maybe we should have a function like
nsp_setbroadcast() which specifies whether, from that point on, all
newly created sockets should have SO_BROADCAST set.  I suppose it
should probably default to false, just like in the socket API.  But I
imagine that Ncat, Nping, and Nmap may want to enable this.  Ncrack,
on the other hand, may not.

The change would have to tested on Windows and UNIX.  If you really
can't get access to a Windows system, you may be able to recruit
testers on this list.

So I'd encourage you to write a patch, and I definitely encourage
other folks to chime in if they know stuff about SO_BROADCAST that we
don't, or if they have any other implementation ideas or concerns.

Cheers,
-F

This is the suggestion that I took. I have attached the patch, which appears to work well. I'll continue to test, and I'll see if I can try it on Windows, though I haven't compiled Nmap on Windows before. Anyone who would like to test this out would be more than welcome.

Dan
Found a couple errors while trying to compile on Windows (no prototype for nsp_setbroadcast, cast to void * instead of const char * in setsockopt call). Fixed patch attached.

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


Current thread: