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

100 Commits

Author SHA1 Message Date
rewanth
6ee953a5ff Removes trailing spaces in 69 files. Closes #971. 2017-08-23 08:52:40 +00:00
paulino
ed0b960057 Adds new NSE library for SMB2/SMB3 and scripts smb-protocols,smb2-time,smb2-capabilities,smb2-security-mode,smb2-vuln-uptime. Closes #943 2017-07-28 09:01:02 +00:00
dmiller
dff7eca79f Fix some globals 2017-07-18 18:46:01 +00:00
waituck
b4e1daef74 Fixed bug in smb.lua share_get_list function to use anonymous connections first. Closes #904 2017-06-11 19:42:33 +00:00
paulino
b0228a212b Updates smb.lua and msrpc.lua to support fully qualified path names as share names and updates match for OID. Modern Windows versions require FQPN and older version work the same. The level of information requested with the call NetShareGetInfo was reduced to support newer versions of Windows. This closes #266, closes #704, closes #238, and closes #883. 2017-05-27 07:28:44 +00:00
dmiller
70e9d70a48 Avoid passing float to os.time. Fixes #588 2016-11-30 00:10:04 +00:00
batrick
7f5ec526fe Merge branch 'nse-lua53'
Lua 5.3 adds several awesome features of particular interest to nmap including
bitwise operators and integers, a utf8 library, and standard binary pack/unpack
functions.

In addition to adding Lua 5.3, this branch changes:

o Complete removal of the NSE bit library (in C), It has been replaced with
  a new Lua library wrapping Lua 5.3's bit-wise operators.

o Complete removal of the NSE bin library (in C). It has been replaced with a
  new Lua library wrapping Lua 5.3's string.pack|unpack functions.

o The bin.pack "B" format specifier (which has never worked correctly) is
  unimplemented.  All scripts/libraries which use it have been updated. Most
  usage of this option was to allow string based bit-wise operations which are no
  longer necessary now that Lua 5.3 provides integers and bit-wise operators.

o The base32/base64 libraries have been reimplemented using Lua 5.3's new
  bitwise operators. (This library was the main user of the bin.pack "B" format
  specifier.)

o A new "bits" library has been added for common bit hacks. Currently only has
  a reverse function.

Thanks to David Fifield, Daniel Miller, Jacek Wielemborek, and  Paulino
Calderon for testing this branch.
2016-07-02 17:02:27 +00:00
tomsellers
e2cfda9dc0 Change to smb-os-discovery to enable it to augment SMB version detection. Closes #348 2016-03-31 10:56:29 +00:00
dmiller
68599ce140 Solve "unexpected signature" message in SMB extended session setup (NTLM type 2 message only sent once) 2016-01-07 20:33:10 +00:00
dmiller
f4619edece Update http urls for nmap.org to https 2015-11-05 20:41:05 +00:00
henri
b1d6bcd9be nselib/smb: fix find_files function (next_item coroutine)
Patch by Pierre LALET <pierre.lalet@cea.fr>
2015-04-30 17:58:13 +00:00
dmiller
ea58c6bebb Replace chained concatenation reassignment with simple concatenation
Example:

x = y
x = x .. z

Fixed:

x = y
.. z

This simple fix would save 1 string creation/deletion. Most changes
involve many more than this.
2015-03-02 13:47:42 +00:00
dmiller
0e74dd7a35 Replace some string.char and bin.pack calls with literals 2015-02-27 19:42:56 +00:00
dmiller
4f0518bd93 Replace concat-loop padding with string.rep 2015-02-27 14:55:42 +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
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
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
dmiller
17c3e9755e NSEdoc cleanup.
1. The first paragraph of a function's NSEdoc is used as a short
summary. Some of these were very long, so I split off a shorter summary.

2. Use asterisks (*) to denote bulletted lists, not 'o'

3. Wrap lines at 80 columns

4. a couple other spelling and formatting fixes
2014-03-10 19:01:19 +00:00
dmiller
6e3980733e Use unicode library for msrpc/smb 2014-02-19 22:14:16 +00:00
dmiller
1b71f75aad Spelling fixes for Lua files
Mostly in documentation/comments, but a couple code bugs were caught,
including a call to stdnse.pirnt_debug and a mis-declared variable.
2014-02-19 04:15:46 +00:00
dmiller
a084340b6d Remove useless calls to string.format
stdnse.print_debug accepts a format string and arguments, making
string.format redundant in calls of this form:

stdnse.print_debug(1, string.format("%s: error", SCRIPT_NAME))
stdnse.print_debug(("length %d"):format(#tab))

These can be rewritten as:

stdnse.print_debug(1, "%s: error", SCRIPT_NAME)
stdnse.print_debug("length %d", #tab)
2014-02-13 15:47:41 +00:00
dmiller
96c1a4f46b Another reindent pass on smb.lua, this time fully automated
Using Vim and this indent script:
https://gist.github.com/bonsaiviking/8845871
2014-02-06 15:53:34 +00:00
dmiller
69e343f0aa Reindent the last of the NSE libraries.
https://secwiki.org/w/Nmap/Code_Standards
2014-02-04 19:47:26 +00:00
dmiller
620f9fdb34 Remove trailing whitespace in lua files
Whitespace is not significant, so this should not be a problem.
https://secwiki.org/w/Nmap/Code_Standards
2014-01-23 21:51:58 +00:00
patrik
81b6bae5eb Squashed commit of the following:
commit e5cb0a18d5474730310f1797016e1106c33ca059
Author: Patrik Karlsson <patrik@cqure.net>
Date:   Sun Oct 7 10:47:35 2012 +0200

    compatibility fixes to spnego authentication in smb and smbauth libraries

    the spnego authentication blob now decodes properly in wireshark
    fixes in spnego authentication for both Window 2003 and Windows 7
2012-10-07 08:54:34 +00:00
david
d9b73da3a1 Give sample return values for smb.get_os. 2012-09-08 17:05:33 +00:00
dmiller
9fbd30f191 Use ISO8601 time for smb-os-discovery 2012-08-16 15:46:37 +00:00
aca
6fec00655d Added smb-ms10-054 vuln check script to trunk 2012-07-23 09:52:38 +00:00
batrick
4ef2bb978a add appropriate comment 2012-07-09 17:06:04 +00:00
patrik
c80a28f5f2 Add netbios name lookup caching code in order to avoid multiple lookups for
the same host.ip.
2012-06-15 21:26:26 +00:00
patrik
bb359adaa1 Played a round of nse_check_globals and fixed a bunch of reported problems. 2012-06-15 19:32:36 +00:00
patrik
e6a42c9291 fix to get smb-enum-shares working on Windows 2008 and Windows 7 2012-06-13 20:35:50 +00:00
patrik
44b46bb148 Fixed global declarations in smb.lua 2012-06-11 17:40:21 +00:00
patrik
71e26189f6 o [NSE] More Windows 7 and Windows 2008 fixes for the smb library and smb-ls
scripts. [Patrik Karlsson]
2012-06-10 22:40:02 +00:00
patrik
bc0defc8ff o [NSE] Added SPNEGO authentication supporting Windows 7 and Windows 2008 to
the smb library. [Patrik Karlsson]
2012-06-09 12:17:01 +00:00
patrik
721ac80024 reverted previous commit, due to unfinnished changes in smb, asn1 and smbauth
libraries.
2012-06-06 22:04:28 +00:00
patrik
c4617f8d31 Fixed a bunch of errors reported by Ron Bowes;
http://seclists.org/nmap-dev/2012/q2/639
2012-06-06 21:57:00 +00:00
batrick
be0af7b304 Add some missing library requires. Patch generated by
$ nse_check_globals --patch

with some modifications for format consistency.
2012-06-05 15:21:54 +00:00
patrik
0372cf9e7a o [NSE] Added the script smb-ls that lists files on SMB shares and produces
output similar to the dir command on Windows. [Patrik Karlsson]
2012-06-03 18:10:49 +00:00
david
587cc517c3 Fix smb library shadowed parameters.
This happened as an unintentional side effect of Lua 5.2 changes. The
fix is by Daniel Miller.

http://seclists.org/nmap-dev/2012/q2/530
2012-05-29 21:05:39 +00:00
batrick
000f6dc4d9 Lua 5.2 upgrade [1] for NSE.
[1] http://seclists.org/nmap-dev/2012/q2/34
2012-05-27 08:53:32 +00:00
henri
5594173c17 Fixed a couple additional typos:
compatiable -> compatible
  prefered -> preferred
  connectiosn -> connections
  statis -> status
2012-01-30 10:19:22 +00:00
henri
49a61f0fa6 Fixed typo (functino -> function). 2012-01-30 10:05:18 +00:00
tomsellers
b5cb7a96fc Modified start_session_basic so as to return the
status code text when the variable status is not
nil.  This mimics the behavior of start_session_extended.

This should provide more reliable results to smb-brute
concerning the nature of login failure reasons.

More detail has been sent to the mailing list.
2011-09-03 17:01:13 +00:00
patrik
23d2e0d31f o [NSE] Applied patch from Chris Woodbury that adds the following additional
information to the output of smb-os-discovery:
  + Forest name
  + FQDN
  + NetBIOS computer name
  + NetBIOS domain name
2011-07-12 06:08:43 +00:00
batrick
4444071f03 use # length operator instead of string.len (canonicalize)
Used this perl command:

$ # perl -pi -e 's/string\.len\((.*?)\)/#\1/g' *.lua

Also fixed one instance where the above command didn't correctly
translate the intended code (string.len(a .. b .. c)).
2011-05-11 15:08:55 +00:00
ron
01f5e7cf51 Added a patch from Chris Woodbury that fixes a serious bug in the SMB Authentication library, where multiple concurrent scripts with valid credentials would fail to log in. 2011-04-28 23:00:01 +00:00
david
3447e2a6a2 Use get_script_args to handle smb-related flag options, to use our
common true/false logic and not hardcode "1" and "true" in places. Patch
by Chris Woodbury.
2011-04-20 21:35:10 +00:00
patrik
58edddaedb o [NSE] Merged the ms-sql branch with several improvements and changes to the
ms-sql scripts and library:
  - Improved version detection
  - Improved server discovery
  - Add support for named pipes
  - Add support for integrated authentication
  - Add support for connecting to instances by name or port
  - Improved script and library stability
  - Improved script and library documentation
 [Patrik Karlsson, Chris Woodbury]
2011-02-26 22:41:10 +00:00
ron
d33c79c65f Removed some duplicate shares for bruteforcing, alphabetized the list, and added TEMP and SHARE - all thanks to Chris Woodbury's suggestions 2011-02-09 04:22:15 +00:00