Using the macports version, which is up-to-date, instead of the outdated
version included in the 10.5 SDK. As we update the minimum supported
version of OS X, that would improve, but not by much: 10.9 is still on
0.9.8y
Libpcap only needs libnl for monitor-mode sniffing. Disabling it lets us
not worry about which -lnl or -lnl-3 linker argument to include in our
own LIBS, so Nmap builds properly no matter whether libnl is present or
not.
Mostly just eliminating concatenation-reassignments by chaining
concatenations, reordering assignments to allow better use of bin.pack,
and using tables to store intermediate results before concatenating
them. Used strbuf as a quick fix in dhcp.lua. Eliminated some unused
string variables in vulns.lua.
Unnecessary, probably, but this eliminates 2 of 7 string
creations/collections due to concatenation and reassignment. Also
eliminates 2 unneeded table lookups and tests (since host always has
host.ip and port always has port.number), and eliminates 1 extra test
for prerule and postrule scripts, since we can't have a port if we don't
have a host.
A few bugs crept in during the conversion to LPEG parsing:
1. Unicode parsing of UTF-16 surrogate pairs returned an ending position
that was off by 2, so that the last 2 characters in the escape code were
parsed as literal characters.
2. Arrays and objects were not being tagged as such with make_array and
make_object during parsing.
This commit fixes these bugs, and returns to using unicode.utf8_enc for
UTF-8 encoding instead of a separately-defined function. Also, the tests
at the end (which were helpful in finding both of the bugs above) were
converted to unittest.lua tests.
Building a string with var = var .. "something" has miserable time
complexities. This commit cleans up a lot of that in scripts, focusing
on packing of data with bin.pack and concatenations within loops.
Additionally, a few instances were replaced with string.rep
psl_tree now takes an accumulator argument. It adds lines to the result
table instead of concatenating them together in a string. Then psl_print
concats all the lines together.
The charset argument was intended to be a table, since Lua doesn't allow
indexing strings with []. Unfortunately, irc-brute and tftp-enum passed
a string instead, which meant that the output was always the empty
string. This change allows both formats, and fixes those scripts.
irc-brute and tftp-enum had been broken since r33632 (no released
version of Nmap)
The message stating that an unknown -P* option was used contained
references to old, deprecated forms:
-PT (now -PA)
-PB (now -PE -PA)
-PI (now -PE)
Additionally, -PR was missing.
Entering nsock_loop() with the poll engine activated and no registered FD
(timers only, for instance) should not directly return, but sleep until next
timeout.
stdnse.debug writes the IP to messages so scripts don't have to.
A couple of functions no longer needed the target IP passed to them: their
signature and nsedoc were updated accordingly, along with any calls to them.
Also fix some white space.