digitalbond/Redpoint — pull request #5 by jeffmeden (2014-08-07 15:08:59+00:00)
Title: add BBMD list to scan results

This is probably the ugliest LUA possible... I am new to nse programming
so please be kind :-) I didn't try to work within the existing
standard_query function because it is laid out for get-property data in
the APDU, but the BBMD table list is returned as part of the BVLC. I
did borrow the standard-query function layout, and tried to adhere to
the same methodology so the script is somewhat consistent. I am sure
there is a much more elegant way to do the unpacking, but I don't know
enough Lua yet.

I called the function bbmd_query but it is more appropriately called bvlc_query if there
are other bvlc-level requests we are interested in cataloging. If not, it might be appropriate
to clean up the process and merge the function with standard_query. I didnt start within the
standard_query since the bbmd list is a block of encoded IPs, not a string, so the decoding
is quite a bit different.

I tested it with Nmap 6.46 on Windows x64 and Debian x64 against hosts
with 0 bbmd, 1 bbmd and >1 bbmd. I left what is probably an excessive
amount of debug lines in place, as I am sure I will be testing/improving
it in the near future. Please please please give feedback.