Nmap Development mailing list archives

Ideas for Windows Ncat: --exec


From: David Fifield <david () bamsoftware com>
Date: Sun, 1 Mar 2009 19:46:55 -0700

o [Ncat] Wouldn't it be nice if we could support --exec (and maybe
  some sort of partial-emulated --sh-exec) on Windows?

I think at least --exec can be done, because that function doesn't need
the full generality of fork. Windows has a function called CreateProcess
that looks to be sufficient. It is even set up to redirect input and
output. One problem is that there is no recorded relationship between
the parent and the child, so the child will not be killed automatically
when the parent dies.

CreateProcess
http://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx
Creating a Child Process with Redirected Input and Output
http://msdn.microsoft.com/en-us/library/ms682499(VS.85).aspx

There is another family of functions called _spawn. I don't know if
these would be better or worse than CreateProcess. The _spawn*p
functions use the PATH to look up the program, which is a partial
emulation of --sh-exec.

_spawn, _wspawn Functions
http://msdn.microsoft.com/en-us/library/20y988d2(VS.71).aspx

Cygwin FAQ: How is fork() implemented?
http://cygwin.com/faq/faq-nochunks.html#faq.api.fork
"In most cases, you are better off using the spawn family of calls if
possible."

David Fifield

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


Current thread: