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

24 Commits

Author SHA1 Message Date
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
dmiller
e5871dcc83 Clarify some @usage, fix double --script-args in telnet-brute 2015-12-19 15:25:44 +00:00
dmiller
f4619edece Update http urls for nmap.org to https 2015-11-05 20:41:05 +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
batrick
a19c9eb461 stdnse.print_verbose -> stdnse.verbose1
$ sed -i 's/stdnse.print_verbose( *\([0-9]*\) *, *" *%s *:* *\([^"]*\)" *, *SCRIPT_NAME/stdnse.verbose\1("\2"/' *.nse
$ sed -i 's/stdnse.print_verbose( *" *%s *:* *\([^"]*\)" *, *SCRIPT_NAME/stdnse.verbose1("\1"/' *.nse

and some manual corrections.
2014-08-02 18:32:26 +00:00
batrick
810f7d4803 more stdnse.print_debug -> stdnse.debug
This is a catchall pattern with a few exclusions.

$ sed -i 's/stdnse.print_debug( *\([0-9]*\) *, *\(.*\))/stdnse.debug\1(\2)/' *.nse
$ sed -i 's/stdnse.print_debug(\(.*\))/stdnse.debug1(\1)/' *.nse

Excluded:
$ svn revert db2-das-info.nse
$ svn revert flume-master-info.nse
$ svn revert http-headers.nse
$ svn revert http-methods.nse
$ svn revert http-unsafe-output-escaping.nse
$ svn revert http-userdir-enum.nse
$ svn revert http-vuln-cve2011-3192.nse
$ svn revert http-vuln-wnr1000-creds.nse
$ svn revert http-wordpress-plugins.nse
$ svn revert telnet-brute.nse
2014-08-02 02:46:16 +00:00
batrick
5e9a8d0777 more stdnse.print_debug -> stdnse.debug
This one also fixes format string bugs:

stdnse.print_debug(foo) --> stdnse.debug1("%s", foo)

$ sed -i 's/stdnse.print_debug( *\([a-zA-Z0-9][a-zA-Z0-9_]*\) *)/stdnse.debug1("%s", \1)/' *.nse
$ sed -i 's/stdnse.print_debug( *\([0-9]*\) *, *\([a-zA-Z0-9][a-zA-Z0-9_]*\) *)/stdnse.debug\1("%s", \2)/' *.nse
2014-08-02 02:18:48 +00:00
dmiller
31a2c432e1 Final re-indent for scripts. 2014-02-02 15:33:39 +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
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
fyodor
c9d610ccea Create a new brute category for brute forcing scripts, move the *-brute scripts from auth category to brute. document it. I don't know what to do with dns-brute so I left it alone (it wasn't in auth category either) 2011-09-30 06:18:55 +00:00
tomsellers
b841ee37b7 a couple more adjustments to account status handling in brute scripts.
Revert wording in oracle-brute.nse, add support for new category in ldap-brute.nse and reflect new wording in examples in afp-brute.nse
2011-09-13 01:44:30 +00:00
tomsellers
035ae9e9b1 Updated account status text in brute force password discovery scripts in an effort to make the reporting more consistent across all scripts. This will have an impact on any code that parses these values.
In the case of a few of these scripts the only thing that was updated was the example text as the scripts relied on the creds library which handles the strings internally.
2011-09-11 12:13:13 +00:00
tomsellers
ee676fab14 Added support for specifying a UPN suffix to be appended to usernames when brute forcing Microsoft Active Directory accounts. This should provide more reliable tests against domains that have been heavily organized into OUs or have child domains with a single UPN suffix. The UPN suffix can guessed or found via a null LDAP bind by ldap-rootdse.nse. 2011-09-09 23:57:21 +00:00
tomsellers
e20ea237ef Added ability to save discovered credentials to a file via the creds nse library. 2011-09-04 18:01:45 +00:00
tomsellers
5b512f0914 ldap-brute: Added feedback to -vv output when a valid
user/password combination is found.
2011-09-03 04:15:28 +00:00
tomsellers
e7b2ffe7c8 Tweaked ldap-brute.nse to work correctly when the target AD implementation is 2008 R2 and perhaps other sources.
Added detection of accounts where the credentials are correct, but the account is expired, not allowed to log on at the time of the scan or has been limited to logging in from particular hosts.

Notes on these changes were sent to the mailing list.
2011-08-08 00:26:02 +00:00
paulino
26dc09ad43 Gets arguments with stdnse.get_script_args instead of reading them from nmap.registry 2011-07-27 03:28:13 +00:00
patrik
356c1e12a9 fixed the following bug reported by Ron
./scripts/ldap-brute.nse:75: attempt to get length of local 'contexts' (a nil value)
stack traceback:
       ./scripts/ldap-brute.nse:75: in function 'get_naming_context'
       ./scripts/ldap-brute.nse:121: in function <./scripts/ldap-brute.nse:95>
       (tail call): ?
2010-11-04 18:53:56 +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
david
bccb8ead89 Edit some script descriptions for better line breaks when rendered as
PDF. Some long URLs were replaced by short redirects under
http://nmap.org/r/.
2010-07-17 16:47:31 +00:00
david
b9633ed69b Do copyediting of NSEDoc. This is a first pass up to ms-sql-xp-cmdshell. 2010-07-09 23:32:18 +00:00
david
3915ed94e4 Remove explicit timelimit checking from ms-sql-brute, pgsql-brute,
mysql-brute, ldap-brute, and afp-brute. The unpwdb library does this
automatically now.
2010-04-16 02:11:12 +00:00
patrik
42da3e0ba0 o [NSE] Added a new library for LDAP and two new scripts:
- ldap-brute uses the unpwdb library to guess credentials for LDAP
  - ldap-rootdse retrieves the LDAP root DSA-specific Entry (DSE)
2010-02-21 08:52:44 +00:00