1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-08 05:31:31 +00:00
Commit Graph

79 Commits

Author SHA1 Message Date
batrick
165b58f3d3 minor improvements 2011-12-16 21:01:09 +00:00
patrik
2197116d18 o [NSE] Added support for forcing scripts to run agains certain ports by adding
a plus in front of the script name. [Martin Swende]
2011-12-16 20:37:46 +00:00
batrick
110b0d35b0 Fixed a bug I introduced in r23911 that caused some "rules" to not
mark a script as selected by name.
Removed some dead code.
2011-09-30 06:54:53 +00:00
batrick
8628520123 Change module separator to directory separator as is done in
Lua's ?.lua loader. This is necessary when requiring submodules
e.g. require "foo.bar"
2011-09-20 18:24:09 +00:00
batrick
6069b50ce3 Add loader for searching nselib/ for ?.lua files. nselib/ can be in multiple
directories that nmap will search, e.g. ~/.nmap/nselib $NMAPDIR/nselib
/usr/share/nmap/nselib etc.

Resolves Daniel Miller's request [1].

[1] http://seclists.org/nmap-dev/2011/q3/817
2011-09-20 16:18:35 +00:00
djalal
7d0df638ab o [NSE] When the rule function failes include its type in the error message. 2011-08-16 01:24:46 +00:00
djalal
39be3a4621 o [NSE] Use the correct variable 'value' instead of 'rule_return' to
show the error message of the rule function and why it has failed.
2011-08-16 01:22:01 +00:00
batrick
4d27d83f62 Fix to make SCRIPT_NAME not have a filename extension in certain situations.
See [1].

[1] http://seclists.org/nmap-dev/2011/q3/304
2011-07-21 18:26:11 +00:00
batrick
9d7ce06a96 better error message when script fails to load (now includes traceback of the script) 2011-07-21 17:46:16 +00:00
batrick
dc9a35bc9d New system for silent require errors. Use the new function
stdnse.silent_require. The Lua require function is back in its usual spot
(_G.require).
2011-06-13 23:38:35 +00:00
batrick
e37cfc5d0e moved some debug output where it made more sense
fixed some formatting
2011-06-13 22:59:30 +00:00
batrick
aa2f54ffa3 Originally, adding the script to the array of scripts would handle the case
where the Script.new failed:

    chosen_scripts[#chosen_scripts+1] = Script.new(path);

if Script.new returns nil, then the operation is a no-op (as intended). So,
just add the script to the array. Script.new now accepts a selected_by_name
argument so we don't set it manually.
2011-06-12 01:47:36 +00:00
batrick
a26f606ecd Just use srand on NSE startup in nse_main.cc. This removes the need
for a binding which will probably not be useful for script writers
when they have OpenSSL's PRNG already available.
2011-05-24 02:48:39 +00:00
batrick
3b83666a9c use a random number from /dev/urandom (nbase.get_random_uint wrapper) 2011-05-24 00:09:42 +00:00
batrick
5a68e5f04a Set the math.randomseed value in nse_main.lua on behalf of scripts.
Since Lua uses the C rand and srand functions, which have a static
seed for the entire program, we don't want scripts doing this themselves.
2011-05-23 21:43:46 +00:00
batrick
7f66646636 Patch to make require errors silent and removed evil workarounds.
Added new stdnse function stdnse.print_verbose (similar to print_debug).
2011-05-04 21:06:53 +00:00
david
a9a84873f9 Add a new cnse.fetchscript, which first checks for an absolute path,
then looks in the scripts subdirectory, then in the current directory.
cnse.fetchfile_absolute now checks for an absolute path, then calls
nmap_fetchfile if that fails (and no longer looks in scripts/). Use
cnse.fetchscript when accessing files that should be in the scripts
subdirectory.
2011-03-26 06:48:29 +00:00
david
b1e3114eca Move the "Script Pre-scanning", "Script scanning", and "Script
Post-scanning" messages to inside the run function, so they can be
printed only after we're sure we have at least one thread to run.
2011-02-01 18:16:27 +00:00
david
c0f8979b01 Require a verbosity of 2 or higher for "NSE: Starting runlevel 1 (of 2)
scan." messages. (Was 1 or higher.)
2011-02-01 17:18:12 +00:00
djalal
d1b34654b8 Fix a bug which caused some NSE scripts to fail, due to the absence of
the NSE SCRIPT_NAME environment variable when the scripts are loaded.
Reported by Michael Pattrick.
2011-01-30 23:31:57 +00:00
batrick
9b135b281f localize some function calls 2011-01-28 13:54:05 +00:00
david
5fa2e66900 Include the "scripts" and "nselib" directory paths in XML --script-help
output.
2011-01-28 04:15:21 +00:00
david
8553cb3157 Merge r22026 through r22063 from /nmap-exp/david/nmap-script-help (new
--script-help option).
2011-01-27 21:44:54 +00:00
batrick
52a0bf19b8 Relocate a local among other constants/configurations. 2011-01-14 15:44:33 +00:00
david
acffcdfc82 Move banners announcing the start of a script scan phase out of the
threads_iter function.
2011-01-08 07:20:42 +00:00
david
9857411032 Pre-prime the first list of CONCURRENCY_LIMIT threads, and bail out
early if there are none to be run. This avoids printing
ScanProgressMeter messages.
2011-01-08 07:20:40 +00:00
david
1392faf5d4 Remove runlevel_scripts, which had become just a wrapper around ipairs. 2011-01-08 07:20:39 +00:00
ron
3ded2339e8 Fixed an issue in script dependencies that caused the later scripts to begin without waiting for the earlier scripts to finish. Patch written by Patrick Donneley. 2010-12-13 16:22:14 +00:00
batrick
4b481939b3 Reverting 21172, it was actually correct. 2010-11-24 21:10:20 +00:00
batrick
ce8c422f7d Fixed debug format. 2010-11-24 21:05:13 +00:00
david
c12e4c93fb Remove the call to sort the runlevel table. Patrick changed this code so
that it is built sorted, and also changed the structure of the table so
that sorting it raises an error. Patrik noticed the error.
2010-11-20 15:35:58 +00:00
batrick
c5cfd3128e Fixed some whitespace|formatting and made a small improvement to the iterator. 2010-11-17 22:12:54 +00:00
batrick
856c6fc3c6 Removed some unnecessary returns. 2010-11-17 21:02:52 +00:00
david
78877af7e8 o [NSE] There is now a limit of 1,000 concurrent running scripts,
instituted to keep memory under control when there are many open
  ports. Nathan reported 3 GB of memory use (with an out-of-memory NSE
  crash) for one host with tens of thousands of open ports. This limit
  can be controlled with the variable CONCURRENCY_LIMIT in
  nse_main.lua. [David]
2010-11-17 19:31:24 +00:00
david
4a4e67bd2c Set the close_handlers member in worker Thread objects. The lack of this caused
them to use the close_handlers table of the parent thread that spawned them
instead. See http://seclists.org/nmap-dev/2010/q3/804 for more details.
2010-09-23 16:32:11 +00:00
batrick
b92ce14522 clearer error message 2010-09-13 23:28:15 +00:00
batrick
45c8180971 Changed some of the formatting. 2010-09-13 06:07:19 +00:00
djalal
81592359e4 Added a new function to save new created NSE threads in the threads table. 2010-08-31 20:25:18 +00:00
batrick
7b40aa34c5 formatting 2010-08-12 18:29:40 +00:00
kirubakaran
68fd970ec1 Adding comments to nmap debug print message 2010-08-12 15:18:58 +00:00
djalal
0ae240c1e8 Reset the script engine verbosity that was boosted when scripts are selected by name. 2010-08-11 22:37:16 +00:00
batrick
f46908f0bd Require each Lua library explicitly (debug in particular). Requiring the "debug"
library is necessary for Lua 5.2.
2010-08-10 16:51:10 +00:00
kirubakaran
b35255c8e9 Adding verbosity to nmap debug option -d2 to print the whole path of scripts specified in rule 2010-08-10 16:20:07 +00:00
djalal
f0c5e154c3 Merge r18689:r19511 from /nmap-exp/djalal/nse-rules.
o Add two new Script scan phases:
  Script Pre-scanning phase: before any Nmap scan operation, activated by the new "prerule".
  Script Post-scanning phase: after all Nmap scan operations, activated by the new "postrule".
o New environment variables:
  SCRIPT_PATH
  SCRIPT_NAME
  SCRIPT_TYPE: the type of the rule that activated the script.
2010-08-06 16:40:03 +00:00
batrick
c08922c411 Reset environment after creating new script thread. (This may fix problems with
some memory not being reclaimed.)
2010-07-10 06:03:15 +00:00
batrick
45a51eff5c Move Script Database Update code from nse_main.cc (Lua code embedded in C
strings) to nse_main.lua.
2010-07-07 16:31:17 +00:00
djalal
24807128d2 Merge r17640:18062 from /nmap-exp/djalal/nmap, this is a port of the LuaFileSystem directory iterator in order to use Lua code to list scripts. 2010-06-12 21:41:09 +00:00
fyodor
3cc34c37ee Removed a line which generated a report like "NSE: Script Scanning
completed." due to two issues.  One is that we already have a
different line printed in verbose mode which looks like "Completed NSE
at 14:31, 0.27s elapsed".  The other problem is that this was being
printed in non-verbose mode when you specified an argument like
"--script ssl-cert".  We intentionally bump the verbose mode of
scripts when they are specified individually like that so they can
report more script results, but I don't think we need the NSE
infrastructure itself to become more verbose.
2010-05-01 21:35:59 +00:00
batrick
0f1b1626c4 whitespace change 2010-04-08 20:27:05 +00:00
batrick
b6d57382e3 Fix bug where Lua will load original, optional Lua libraries when we have
custom libraries that must be used instead. (So, try to load our libaries
first, then look through system paths.) This bug is very rare since these
optional libraries are very rarely installed in most distributions.

Bug found by Onur K. [1].

[1] http://seclists.org/nmap-dev/2010/q1/197
2010-01-21 18:56:30 +00:00