1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 13:11:28 +00:00
Commit Graph

57 Commits

Author SHA1 Message Date
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
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
ron
727661921a Implemented some changes (mostly in error handling) to let smb scripts run in parallel with each other against a single host. Previously, I had used a mutex to prevent that from happening. The changes are summarized in the following post: http://seclists.org/nmap-dev/2010/q3/819, but it comes down to three things:
1) Set the 'vc' ('virtual circuit') id to a non-zero value (if it's 0, the smb server will disconnect all hosts who are already connected)
2) Handle the authentication error NT_STATUS_REQUEST_NOT_ACCEPTED, which indicates that there are too many connected hosts (11 is the default on most versions of Windows, or 10 for the anonymous account). If we see the error, we wait and try again. 
3) Handle the file creation error, NT_STATUS_PIPE_NOT_AVAILABLE, which appears to be caused by a race condition of some sort. It happens when a large number of connections are attempted simultaneously, and is fixed by a short backoff (50ms worked fine, but I'm using 100ms)
The end result is a significant speedup in our SMB checks without losing data.
2010-10-03 22:40:41 +00:00
ron
2035b82dfd Fixed a really tricky bug that I spent all evening chasing. Normally, during login, every account in the list (by default, guest and anonymous) are attempted. Unless something fails badly, anonymous will work. Unfortunately, if something DOES fail badly, after the first script runs this list is empty. That means if something bad is happening, and two or more scripts are running, every script after the first will have an empty list of accounts to use, and it would fail mysteriously. This patch checks the return value from the get_next_account() function properly to see if we've run out of accounts and report that to the user rather than an ugly stacktrace. 2010-09-24 00:47:43 +00:00
david
3c89e089fc Change calls in these forms:
socket:connect(host.ip, port.number)
socket:connect(host.ip, port.number, port.protocol)

to this:

socket:connect(host, port)

connect can take host and port tables now, and the default protocol is
taken from the port table if possible.
2010-08-16 18:59:30 +00:00
ron
934cf2edf0 Significant changes, both bugfixes and best practice changes, to smb-psexec.nse. Primarily:
o It no longer uses the global environment to store the modules table
o It now uses loadfile() to load the configuration files, which follows best practices better
o The module() line at the top of the configuration files is no longer required, but if it exists all that happens is a warning is printed
o Worked around what appears to be a bug in one person's Nmap install where absolute paths didn't resolve properly -- I couldn't replicate, but he confirmed it was fixed
2010-08-07 19:36:47 +00:00
david
7d0c08a097 Brief copyediting of NSEDoc for modules. 2010-07-12 19:42:43 +00:00
ron
50b9af97b6 Added extra 'overrides' calls all over smb.lua. They're required for some modifications to smb-check-vulns.nse I'm planning. 2010-05-15 15:57:01 +00:00
drazen
f41a94622a --A small formating fix. 2010-05-11 18:31:47 +00:00
ron
cb60803ad1 Fixed a couple bugs in the smb-* scripts involving undeclared variables. These only cropped up if the guest/anonymous accounts were disabled, which I'd never seen before. 2010-04-18 13:43:27 +00:00
david
5fa554266b Fix NSEDoc. 2010-03-31 20:28:14 +00:00
david
87fbf1df1e Recognize NT_STATUS_INVALID_PARAMETER as a known error code when testing
if a share is writable (along with NT_STATUS_ACCESS_DENIED). I got this
code from a printer share.
2010-02-12 23:14:37 +00:00
ron
ba9532c2d4 Changed an error message throughout smb.lua that I never really liked. 2010-01-23 17:25:30 +00:00
ron
b00f6234d5 Fixed some bugs found by Brandon Enright in smb.lua. They were all caused by servers returning less bytes than they're supposed to. This revision basically makes the broken-server detection more robust. 2010-01-23 17:23:57 +00:00
ron
13f8f95a5f nmap_service.exe is now encoded locally by xor'ing each byte by 0xFF. It is decoded in line before it is uploaded. This is to prevent antivirus false positives from picking it up. 2010-01-23 16:56:49 +00:00
ron
c4237f60b0 Updated smb-psexec to finally work on Windows XP, after countless months of it eating away at me. The issue turned out to be an innocuous field in the SMB header, 'process id', which is generally used for connection multiplexing. Apparently, not setting it causes a bug in Windows to surface (I assume it's a bug, anyways) that returns a weird failure code. I found this thanks to Kristof Boeynaems doing some research for me, and then me trying random things to make my packets look more like metasploit's. 2010-01-06 03:10:27 +00:00
ron
efcb11b1b0 Reduced the number of connections/traffic used by smb-enum-shares.nse by half. I was checking a random share to see if the right error is returned for every share, when it only actually had to be done once. 2009-11-20 17:00:55 +00:00
ron
7d67b08e66 Merged in my changes from nmap-smb. The primary changes are:
* Updated the way authentication works on smb -- it's significantly cleaner now
* smb-enum-shares.nse gives significantly better output now (it checks if shares are writable)
* Added a script that checks if smbv2 is enabled on a server
* Added smb-psexec, a script for executing commands on a remote Windows server. I also included some default scripts, a compiled .exe to run everything, and a ton of documentation (in the form of NSEDoc)
* Added 'override' parameters to some of the functions in smb.lua, which lets the programmer override any field in an outgoing SMB packet without modifying smb.lua. 
* Lots of random code cleanups in the smb-* scripts/libraries
2009-11-08 21:31:06 +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
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
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
ron
a251c563c3 fixed a <code> tag in smb.lua's NSEDoc 2009-04-19 17:44:45 +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
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
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
80591c9cc6 Cleaned up output of smb-server-stats.nse 2009-03-12 14:56:23 +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
b504fb78fa Fix some NSEDoc errors. 2009-01-13 00:18:46 +00:00
ron
67f9577de9 No longer erroring if a server leaves out the 'domain' section of packets (some configurations of Samba seem to do this) 2008-12-24 20:36:30 +00:00
ron
773000b65a Merging changes from my experimental branch; the new versions of this scripts, which have significant changes to their core functionality, managed to hold their own against Brandon's network. More testing would be very helpful, though, especially with credentials (most of Brandon's scans were anonymous). 2008-12-24 00:53:01 +00:00
ron
32f6181224 Updated some error messages for more clarity, and added a number after them to help track back issues that may arise. 2008-12-08 15:06:17 +00:00
ron
80dec40366 Added some more DOS constants that Brandon ran across 2008-12-08 03:48:23 +00:00
ron
ea42f39faa Merged in significant changes to Microsoft RPC calls 2008-12-07 16:16:11 +00:00
ron
158423041a Fixed some minor bugs in smb.lua (functions returned the wrong value in some cases) 2008-11-19 00:27:35 +00:00
ron
b53edf3d62 Merging in change to how SMB mutexes are handled (should improve speed significantly for parallel scans) 2008-11-16 16:53:08 +00:00
ron
82ce5f2a92 Merge from /nmap-exp/ron/ms08-067-test 2008-11-10 16:23:12 +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
e0a3c5c64f Abbreviate the summaries of the smb and msrpc modules. 2008-11-04 00:20:22 +00:00
david
5fffad15eb Canonicalize script args in smb.lua. Canonicalize @copyright lines in
netbios.lua, smb.lua, and msrpc.lua.
2008-11-03 23:47:22 +00:00
david
5e6e7151e9 Fix a few small NSEDoc errors. 2008-11-03 20:26:16 +00:00
david
cc7a58cd7a Merge from /nmap-exp/ron/nmap-smb. This adds the new scripts
smb-serverstats.nse, smb-enumsessions.nse, and smb-enumshares.nse.
2008-11-03 20:00:24 +00:00
david
2cceb5184c Separate the first paragraph from the rest of the description with a blank
line, not "\n\n", in the SMB and MSRPC scripts and modules. There are newer
versions of these files pending review, so this is just a quick measure to let
me use first paragraphs as summaries rather than first sentences.
2008-11-03 16:17:07 +00:00
david
7c59faa380 Fix a syntax error in smb.lua. (My fault, it happened while I was testing
documentation markup.)
2008-10-24 22:02:22 +00:00