1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 14:11:29 +00:00
Commit Graph

122 Commits

Author SHA1 Message Date
djalal
02b7d6e563 o [NSE] Use a table to store the output results, and use table.concat()
to concat data instead of classic concatenation. This can have a huge
  performance boost, check this thread:
  http://seclists.org/nmap-dev/2011/q3/623
2011-08-23 09:26:06 +00:00
djalal
a9bbb27a54 o [NSE] Added a missing function parameter for registry_add_table(). 2011-07-30 12:02:24 +00:00
paulino
ec63b8a647 Adds support for passing arguments without the script name. 2011-07-27 04:32:01 +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
gorjan
3d249dbb4b Adding in_port_range function to nselib/stdnse.lua 2011-05-12 22:36:45 +00:00
henri
a433cc08ed Fixed typo 2011-05-11 14:21:07 +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
04210ef88f When an entry in stdnse.format_output has multiple lines, insert the
indent and prefix before each line, not just at the beginning. If the
indent was ">>>>", then formatting the line "AB\nCD" would result in

| >>>>  AB
|_CD

Now it will be

| >>>>  AB
|_>>>>  CD

Some script were working around this by relying on an invisible blank
first line and manually indenting following lines.
2010-12-30 21:08:24 +00:00
david
086b043cde Remove the single-string special case in stdnse.format_output.
This should be handled by the generic case, and I don't think it was
used anyway because the logic was wrong:

if(indent == nil and #data == 1 and type(data) == 'string' and not(data['name']) and not(data['warning'])) then
  return data[1]
end

This seems to be checking for a one-element table whose single element
is a string. But the test "#data == 1 and type(data) == 'string'" is
actually testing for a one-byte string. I think this is supposed to be
"type(data[1]) == 'string'", but anyway it should be handled by the
generic case.
2010-12-30 21:08:15 +00:00
batrick
03c7e9d00e Have stdnse.make_buffer read chunks instead of lines [1] so we do not implicitly
buffer based on the presence of new lines.

[1] http://seclists.org/nmap-dev/2010/q4/554
2010-11-29 22:51:51 +00:00
ron
f14a179b44 Fixed a bug in stdnse.format_output() where the 'name' attribute of the top-most table wouldn't display 2010-11-20 16:18:18 +00:00
ron
13bb98b8b8 Bring in changes from my experimental brange, nmap-http 2010-10-27 03:08:08 +00:00
ron
2608bae6ca Rollback the changes to the HTTP library I accidentally commited in the last revision 2010-10-18 21:23:24 +00:00
ron
b8e712ceeb Added a couple shares to the list of common ones (requested on IRC by kraigus) 2010-10-18 21:16:48 +00:00
david
e7fc9c4c5f Change " \n" to just "\n" where appropriate in NSE. Leading newlines are
no longer removed from script output.
2010-09-30 05:03:39 +00:00
david
3927d53e00 Simplify get_script_args and remove the deprecation warning. 2010-09-29 19:29:09 +00:00
ron
a477d142f1 Updated stdnse.get_script_args() function to take arrays in addition to strings. If an array is passed, currently, the first name is considered 'valid' and the others are considered 'deprecated'. This behaviour is still under discussion. 2010-09-24 02:52:00 +00:00
djalal
f3e08e85a0 Merge r19753,r19755,r19756,r19776,r19783 changes from nmap-exp/djalal/nmap-add-targets. The changes introduce a new stdnse function 'get_script_args()' to parse script arguments. 2010-08-16 22:06:49 +00:00
kris
cc33a59ca4 Add nmap.clock() for providing scripts with the current time in floating
point seconds since the epoch, and add clock_ms() and clock_us() to stdnse
for convenience (millisecond and microsecond).

qscan.nse now provides microsecond resolution.
2010-07-23 19:49:42 +00:00
david
8811bdb6cc Reflow NSEDoc for PDF inclusion. 2010-07-18 19:41:04 +00:00
david
7d0c08a097 Brief copyediting of NSEDoc for modules. 2010-07-12 19:42:43 +00:00
david
b7428619cf Add a stdnse.parse_timespec function. 2010-04-13 17:06:34 +00:00
ron
3a3535e07c Fixed a couple formatting bugs in the smb-* libraries that come up when debugging/verbose is disabled 2010-02-20 15:03:11 +00:00
david
4dd04a32a5 Make stdnse.format_output return nil when passed an empty table. Before
it was returning an empty string, causing blank output entries for
scripts with no output:

80/tcp    open   http
|_citrix-enum-apps-xml:
|_citrix-enum-servers-xml:
| http-headers:
|   Date: Sun, 31 Jan 2010 19:28:13 GMT
|   Server: Apache/2.2.3 (CentOS)
|   Accept-Ranges: bytes
|   Content-Length: 739
|   Connection: close
|   Content-Type: text/html; charset=UTF-8
|
|_  (Request type: HEAD)
|_http-date: Sun, 31 Jan 2010 19:28:14 GMT; +1s from local time.
|_html-title: Go ahead and ScanMe!
2010-01-31 19:38:13 +00:00
batrick
da041cb0b3 Get rid of <em>/<strong> tags because there is no uniform
way to use them across DocBook and HTML.
2010-01-16 01:59:12 +00:00
ron
958ba69422 fixed another bug in format_output(), thanks to Patrik. 2010-01-13 21:18:36 +00:00
ron
e47175b4b8 Fixed broken indentation for single-element subgroups in stdnse.format_output(). 2010-01-13 21:03:20 +00:00
batrick
62ed5336b4 Fixed typo in documentation that screwed up nsedoc. 2010-01-10 04:45:08 +00:00
batrick
e94da5d874 Use em/strong tags instead of <b>. 2010-01-10 03:18:05 +00:00
david
1b6c69387a Move the format_difftime function out of http-date.nse and into
stdnse.lua. It can be useful in other scripts.
2010-01-06 20:43:24 +00:00
fyodor
cccc1d5831 Adjust the example output for new format_output format 2009-11-22 08:34:15 +00:00
fyodor
48b37ff7d2 Change script output indenting from one space to two 2009-11-22 08:22:54 +00:00
ron
422b5855e5 Update the output formatting to the style that Fyodor requested. Haven't updated the @output sections yet, just in case we decide to change this again. 2009-11-20 16:12:41 +00:00
ron
08da8db7f0 Importing changes from my branch. There are two major updates:
1) I wrote a function that formats output from scripts in a consistent way. Although we haven't really come to a concensus on how it should look yet, it's easy to change when we do. 
2) New script: smb-enum-groups.nse. Enumerate the local groups on a system and their membership.
2009-11-20 16:05:06 +00:00
batrick
2b3df5882f [NSE] Patch to add worker threads to NSE for scripts to use. Right
now a script is limited in parallelism to working on one socket at any
time. A script can now create a worker thread that will be capable of
doing work on sockets in parallel with the parent script. See [1] for
more information.

This patch also comes with condition variables that are similar to
POSIX condition variables. They are used in the same fashion as
NSE's mutexes (nmap.mutex).

[1] http://seclists.org/nmap-dev/2009/q4/294
2009-11-12 01:33:52 +00:00
ron
80591c9cc6 Cleaned up output of smb-server-stats.nse 2009-03-12 14:56:23 +00:00
david
a173fe6ce1 Add the stdnse.sleep function. 2009-02-23 23:57:39 +00:00
david
d8c3cf21a5 Add missing module name prefixes to usage examples in some NSE documentation. 2009-02-17 19:53:02 +00:00
batrick
3016193c11 Improvements to the nmap library. See [1] for discussion and a full listing of
the changes.

[1] http://seclists.org/nmap-dev/2008/q4/0663.html
2008-12-29 21:59:08 +00:00
ron
86de493a3e Changed smb-enum-shares to detect a host that returns the incorrect value for unknown shares (happened against what appears to be a EMC SANS). Also added a check to stdnse.strjoin() to ensure that the first parameter is either nil or a string, I got the parameters wrong and spent awhile trying to figure otu why. 2008-12-08 03:33:25 +00:00
ron
ea42f39faa Merged in significant changes to Microsoft RPC calls 2008-12-07 16:16:11 +00:00
david
5f166e19ec Don't use empty parentheses when referring to functions by name in NSE
documentation.
2008-11-07 22:49:49 +00:00
david
df2ac77764 Small nselib proofreading changes. 2008-10-25 03:35:00 +00:00
david
efed9cf1a8 Update the documentation for some scripts and modules that I used in the NSEDoc
section of scripting.xml.
2008-10-24 00:23:46 +00:00
david
2762f91169 Reformat docs in stdnse.lua. 2008-10-23 18:31:00 +00:00
jah
eacb951209 Fixed typos for some nsedoc tag names:
INFO processing file `nselib/datafiles.lua'
ERROR undefined handler for tag `type'
INFO processing file `nselib/dns.lua'
ERROR undefined handler for tag `result'
ERROR undefined handler for tag `result'
INFO processing file `nselib/netbios.lua'
ERROR undefined handler for tag `returns'
INFO processing file `nselib/snmp.lua'
ERROR undefined handler for tag `result'
INFO processing file `scripts/SSLv2-support.nse'
ERROR undefined handler for tag `ouput'

Removed a @see tag which refers to Lua's string.format rather than to NSE docs:
INFO generating file `docs/modules/stdnse.html'
ERROR unresolved reference to symbol `string.format'
2008-10-18 20:49:00 +00:00
david
f58f559b81 Reformat and merge documentation for stdnse, shortport, strbuf, snmp, ssh1,
ssh2, smb, pop3, and msrpc.
2008-10-16 00:38:53 +00:00
sven
5d12eb7a3d add missing local reference to error() to stdnse 2008-10-12 18:39:00 +00:00
sven
8f83450228 revert tonumber() conversion in stdnse.tohex() because tonumber() discards whitespace 2008-10-07 07:28:10 +00:00
batrick
2c6554a435 Updated stdnse.tohex() to coerce strings to numbers if possible for the first
argument. That is, the first argument is interpretted as a number if possible.
2008-10-07 02:24:31 +00:00