1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-31 10:39:02 +00:00
Commit Graph

1223 Commits

Author SHA1 Message Date
dmiller
8bb13ebf81 Localize more functions in stdnse.lua 2014-09-03 19:49:59 +00:00
dmiller
40f36a4e3e Some string optimizations in NSE
Changes fall into these categories:

1. Avoid pathological string building. Loops over x = x .. "foo" can
become very slow. Instead, use strbuf.lua, table.concat, or just one
continuous concatenation; a = x .. y .. z is one operation, better than
a = x .. y; a = a .. z

2. Use hex-escaped strings instead of string.char. I find this more
readable in many cases, and it avoids a table lookup and function call.

3. Don't duplicate code. A few libraries and scripts had re-implemented
stdnse.generate_random_string or openssl.rand_bytes.
2014-09-03 04:49:54 +00:00
dmiller
25725d369e Localize a few functions in stdnse.generate_random_string for performance reasons 2014-09-03 04:49:49 +00:00
dmiller
c615bee688 New convenience function stdnse.get_timeout 2014-09-02 18:23:09 +00:00
dmiller
2692746c42 NSEdoc cleanup
Mostly splitting function summaries (the first paragraph of NSEdoc) from
the body of the description to make the summary indexes shorter and
easier to scan.

Also fixed some unbalanced code tags like <code>foo</table>
2014-09-02 18:23:06 +00:00
dmiller
667be96764 Fix some nsedoc 2014-08-29 19:58:15 +00:00
dmiller
964006b223 Adjust default timeout for rpc.lua
Reported: http://seclists.org/nmap-dev/2014/q3/378

Changes the default timeout for rpc.lua from 30s to 5 times Nmap's
calculated host timeout or 10s if no timeout info is available.
2014-08-29 16:34:56 +00:00
dmiller
d6bc7eed0b Add some code from Patrick for debugging lpeg grammars 2014-08-26 18:53:52 +00:00
dmiller
b27feed980 Support diffie-hellman-group14-sha1 in ssh2.lua
ssh-hostkey was hitting an assertion failure when scanning OpenSSH 6.7.
The cause was a failure to check for a shared KEX algorithm. We just
assumed diffie-hellman-group1-sha1 would be supported, since RFC 4253
says it "MUST be supported". This adds support for group14, which is a
2048-bit modulus; key strength was likely the reason for dropping
group1. A more complete solution would be to support more KEX
algorithms, but that's beyond the scope of the bug report.
2014-08-26 13:35:25 +00:00
dmiller
8f609b060d Move lpeg/utility.lua up a directory to fix installation issues 2014-08-25 22:22:15 +00:00
paulino
64b40b7a93 Adds signature for Lantronix SLC (http://www.lantronix.com/it-management/console-servers/slc.html) to http-default-accounts 2014-08-25 01:12:59 +00:00
dmiller
1a1dc0e47a Fix some typos 2014-08-23 21:35:32 +00:00
dmiller
77fad1ed1a New lpeg utility function to parse quoted strings 2014-08-23 20:47:48 +00:00
batrick
de27812fe4 Revert libssh2 branch, for now.
$ svn merge -r r33518:r33513 .

and removed added scripts to the script.db.

The branch needs further refinement/testing for Windows and Mac before merging
into the trunk. There is also the latent EOF bug which is giving performance
issues.

Further work on the branch will continue in Devin's latest branch:

/nmap-exp/devin/nmap-libssh2
2014-08-18 03:12:00 +00:00
claudiu
a7d5095309 Added silent_require import for openssl, to avoid missing module error 2014-08-16 10:06:22 +00:00
devin
63f997ed28 Merged libssh2-integration branch 2014-08-14 02:09:00 +00:00
jay
b281e0bf1d Get rid of unnecessary spaces at the end of lines 2014-08-09 19:09:06 +00:00
jay
03dd80d280 Convert to unix line endings using dos2unix 2014-08-09 18:06:14 +00:00
jay
5f346ca88c Document nmap.version_intensity() 2014-08-09 17:49:11 +00:00
batrick
1d77f352ed Fix doc. 2014-08-03 01:19:31 +00:00
batrick
4b9f1c6766 nselib stdnse.print_debug -> stdnse.debug
Manual fixes.
2014-08-03 01:17:09 +00:00
batrick
ee6622aea4 nselib stdnse.print_debug -> stdnse.debug
$ f() { find -name \*.lua -exec /bin/echo sed -i "$1" {} \; ; }
$ f 's/stdnse.print_debug( *\([0-9]*\) *, */stdnse.debug\1(/'
$ f 's/stdnse.print_debug( *"\(.*\))/stdnse.debug1("\1)/'
2014-08-03 00:56:45 +00:00
batrick
a809f52d5d level should be a number 2014-08-03 00:43:03 +00:00
batrick
1cec0a305b Run rule functions in the main loop.
This allows usage of verbose/debug in portrule/hostrule and access to all
functionality of NSE, including sockets. So for example, we can now do:

function portrule (host, port)
  local response = http.get(host, port, "/");
  stdnse.debug1(response.body)
  ...
end

The verbose/debug function did not work in rule functions because the
introspection API (getid, gettid, etc.) only work when NSE is in the main loop.
The main loop sets the required internal variable current needed by the API.

List of changes:

stdnse.lua:

  o debug/verbose check the debugging/verbosity level much earlier to allow
    returning if nothing will be printed.

  o Simplified debug/verbose logic to handle the optional first argument
    better.

  o made debug/verbose local functions to avoid using globals and allow self
    tail calls

nse_main.lua:

  o The logic for adding threads via a rule function is simplified. So long as
    the script has the desired rule function, a thread is always returned.
    Evaluation of the rule function is done while NSE is in the main loop (i.e.
    not in script:new_thread()). The rule function only determines if the action
    function is run.

  o [Not a change:] If the action function will be run or was run then we see
    the usual "Starting X" and "Finished X" messages from NSE.

  o Use Lua 5.2's pack function instead of the slightly more expensive
    {n = select("#", ...), ...} idiom.

  o New stdnse.getinfo introspection function which is used by stdnse.debug.
2014-08-02 21:18:08 +00:00
batrick
4201aa8eac Fix stdnse undeclared variable warning.
Also fixes a typo:

-function debug3 (...) return stdnse.debug(4, ...) end
+function debug4 (...) return _ENV.debug(4, ...) end
2014-08-02 03:37:29 +00:00
dmiller
b7485a6e7f Add some missing NSEdoc params to re.lua 2014-07-31 19:18:04 +00:00
dmiller
7eb678a893 Move NSEdoc for unittest.run to unittest.nse
This prevents unittest.run from being included in the Script Arguments
section of every script that includes a unittest-compatible library.
2014-07-31 18:06:14 +00:00
dmiller
e8cfd3abe2 Add NSEdoc to re.lua
NSE libs must have @class and @name elements, or must have an NSEdoc
block preceding a call to stdnse.seeall, otherwise NSEdoc generation
breaks.
2014-07-31 14:39:35 +00:00
dmiller
0e24910267 New http-enum fingerprint for Metasploit's reverse_hop_http stager 2014-07-30 13:33:21 +00:00
jay
341e447868 Add the nmap.version_intensity() function for use in NSE version scripts. Modify shortport.version_port_or_service() to also take a rarity parameter. 2014-07-30 07:05:58 +00:00
devin
d68396d823 Merged Lpeg branch 2014-06-26 20:12:54 +00:00
claudiu
2772733958 STARTTLS support for LDAP 2014-06-20 10:11:38 +00:00
dmiller
ec9074f718 Correct "it's" to "its" where necessary
it's = it is
its = belonging to it
2014-06-19 04:58:46 +00:00
dmiller
af57ddfd90 Minor whitespace cleanup 2014-06-18 17:16:24 +00:00
claudiu
0f17475b15 Implemented STARTTLS support for IMAP and POP3 2014-06-17 07:46:55 +00:00
dmiller
b73a7254e0 NSEdoc for some sslcert.lua functions 2014-06-12 12:28:06 +00:00
paulino
34691d779d * Applies patch to Cacti fingerprint.
* Adds Xplico (http://www.xplico.org/) fingerprint.
2014-06-11 19:44:24 +00:00
patrik
0b0109d4af commit 7dae4affc23f9fd70e916bc461e45eafe4bcf99a
Author: Patrik Karlsson <patrik@cqure.net>
Date:   Thu May 29 21:33:18 2014 -0400

    fix to detect non ASA devices and unsupported versions
2014-05-30 01:46:59 +00:00
devin
5e6c9d5f78 NSE enhanced output patch 2014-05-29 03:22:59 +00:00
devin
53ca0c01dd Added checks to prevent scripts from indexing a nill value when
scanning localhost.
2014-05-28 02:29:31 +00:00
patrik
c950dcb154 Squashed commit of the following:
commit a78b6142449b71ccd1cd7061b5363f6882b2e00b
Author: Patrik Karlsson <patrik@cqure.net>
Date:   Sun May 25 21:19:22 2014 -0400

    fix indentation

commit 5e61eba30f98343fb172687bd377acae6cb9e242
Merge: d446fa7 9696dd5
Author: Patrik Karlsson <patrik@cqure.net>
Date:   Sun May 25 21:15:50 2014 -0400

    Merge branch 'master' into anyconnect

commit d446fa76181d97287604b48719dd3f714987b775
Author: Patrik Karlsson <patrik@cqure.net>
Date:   Sun May 25 21:15:09 2014 -0400

    Update CHANGELOG

commit 1590b8a8598bfd06c767c31312dc56c8e306c556
Author: Patrik Karlsson <patrik@cqure.net>
Date:   Sun May 25 21:13:27 2014 -0400

    update script.db

commit 93eb927e21d3e3702da36668628b70c42f14f0db
Author: Patrik Karlsson <patrik@cqure.net>
Date:   Sun May 25 21:09:51 2014 -0400

    update anyconnect library to better capture version
    add missing libraries http-cisco-anyconnect.nse
    add new scripts to detect vulnerabilities cve2014-2126 through 2129

commit 92fecad07d340e60abbe502a4541d6e4f71af224
Author: Patrik Karlsson <patrik@cqure.net>
Date:   Sat May 24 09:09:14 2014 -0400

    initial commit
2014-05-26 01:28:38 +00:00
dmiller
125d84fd67 Allow stdnse.format_timestamp to take a Lua date table
This will allow formatting of timestamps beyond 2036, which currently
are limited by the wrapping of the 32-bit Unix timestamp.
2014-05-21 15:04:12 +00:00
sophron
efb73576e1 [NSE] A negative value should disable the maxpage limit according to NSEDoc. 2014-05-13 10:14:39 +00:00
patrik
b440d9c064 fix redirect bug in head request where redirects would not be honored 2014-04-26 13:34:48 +00:00
fyodor
91645f1aee Change a couple files to unix line endings 2014-04-23 09:37:37 +00:00
dmiller
6bd9462dd6 Fix some CRLF line endings to LF 2014-04-17 19:50:24 +00:00
dmiller
9ca584d0b8 Make tls.record_read more strict about protocol correctness 2014-04-17 02:15:03 +00:00
tomsellers
cacf764754 Change to citrixxml.lua to improve performance of citrixlua library when handling large XML responses containing application lists. Large responses were causing the script to consume 100% CPU for extended periods of time.
Reference:
http://seclists.org/nmap-dev/2014/q2/74
2014-04-16 11:56:21 +00:00
dmiller
100ff6f238 Let sslcert do STARTTLS based on service, not just port number 2014-04-11 16:42:29 +00:00
dmiller
54caea26b4 Unify comm.lua's is_ssl and shortport.ssl
Heuristic detection of SSL ports was previously done in 2 different
places, leading to a divergence: shortport.ssl would return true for
more services than comm.tryssl would try, since comm.is_ssl was checking
a shorter list of port numbers and was ignoring
port.version.service_tunnel and port.version.name. Now any changes to
shortport.ssl will affect both libraries.
2014-04-11 15:22:42 +00:00