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

59 Commits

Author SHA1 Message Date
batrick
07cfc5aee4 Corrected many #includes for header files (where they are included).
Moved the includes for Lua headers to the .cc files so they are
not needlessly, repeatedly included.

Similarly, moved some standard headers to the .cc files and reorganized
includes to be uniform for all nse_* source files.

Fixed whitespace (removed tabs).
2009-03-10 05:56:10 +00:00
david
a173fe6ce1 Add the stdnse.sleep function. 2009-02-23 23:57:39 +00:00
david
20cf487b33 Replace the mix of spaces and tabs in the main NSE files with uniform two-space
indents, which seems to be the dominant style.
2008-11-18 21:11:27 +00:00
david
c3ee93f056 Sort script.db entries by file name to make diffs comprehensible. Their
previous unsorted state was due to their coming straight out of opendir.
2008-11-15 00:58:36 +00:00
david
e7cc30b6c2 Make some changes to allow a Windows build of the new openssl code. (Just
rearragement of some includes and defines.)
2008-10-08 22:58:29 +00:00
sven
d8714befb1 merging nse_openssl branch 2008-10-08 22:21:41 +00:00
david
ddb66f1c07 Revert r10335, which had the NSE loader track require errors and handle them
specially. This was to hide the any errors raised by scripts using an openssl
module when OpenSSL itself wasn't available. For now this will be handled by
having each script check for openssl.
2008-10-08 16:46:12 +00:00
sven
abd40e3f96 make --script-updatedb skip scripts producing load errors 2008-09-24 07:39:28 +00:00
batrick
0e984d85b7 Removed some unnecessary code. 2008-09-23 13:19:13 +00:00
batrick
17020acc26 Missing dependencies (such as OpenSSL) are no clutter nmap output (other run
time errors are not affected by this change). If verbose is 4 or greater than
a simple message is output saying what file could not be loaded due to X
library missing. If debugging is set, then the previous error message is
used.
2008-09-23 11:06:22 +00:00
david
db49b425c1 Remove a debugging function, stack_dump, that I used to step through NSE code.
Something like it should remain a part of NSE, because it helped me to see what
was in the Lua stack inside GDB. I got the function from
http://www.lua.org/pil/24.2.3.html.
2008-09-15 06:43:16 +00:00
david
43eed4b67b Use a global table of loaded script file names, and don't load a script if its
file name is already in the table. Previously duplicates were only checked for
in a table that was an upvalue of the entry function, allowing duplicates to
sneak in elsewhere.

This prevents a script from being loaded twice when it is given by name, and is
in the "version" category and version detection is used.
2008-09-15 06:38:08 +00:00
david
3cf57e7009 Improve some documentation in nse_init.cc, because it took me a really long
time to understand some functions.
2008-09-15 05:16:01 +00:00
david
12f272d4d6 Don't register the nselib-bin directory any longer in init_setpath in
nse_init.cc. Because that directory isn't created on installation any longer it
was causing an NSE error: "SCRIPT ENGINE: error while initializing Lua State:
'nselib-bin/' not a directory"
2008-09-05 05:12:23 +00:00
batrick
fa034c1ac9 Changed a struct to use const char *'s to remove a compilation warning. 2008-09-03 22:27:24 +00:00
batrick
cc8f9133ae Made corrections to initialization so that compilation/runtime errors
in scripts no longer cause the script engine to abort.
2008-09-03 22:26:51 +00:00
batrick
8a44c9432d Updated NSE's bit library to no longer be a shared library.
See this thread: http://seclists.org/nmap-dev/2008/q3/0404.html
2008-08-27 22:23:50 +00:00
batrick
984bdf65bb Added error message to output for NSE when a script could not be loaded.
See: http://seclists.org/nmap-dev/2008/q3/0265.html
2008-08-07 12:32:39 +00:00
batrick
6bfd95743f Fixed an incorrect number of arguments being passed to a vararg error function. 2008-08-05 09:29:15 +00:00
pgpickering
3398e1f94e modified nse_init.cc, added binlib and hashlib to NSE 2008-07-31 14:21:28 +00:00
batrick
f8059d931e [NSE] Added an error check for loading a file. 2008-07-31 07:30:39 +00:00
batrick
b0a62d2aca Applied Jah's patch to fix --script-updatedb use of an old index for the
script table.

http://seclists.org/nmap-dev/2008/q3/0164.html
2008-07-27 02:55:31 +00:00
batrick
f9e6d7d01a Adapted current nse_main to use the new action closure change discussed here:
(http://seclists.org/nmap-dev/2008/q2/0549.html).
2008-07-07 17:34:37 +00:00
batrick
f424fd21b2 Updated some macros to clean up code. Moved
porttests and hosttests to Lua's registry where they belong.
2008-07-07 17:33:36 +00:00
batrick
8fa740fe04 [NSE] Script Categories are now case insensitive. 2008-07-07 17:32:34 +00:00
batrick
3ae4bcfa9e Removed nse_string. Equivalent procedures are placed in
nse_main and nse_nsock. nse_main now uses Lua to create printable output
while a cleaner hexify procedure has been placed in nsock.
nse_string is removed as a result.
2008-07-07 17:31:38 +00:00
batrick
d34f06ea49 Fixed a compile error. 2008-06-21 13:33:53 +00:00
batrick
ac52d97c25 Updated library handling in nse_init, and made
nmap library properly return its library table.
2008-06-21 13:28:03 +00:00
kris
a5bf21e5db o The NSE nmap.registry.args table is now available, albeit empty, when
--script-args isn't used.  Now scripts don't need to check if it's nil
  before attempting to index it. [Kris]
2008-06-01 06:31:50 +00:00
batrick
d0bc640db8 Large recode of nse_init.cc
Now does most of it's work through Lua:

From Nmap-dev: "Many of the changes consist of changing how Nmap interfaces
with Lua that were sometimes awkward or inflexible. Most of the functions 
have been made to be callable directly by Lua which offers many technical
advantages: stack management is alleviated, errors are handled cleanly and
are more descriptive, and there is increased reusability."

Additionally:
   -- Moved all lua_State * symbols from "l" to "L". This is to maintain
      consistency with other Lua libraries (convention) and to make our macros portable.
   -- Moved file system manipulation over to nse_fs.cc (from nse_init.cc)
2008-05-31 02:39:27 +00:00
batrick
742ff67100 Removed nse_auxiliar. Updated Script Argument parsing. Fixed typos in
documentation. Improved MySQLinfo.nse. Nsock/dnet metatabels are now
protected.
2008-05-31 02:19:24 +00:00
kris
c7eb8011d9 NSE now has a "default" category for scripts. This category holds the set
of scripts chosen from when using -sC (but it's still just another category
and so can be chosen with --script like any other).

On top of updating the docs with information about this new category, I've
also updated sections to emphasize that the "default" category, -sC and -A
are considered intrusive and should not be run against target networks
without permission.

The new list is very similar to the previous "safe,intrusive" list:

Added: finger, ircServerInfo, RealVNC_auth_bypass
Removed: HTTPpasswd

Here are the 21 scripts in this new category:

anonFTP
dns-test-open-recursion
finger
ftpbounce
HTTPAuth
HTTP_open_proxy
ircServerInfo
MSSQLm
MySQLinfo
nbstat
RealVNC_auth_bypass
robots
rpcinfo
showHTMLTitle
showOwner
SMTPcommands
SNMPsysdesr
SSHv1-support
SSLv2-support
UPnP-info
zoneTrans
2008-05-28 07:16:32 +00:00
diman
cf4c7081e8 moving debugger to nmap-exp/diman until further notice 2008-02-03 21:38:38 +00:00
diman
2d9bc1b43d added a CLI debugger 2008-02-03 14:21:36 +00:00
doug
be2ddcfa1c Fix for this TODO item:
o Fix cases of std::string() being used in ways which wrongly parse
  the data for escape sequences such as \n.  For an example, see
  log message of r6474 in svn.

(note that this was a Lua escaping bug, not std::string)
2008-01-28 00:12:37 +00:00
fyodor
09512ff092 o Fix a bunch of warning/error messages which contained an extra
newline.  Thanks to Brandon Enright for the patch.
2007-12-21 03:38:04 +00:00
david
29109de637 Consider Windows paths starting with \ absolute when used with the --script option. 2007-12-14 08:33:31 +00:00
david
82abfd3e1b Insert a path separator in returned paths in init_scandir when WIN32 is defined in nse_init.cc. The Windows code was inserting a separator to find files (e.g. globbing on "%s\*") but was not inserting the separator in returned paths. A symptom of this was scanning with --script=scripts and seeing error messages about not being able to access things like "C:\Nmap\scriptsanonFTP.nse" (should be "C:\Nmap\scripts\anonFTP.nse"). 2007-12-09 05:33:59 +00:00
david
b0d224e0da Make the message printed when using an absolute path look like the other NSE
debugging messages.
2007-12-09 04:52:42 +00:00
david
bc24f8d6c4 Look first for absolute file names in when loading NSE scripts. 2007-12-09 04:42:48 +00:00
david
5f460f8590 Fix typo in nse_init.cc: explicitely -> explicitly. 2007-12-08 22:28:07 +00:00
kris
d05555e8a2 don't require a ".nse" extension when specifying script names with --script 2007-11-29 23:11:48 +00:00
diman
c0f07c99ac adding nselib nselib-bin second (should work on unix now) 2007-11-27 22:18:59 +00:00
david
83382600f2 Revert r5485. This changes the pcre Lua module back to statically linked
code instead of a dynamically loaded C module. Linking the dynamic
shared module with the static libpcre.a was failing on OpenBSD. See
http://seclists.org/nmap-dev/2007/q4/0085.html.
2007-10-23 00:45:00 +00:00
fyodor
ba545c1ef9 Unix installation now places NSELib dynamic libraries in 'libexec' rather than 'share' directories, since they are architecture dependent. Thanks to Christoph J. Thompson for the patch. 2007-10-07 21:32:38 +00:00
kris
7c3448c1f7 Trying to keep script.db tidy when running --script-updatedb. This sorts the script filenames before writing script.db. Tested on Linux and Windows 2007-09-15 01:01:35 +00:00
stoiko
4767dd8c70 script arguments now get checked before nmap starts scanning 2007-08-20 21:56:36 +00:00
fyodor
c124e918b7 merge soc07 r5360:5367 - Merge Majek's raw packet NSE patch 2007-08-11 06:13:25 +00:00
fyodor
62d7e3ed87 merge soc07 r5317:5322 - NSE buffered receives and script arguments 2007-08-11 06:09:50 +00:00
fyodor
78f15a7f65 make pcre an NSE C module 2007-08-11 06:05:48 +00:00