Please read the documentation. This is a way to add unit testing to NSE
libraries (not scripts, yet). Please add tests to your libraries!
Examples to come in further commits.
Instead of erroring, just use tostring to handle functions, userdata,
etc. This works for booleans and numbers, too, so no need for special
handling there.
Also switched from a string-concatenation model to a table-building one,
with a final concatenation. This could prevent catastrophic slowness
with representing large tables due to continuous reallocation of
strings.
Just run "sh checklibs.sh". Currently checks liblua, libpcre, libpcap,
and prints the latest version of liblinear (no version info is in the
copy we have). Requires perl, curl, and a C compiler (cc).
Classes that inherit __hash__ and comparison functions like __eq__ (e.g.
from object) but only override one of them will break under Python 3.
This is because a class shouldn't use one criterion for equality and a
different one for hashing. Explicitly discarding the inherited __hash__
method disables this warning and makes the class unhashable (not a
problem in this case).
d33tah noticed that the # in "Fingerprint OpenBSD 5.0 GENERIC#43 i386"
was being interpreted as a comment, resulting in matches for "OpenBSD
5.0 GENERIC". Looking at this, it appears that no other OS fingerprints
put the build number in the Fingerprint line, and this fingerprint
closely matches another OpenBSD 5.0 fingerprint. Changed to drop
everything after GENERIC.
CPPFLAGS is for the C Pre-Processor, and should be used for -I flags. In
a couple cases (nping, nmap) this was resulting in duplicate -Ilibpcap
arguments.
IP ID is an unsigned value. Explicit wrapping checks were needed to
support using a signed int, and a few users were reporting compile
errors because of a large constant:
http://seclists.org/nmap-dev/2013/q4/247
Although $((arithmetic expansion)) is POSIX-specified, some systems have
non-POSIX System V shell, which can't handle it. This patch replaces
$((something)) with $(expr something) to fix compatibility. This
actually slows things down considerably, since a subshell must be
launched for each increment operation, but the tests aren't that
critical. Bug report: http://seclists.org/nmap-dev/2013/q4/198
An off-by-one error meant that we tried 65 at a time. The number 64 came
up in a discussion of limitations of running against IIS.
http://seclists.org/nmap-dev/2012/q3/167