Lua 5.3 adds several awesome features of particular interest to nmap including
bitwise operators and integers, a utf8 library, and standard binary pack/unpack
functions.
In addition to adding Lua 5.3, this branch changes:
o Complete removal of the NSE bit library (in C), It has been replaced with
a new Lua library wrapping Lua 5.3's bit-wise operators.
o Complete removal of the NSE bin library (in C). It has been replaced with a
new Lua library wrapping Lua 5.3's string.pack|unpack functions.
o The bin.pack "B" format specifier (which has never worked correctly) is
unimplemented. All scripts/libraries which use it have been updated. Most
usage of this option was to allow string based bit-wise operations which are no
longer necessary now that Lua 5.3 provides integers and bit-wise operators.
o The base32/base64 libraries have been reimplemented using Lua 5.3's new
bitwise operators. (This library was the main user of the bin.pack "B" format
specifier.)
o A new "bits" library has been added for common bit hacks. Currently only has
a reverse function.
Thanks to David Fifield, Daniel Miller, Jacek Wielemborek, and Paulino
Calderon for testing this branch.
The formats has been tested and verified on Mac OS X 10.8.5,
Mac OS X 10.11.5 and Ubuntu 14.04 LTS, all on x86_64 machines
and OSs. It mainly silences warnings. There were no warnings on
Ubuntu but a few on Mac OS, so the fix is intended to silence
warnings on Mac OS whithout triggering new warnings on other OSs.
Example of warnings previously encountered:
netutil.cc:2828:74: warning: format specifies type 'unsigned short'
but the argument has type 'int' [-Wformat]
Since the functions were hidden for the comiler, I specified every
function that was being hidden in the IPv*Header.h header files.
This allows us to use both overloaded functions and the original one
instead of having one being hidden by the others.
Here is the compiler warning output before the fix:
warning: 'file::function' hides overloaded virtual function
note: hidden overloaded virtual function 'file2::function' declared
here: different qualifiers
Here, the sizeof() function return the size of 'char *' instead of
INTF_NAME_LEN. I replaced the use of the latter function by INTF_NAME_LEN
(maximum size of the array intf_name). Here is the compiler warning output:
route-bsd.c:171:38: warning: sizeof on array function parameter will return
size of 'char *' instead of 'char [16]' [-Wsizeof-array-argument]
strlcpy(intf_name, namebuf, sizeof(intf_name));
Excellent discussion of the issues with RAND_pseudo_bytes here:
https://jbp.io/2014/01/16/openssl-rand-api/
Essentially, RAND_pseudo_bytes is the same function as RAND_bytes,
except with worse documentation and broken implementations in some
cases.
15:13: E126 continuation line over-indented for hanging indent
16:13: E126 continuation line over-indented for hanging indent
17:13: E126 continuation line over-indented for hanging indent
clang 3.4.1 on FreeBSD gave this warning:
nmap.cc:3064:48: warning: use of logical '||' with constant operand
[-Wconstant-logical-operand]
return file_is_readable(filename_returned) || 1;
nmap.cc:3064:48: note: use '|' for a bitwise operation
Changed to match the intent: return 1 if file_is_readable returns 0, otherwise
return that non-0 value.
This commit is intended to use mardown files for documentation.
I added a Table of content in each file, with interactive/internal links
and a few more explanations for Mac developers.