Nmap Development mailing list archives

Jacek's status report - #8 of 16


From: Jacek Wielemborek <wielemborekj1 () gmail com>
Date: Tue, 30 Jul 2013 01:04:14 +0200

Hi guys,

This is the report 8/16 for the Google Summer of Code project
“Bringing Lua to Ncat”.

This week I was mostly working in ncat-env-ncatins branch, where I
tried to add NCAT_OUTPUT_FD and NCAT_INPUT_FD variables that allow the
user to read and write to Ncat's standard input and output. It turned
out to be much harder than I expected, due to Windows - related
problems. On this OS there is basically no POSIX support and the list
of caveats is so long that I had to write many test cases and read a
lot of documentation to understand the concept of named pipes - and
yet I didn't manage to avoid all the traps, which made me debug the
weird behavior for long hours (and it doesn't seem to be done yet).
This is why I only added standard output support so far and I only
could do it in a way incompatible with the POSIX behavior. I managed
to do some other cool stuff though, so read on.

Achievements:

 * Merged in ncat-env-conninfo branch. There were a few small changes
to be made, but a day after my meeting with David, the code was
finally ready.

 * Wrote a fun tiny DNS server demo! Turns out that the --lua-exec
feature is actually way more powerful than I thought at first. The
demo server looks up its associative array of type A records and
responds to the queries. As it's currently just a proof of concept,
there's a lot of stuff hardcoded and very little error checking, but
it already works and is fun. I also tried to write a DHCP server, but
it turned out that Ncat doesn't handle broadcasting the way I wanted
and David suggested that I give up on that.

 * Came up with a promising solution for Ncat's standard input/output
passing to subprocesses. As Windows' anonymous pipes are basically a
joke (no support for non-blocking operations), I decided to pass
filenames of named pipes instead of file descriptors. There was no
non-hacky way to pass file descriptors ready to fdopen() anyway - you
can read up on the problem here:
http://stackoverflow.com/q/17846302/1091116

 * Started the implementation of the IPC based on named pipes. I
started with writing some prototypes, since I didn't exactly know how
they work and the MSDN documentation didn't seem to answer my
questions (though I have to admit it usually feels pretty detailed). I
discovered a weird programmer trap in Windows - environment variables
set using SetEnvironmentVariable aren't visible to the setting process
using getenv() - you have to use _putenv to achieve that.
GetEnvironmentVariable would return the variable in both cases, but in
order to expose it from the Lua level, I'd have to alter the core,
which I try to avoid.

* Wrote my first attempts at Ncat's --lua-exec documentation, meant
for the Ncat Users' Guide. At the moment it's two A4 pages long.

Priorities:

 * Figure out a way to implement NCAT_INPUT_FD on Windows (currently
experimenting with a caretaker thread approach, something like in
r31239). I'll probably also need to port lua_select, which I expect to
be really complicated.

 * In case I somehow managed to finish the ncat-env-ncatin, priorities
from the previous week are on the map:

        - sketch up a new plugin interface (David recently gave me a few
precious tips on that)
        - explore the socket abstractions
        - experiment with script stacking

Oh, by the way, I'll be away for most of this week - at least since
Thursday (quite likely Wednesday), coming back most likely late
Sunday. I mentioned this in my proposal and notified David earlier, so
I hope it's okay. I already did 24 hours of extra work during last two
weekends.

Yours,
Jacek Wielemborek
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: