1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-28 02:19:04 +00:00
Commit Graph

439 Commits

Author SHA1 Message Date
batrick
ac55b3ca78 Fixed a regexp escape sequence and shortened code. 2009-08-10 12:51:14 +00:00
joao
11be55c93c Included new ports to common ssl ports,
Fix for resource leak, explicitly closing sockets when connection was not considered succesful
2009-08-10 04:39:11 +00:00
david
fdd82d1576 Call tostring on table keys before concatentating them in
nsedebug.tostr, so it at least doesn't crash when a table has another
table as a key.
2009-08-03 23:48:06 +00:00
joao
24b5c338b6 New lib to deal with proxies from scripts.
This lib is being used on the proxy detection scripts, but can also be used to deal with proxy handshaking.
2009-07-30 02:11:21 +00:00
joao
6218ce14a5 Added POST and HEAD support to http.lua 2009-07-24 08:00:32 +00:00
jah
fe186c5500 Normalised the return values from dns.query() (and consequently
dns.findNiceAnswer() and associated answerFetcher functions).
(see http://seclists.org/nmap-dev/2009/q3/0253.html )

Improved the handling of MX records.
2009-07-22 10:04:41 +00:00
jah
dcfa102a1b Fix the indexing of Globals - found with the help of strict.lua and Patrick's
check_globals script.

Commented-out two functions which are currently unused:
svcctl_Type_tostr() and svcctl_State_tostr()
and which call currently unavailable functions:
svcctl_Type_str() and svcctl_State_str()

(see http://seclists.org/nmap-dev/2009/q3/0194.html )
2009-07-17 22:38:26 +00:00
ron
1b2392f73d Fixed an undeclared variable bug in a currently-unused codepath. 2009-07-17 21:56:11 +00:00
batrick
a8891ec0ca If the old _index metamethod does not exist then do not use it. This would
cause "attempt to index a nil value" errors when whatever is being made
"strict" did not have a metatable (the global environment for example).
2009-07-16 03:43:23 +00:00
batrick
ba4e924634 Corrected the NSEDoc formatting and wording. 2009-07-15 15:19:33 +00:00
batrick
9d5de2a9d1 Added strict library for libraries (and scripts). The module function is
replaced so that all NSE modules will have strict declared global checking at
runtime. This should catch most developer errors early. Please see [1] for
further reference into the problem.

[1] http://seclists.org/nmap-dev/2009/q3/0070.html
2009-07-15 15:14:00 +00:00
batrick
67f31fd170 Fixed a global access for 'opts' using check_globals script. 2009-07-15 14:16:14 +00:00
david
426ed74a8b Add the http-date.nse script. Also the function http.parse_date that
parses an HTTP date in any of three possible formats.

http-date.nse gets the Date: header field value from and HTTP server,
then displays it with how much it differs from local time.
2009-07-13 22:03:02 +00:00
joao
c455e12b7d http.lua using a different approach to deal with ssl connections. Now it is using the comm.tryssl method. 2009-07-13 15:24:14 +00:00
david
276a2f195c [NSE] Scripts that are listed by name with the --script option now
have their verbosity level automatically increased by one. Many
will print negative results ("no infection found") at a higher
verbosity level. The idea is that if you ask for a script
specifically, you are more interested in such results.
2009-07-12 19:35:56 +00:00
david
36b12c9a21 Make decoding of the "chunked" transfer encoding more robust in
http.lua. Previously the code was not careful about checking its input,
and would loop forever if it got something non-hex where it expected a
hex chunk-size. See http://seclists.org/nmap-dev/2009/q3/0013.html.

This code raises an error whenever decoding fails for whatever reason.
It also handles chunk extensions. The reference is section 3.6.1 of
RFC 2616.
2009-07-09 03:07:31 +00:00
batrick
90a712ae2b Patch to libraries that were inappropriately using globals.
Often two (or more) scripts using the same library would
overwrite the globals each was using. This would result
in (at best) an error or (at worst) a deadlock.

The patch changes the global accesses to local.
2009-07-07 00:20:52 +00:00
joao
53c5e64c43 Fixed local/global issues with some vars 2009-07-05 09:59:02 +00:00
batrick
1963fe7b96 Removed some code that did nothing. 2009-07-03 04:05:10 +00:00
batrick
6595577d6e Close the socket when finished getting the banner. 2009-07-01 21:43:49 +00:00
fyodor
9ca4041ec1 Merged -r13793:HEAD from nmap-exp/dev/nmap branch now that we're opening up trunk development
again.  Here are the items which were merged:

------------------------------------------------------------------------
r13971 | jah | 2009-06-29 14:30:27 -0700 (Mon, 29 Jun 2009) | 2 lines

Improved a pattern for matching HTTP status-line, tidy away some variables and
fix a typo.
------------------------------------------------------------------------
r13967 | daniel | 2009-06-29 13:47:04 -0700 (Mon, 29 Jun 2009) | 5 lines

o Added a convenience top-level BSD makefile redirecting BSD make
  to GNU make on BSD systems.  This should help prevent bogus
  error reports when users run "make" instead of "gmake" on BSD
  systems. [Daniel Roethlisberger]

------------------------------------------------------------------------
r13965 | batrick | 2009-06-29 06:50:11 -0700 (Mon, 29 Jun 2009) | 14 lines

[NSE] The NSE Nsock Library binding no longer relies on garbage collection to
monitor the use of socket "slots". A thread (script) attempting to connect must
first obtain one of a limited number of available socket locks (usually 10 or
--max-parallelism). The binding would use garbage collection of sockets to
determine when a thread has finished using its allocated sockets. This is
unfortunately slow and requires us to constantly run the garbage collector to
cause timely reallocation. I have changed the binding to now regularly inspect
allocated sockets in the nsock_loop function. Available sockets slots are now
immediately reallocated and done with far less execution time.

See [1] for benchmarks and further explanation.

[1] http://seclists.org/nmap-dev/2009/q2/0624.html

------------------------------------------------------------------------
r13964 | batrick | 2009-06-29 06:37:49 -0700 (Mon, 29 Jun 2009) | 10 lines

[NSE] Fixed a rare (and usually undetectable) bug that can cause a SEGFAULT.
The NSE nsock library binding may attempt to push values on the stack of
a thread that ended due to an error. It is possible that the internal
Lua stack was completely full and any further pushed values would result
in a segmentation memory violation.

This bug is very hard to reproduce with a SEGFAULT but is usually visible
when Lua assertion checks are turned on. A socket handler routine must be
called AFTER a thread has ended in error.

------------------------------------------------------------------------
r13963 | batrick | 2009-06-29 05:51:20 -0700 (Mon, 29 Jun 2009) | 3 lines

Fixed some global scoped variables to be local. This caused a many scripts to
overwrite each others' sockets, options, etc.

------------------------------------------------------------------------
r13939 | joao | 2009-06-27 16:07:35 -0700 (Sat, 27 Jun 2009) | 2 lines

Fixed port rule to include ssl pop3 port, now that pop3.lua supports SSL connections in function capabilities

------------------------------------------------------------------------
r13938 | joao | 2009-06-27 16:06:28 -0700 (Sat, 27 Jun 2009) | 2 lines

Added transparent SSL support using comm.tryssl

------------------------------------------------------------------------
r13937 | joao | 2009-06-27 16:05:19 -0700 (Sat, 27 Jun 2009) | 2 lines

Added transparent SSL support using comm.tryssl

------------------------------------------------------------------------
r13936 | joao | 2009-06-27 16:03:50 -0700 (Sat, 27 Jun 2009) | 2 lines

Added SSL transparent support using comm.tryssl

------------------------------------------------------------------------
r13935 | joao | 2009-06-27 16:02:39 -0700 (Sat, 27 Jun 2009) | 2 lines

Added SSL transparent support using comm.tryssl

------------------------------------------------------------------------
r13934 | joao | 2009-06-27 16:01:38 -0700 (Sat, 27 Jun 2009) | 2 lines

Added SSL transparent support using comm.tryssl

------------------------------------------------------------------------
r13933 | joao | 2009-06-27 16:00:27 -0700 (Sat, 27 Jun 2009) | 2 lines

SSL transparent support using comm.tryssl

------------------------------------------------------------------------
r13932 | joao | 2009-06-27 15:19:58 -0700 (Sat, 27 Jun 2009) | 2 lines

Included transparent ssl support to function pop3.capabilities using comm.tryssl

------------------------------------------------------------------------
r13931 | joao | 2009-06-27 15:19:06 -0700 (Sat, 27 Jun 2009) | 3 lines

New version of comm.lua with function tryssl, that transparently adds support to ssl connections


------------------------------------------------------------------------
r13930 | joao | 2009-06-27 14:50:38 -0700 (Sat, 27 Jun 2009) | 6 lines

Fixed buffering problem exposed by david on nmap-dev list.
The problem was solved using a buffer to receive the data, making the script work fine in cases where the ssh packets are fragmented.

A very similar solution was applied to ssh1.lua.


------------------------------------------------------------------------
r13928 | batrick | 2009-06-27 04:43:12 -0700 (Sat, 27 Jun 2009) | 18 lines

[NSE] We now propogate a NSE initiated yield on a script through all user
coroutines so that NSE may resume control. Previously, scripts that would yield
in a child coroutine (e.g. a script's child coroutine generated by Lua's
coroutine.create function) would give control back to the script. A script
would yield in this way by making a blocking socket operation. NSE would be
unable to correctly resume child coroutine when the socket operation is
finished processing.

By yielding the chain of coroutines a script has operating, we allow to NSE to
handle the socket operation properly. NSE would then resume the entire chain so
execution may correctly resume at the coroutine which initiated the socket
operation. This restores the "illusion" that a script executes without
interruption.

See [1] for more information, further explanation, and some use cases.

[1] http://seclists.org/nmap-dev/2009/q2/0586.html

------------------------------------------------------------------------
r13817 | david | 2009-06-18 15:57:29 -0700 (Thu, 18 Jun 2009) | 3 lines

Improve an OS fingerprint with a model number and broader matching.
Based on a follow-up report from a submitter.

------------------------------------------------------------------------
r13814 | josh | 2009-06-17 21:34:15 -0700 (Wed, 17 Jun 2009) | 3 lines

[zenmap] Added support to zenmap for the new SCTP options: -PY, -sY and -sZ


------------------------------------------------------------------------
r13797 | ron | 2009-06-17 11:02:18 -0700 (Wed, 17 Jun 2009) | 1 line

Applied a patch from Mak Kolibabi that enhances the output of smb-enum-processes. The output is now modeled after the output of the 'ps' tool for higher verbosity levels.
------------------------------------------------------------------------
r13795 | david | 2009-06-17 09:05:21 -0700 (Wed, 17 Jun 2009) | 6 lines

The configure script now allows cross-compiling by assuming that
libpcap is recent enough. Previously it would quit because a test
program could not be run. libpcap will always be recent enough when
the included copy is used. The patch was contributed by Mike
Frysinger.
2009-06-29 23:48:19 +00:00
david
aef834cd12 Do a print_debug in ssh2.lua when an incomplete packet is processed. 2009-06-14 17:52:47 +00:00
ron
ab59b09c03 Miscellaneous code cleanups in my smb-* libraries/scripts (removed unused includes, old debug code, etc.) 2009-06-10 23:13:15 +00:00
bmenrigh
7c63ab6bcd Adding the imap-capabilities script and supporting imap library.
The imap-capabilities script is mostly feature-complete but I could
see adding some analysis code to warn users of non-SSL'd IMAP servers
that offer STARTTLS without NOLOGIN.

The imap "library" is really a joke.  It does the minimum required to
support getting capabilities and nothing more.  IMAP requires each
command to use a unique identifier like 000, 001, 002, etc.  Right now
the identifier is hardcoded to a001.  To make a real imap library that
supports logging in, and other IMAP features a state variable will
have to be maintained to change the command uid.  It would be nice to
see the library get updated so that IMAP brute-forcing could be
supported.
2009-06-08 23:21:56 +00:00
batrick
3eba69f9f8 Removed packet.hextobin and packet.bintohex. Both are unnecessary
with the struct (bin) library available:

function hextobin(str) return bin.pack("H", str) end
function bintohex(str) return bin.unpack("H", str) end

Also removed a commented copy that was in the sniffer-detect.nse script.
2009-05-28 03:59:02 +00:00
ron
c213cc97b1 Added an initial WebDAV vulnerability-detection attempt for testing 2009-05-19 20:56:07 +00:00
batrick
b32881993a [NSE] Significantly shortend hextobin function for packet module. 2009-05-06 08:32:59 +00:00
jah
d757338fa2 Fix http.table_augment which was preventing user-supplied HTTP headers from
being sent in HTTP requests.
2009-05-03 19:03:53 +00:00
jah
3235065a1e Fixed: dns.query() calls dns.sendPackets() with the wrong number of parameters
which makes the 'to' value in a for .. to loop of type 'nil' - causing:

nselib/dns.lua:54: 'for' limit must be a number
stack traceback:
	nselib/dns.lua:54: in function 'sendPackets'
	nselib/dns.lua:194: in function 'query'
2009-04-28 22:41:53 +00:00
ron
a251c563c3 fixed a <code> tag in smb.lua's NSEDoc 2009-04-19 17:44:45 +00:00
david
27e94c0b28 Remove documentation for the bit.cast NSE function, which doesn't seem
to exist.
2009-04-17 16:35:43 +00:00
ron
cd9098c48b Revert part of my previous commit -- forgot to remove some test code 2009-04-02 14:10:56 +00:00
ron
08fadd08fc Fixed a bug where the scan would hit a nil-pointer exception when scanning broken implementations (reported by Steve Horejsi -- http://www.skullsecurity.org/blog/?p=209&cpage=2#comment-219). This was due to using incorrect variable names. 2009-04-02 14:09:52 +00:00
ron
4b81a92681 Fixed a bug reported where running openssl.encrypt() on an emptys tring would cause an assertion failure. I fixed it by printing a warning message if an empty challenge is encountered and faking out the challenge (if they sent an empty challenge, they're breaking the protocol anyways). This will cause the login to fail, and it will fall back to an anonymous check. 2009-04-02 01:14:15 +00:00
ron
5939934979 Fixed a potential global variable mistake in smb-server-stats.nse 2009-04-01 18:23:18 +00:00
ron
74ffd7b4c7 Raise timeout for SMB scans to 20 seconds -- I got several error reports due to timeouts 2009-03-31 20:30:45 +00:00
ron
75b44c30ac Fix for forgotten endian-modifier (caused errors on Solaris) -- Stephane Rose pointed it out 2009-03-31 15:08:33 +00:00
ron
a0d8875867 Fixed a bug where MSRPC would try to sign messages using OpenSSL, even if it wasn't available 2009-03-30 21:32:41 +00:00
ron
9060d2fadd Modified smb-check-vulns.nse to check for Connficker infections. Got permission from authors of simple connficker scanner (scs.zip) to post this 2009-03-30 14:46:58 +00:00
ron
fa9a63bf0a Another typo fix 2009-03-12 18:27:52 +00:00
ron
80591c9cc6 Cleaned up output of smb-server-stats.nse 2009-03-12 14:56:23 +00:00
ron
9c6860615f Fixed a typo 2009-03-12 14:20:32 +00:00
ron
45744eddc3 Merge in changes from my private branch, primarily smb-brute.nse and smb-pwdump.nse, among other smaller changes. 2009-03-05 02:03:29 +00:00
david
54a8caae65 Make http.request conform to its documentation; it now interprets any header
fields passed to it and adds them to the request. Previously it ignored them,
relying on http.get to concatentate the header fields into a string for it.
2009-03-01 19:02:33 +00:00
david
62aa04c11a In dns-zone-transfer.nse, return "<parse error>" in case domain decoding fails.
otherwise there is an assertion failure trying to insert a nil into an output
table in tab.lua. Increase the maximum number of message compression pointers
we will follow in dns.lua from 3 to 10, because Brandon found a server that
used 4..
2009-02-27 20:16:29 +00:00
david
a173fe6ce1 Add the stdnse.sleep function. 2009-02-23 23:57:39 +00:00
david
9323b53c68 Fix NSEDoc in msrpctypes.lua. A <code> was unterminated, and bullet lists can't
have newlines within each entry.
2009-02-20 18:46:26 +00:00
david
d8c3cf21a5 Add missing module name prefixes to usage examples in some NSE documentation. 2009-02-17 19:53:02 +00:00
david
2d018963ca Use dns.decStr in dns-zone-transfer.nse instead of a custom DNS decoder. This
avoids an infinite recursion bug present in the old decoder. I raised the
number of compression pointers that dns.decStr will follow from 1 to 3 because
I found a server that sent 2.
2009-02-10 00:53:26 +00:00
ron
5ec608507a Backported a couple minor bugfixes from my experimental branch 2009-02-04 22:08:20 +00:00