1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-21 15:09:02 +00:00
Commit Graph

9911 Commits

Author SHA1 Message Date
dmiller
a72faf3906 Spellcheck on all Python files 2014-02-20 21:22:30 +00:00
dmiller
1575c63d7d Spellcheck for Ncat, Nping source files 2014-02-20 21:22:22 +00:00
dmiller
3f0d0c16f9 Spellcheck on Nmap, Nsock, Nbase source files 2014-02-20 18:44:12 +00:00
dmiller
b8873f42cd Better error reporting for smb-mbenum
Check for error 71 (0x47), which means the server is simply not a master
or backup browser and will not respond.

Also teardown the SMB session as far as it has been established, to be
nice.
2014-02-19 22:35:34 +00:00
dmiller
b3b5f8c377 Fix format-string bug: ./nmap -sC --script-args '%n' -ddd 2014-02-19 22:14:18 +00:00
dmiller
6e3980733e Use unicode library for msrpc/smb 2014-02-19 22:14:16 +00:00
dmiller
1ff0062589 Use unicode library for NTLM in sasl.lua 2014-02-19 22:14:14 +00:00
dmiller
743c90c24a Use nsedebug.tostr in unittest to more clearly show how tests fail. 2014-02-19 18:32:25 +00:00
dmiller
f17cc56bf9 New utility functions for transcoding to and from Windows Unicode
Windows uses UTF-16 little-endian. Since this is a common use case,
utility functions are provided such that this:

    x = unicode.utf16to8(v)

is equivalent to this:

    x = unicode.encode(unicode.decode(v, unicode.utf16_dec),
    unicode.utf8_enc)

but faster (fewer intermediate tables)
2014-02-19 18:32:23 +00:00
dmiller
a76990b9ae Fix off-by-one error in unicode.decode.
Would fail to decode the last character in a string.
2014-02-19 18:32:21 +00:00
dmiller
44a006a7cf Let json.lua use unicode.lua for utf8_enc 2014-02-19 17:08:31 +00:00
dmiller
1273cb4200 New unicode.lua library. Supports utf-8 and UTF-16 2014-02-19 17:08:30 +00:00
dmiller
210d50a1d9 Add table_equal test to unittest.lua
Checks that 2 tables have the same length and list values.
2014-02-19 17:08:27 +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
54fa265f5c Correct Namp -> Nmap throughout. 2014-02-19 04:15:21 +00:00
dmiller
1c0c090ace Refactor some Lua string concatenations.
Using this regular expression, '\(\w*\)\s*=\s*\1\s*\.\.', found and
replaced many string concatenation-reassignments. These can cause
performance issues, since a new string gets allocated for each
reassignment. In many cases, the replacement is simply a single string,
wrapped across lines with the '\z' escape, which consumes a newline and
whitespace following it. In other cases, a table is used to hold the
substrings until the final string is built with a single table.concat
operation (same technique used in stdnse.strbuf).

Also, some string-building loops of this form:

s = ""
for i = 1, 100, 1 do
  s = s .. "\0"
end

were replaced with this much faster and cleaner version:

s = string.rep("\0", 100)
2014-02-18 18:10:23 +00:00
fyodor
74ebf1c892 remove an orphan parameter from fatal() call. Problem noted by Gisle Vanem 2014-02-14 06:17:53 +00:00
dmiller
ad2c9874b3 NSE structured output for ssh-hostkey when checking known_hosts 2014-02-13 20:36:42 +00:00
dmiller
748b2d0df4 Update mysql-info to use mysql.lua
Also added structured output and support for more capabilities.
2014-02-13 18:46:19 +00:00
dmiller
ac5a89a8e1 Remove unused NSE library requires
for lib in nselib/*.lua*; do l=${lib#*/}; l=${l%.lua*}; find . -name \
  \*.lua -o -name \*.nse | xargs grep -l "require .$l\>" | xargs grep \
  -c "\<$l\." | grep ':0$' | awk -F: '{print "'$l'", $1}'; done

Did not remove calls to stdnse.silent_require since these can be used to
abort script execution if OpenSSL is not included, even if the script
does not directly call openssl.* (perhaps it uses comm.tryssl instead,
for instance).

Also did not remove require "strict", since that library is special and
modifies the environment.
2014-02-13 16:39:17 +00:00
dmiller
4c3b6cb32f Make http-slowloris use the Nmap user agent
This can now be changed with --script-args http.useragent=X
2014-02-13 16:39:11 +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
b73c3aa60f Wrap long lines in NSE (>200 columns)
Mostly in documentation (the description field, for instance), but also
some long literal strings. Lua 5.2 introduces a string escape, "\z",
which escapes any amount of subsequent whitespace, including newlines.
This can be used to wrap string literals without upsetting indentation.
http://www.lua.org/manual/5.2/manual.html#3.1
2014-02-13 15:47:35 +00:00
dmiller
c9714990c7 Remove trailing whitespace from C/C++ files
https://secwiki.org/w/Nmap/Code_Standards
2014-02-12 20:25:51 +00:00
dmiller
2896c21989 Convert some file encodings from ISO-8859-2 to UTF-8
https://secwiki.org/w/Nmap/Code_Standards
2014-02-12 19:49:43 +00:00
henri
c9fe124e3d Moved variable definitions to the beginning of the block 2014-02-12 19:09:44 +00:00
dmiller
d67464dda2 -sn -v --open will now hide down hosts
http://seclists.org/nmap-dev/2014/q1/158
2014-02-12 18:47:40 +00:00
dmiller
6a98f70197 More DNS TCP support from John Bond
http://seclists.org/nmap-dev/2014/q1/154
2014-02-12 17:08:40 +00:00
d33tah
9365d50cad Fix coding style. 2014-02-12 09:50:27 +00:00
d33tah
b53187bad7 Apply a patch related to MSVC, reported by Gisle Vanem: http://seclists.org/nmap-dev/2014/q1/161 2014-02-12 09:49:39 +00:00
dmiller
298c42d3b4 Update the usage examples in match.lua
The example uses of nmap.receive_buf() were missing the second
parameter, keeppattern. Also referenced the match library from
nmap.receive_buf's NSEdoc to avoid reimplementations of buffered
sockets.
2014-02-10 19:39:09 +00:00
dmiller
4e7e7c04f0 Factor out some clutter in dnsbl.lua
The constructor for DNS blacklist service objects was identical in every
case. Factoring it out will reduce errors and complexity.
2014-02-10 19:39:07 +00:00
dmiller
4ea4977a37 Replace "buffered socket" classes with socket.receive_buf()
The match library has a helpful function for doing exactly this, with
less copy-and-pasted code:
http://nmap.org/nsedoc/lib/match.html#numbytes
2014-02-10 17:27:09 +00:00
henri
21b7e3818d [Ncat] Added support for socks5 and corresponding regression tests.
[Marek Lucaszuk, Petr Stodulka]
2014-02-09 14:10:04 +00:00
dmiller
a95788c783 [NSE] New script http-ntlm-info from Justin Cacak
http://seclists.org/nmap-dev/2014/q1/129
2014-02-07 18:24:17 +00:00
dmiller
bf26986685 Patch from Paul AMAR to fix http-vuln-zimbra-lfi
http://seclists.org/nmap-dev/2014/q1/130
2014-02-07 15:54:12 +00:00
dmiller
fb67a6717e Re-indent some libs and scripts, change 4 to 2-space indent
Mostly found with:

    for i in nselib/*.lua scripts/*.nse; do
      echo $(perl -lne 'BEGIN{$a=$p=0}next unless $_;/^(\s*)/;' \
        -e '$l=length$1;next if$l==$p;$a+=(abs($l-$p)-$a)/$.;' \
        -e '$p=$l;END{print$a}' $i) $i
    done | sort -nr

And indented with: https://gist.github.com/bonsaiviking/8845871

whois-ip.nse was particularly mangled (probably my fault due to using
vim's built-in indentation script, but it could be structured better)
2014-02-06 23:25:28 +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
a56f73effb Add NSEdoc to formulas.lua 2014-02-05 19:02:31 +00:00
dmiller
e5fc094635 Add some NSEdoc for smbauth.get_host_info_from_security_blob 2014-02-05 18:30:57 +00:00
dmiller
7dd47ec3a3 Re-indent the Lua files in nselib/data/
https://secwiki.org/w/Nmap/Code_Standards
2014-02-05 17:58:36 +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
henri
d5746993e2 Define nsi_delete() notify modes as enums.
These values aren't flags that can be ORed.
2014-02-03 20:53:09 +00:00
dmiller
961ea25225 Re-indent some NSE libraries.
https://secwiki.org/w/Nmap/Code_Standards
2014-02-03 19:47:34 +00:00
dmiller
63db1bfd12 Replace inline tabs with spaces.
Left some in the @output section, since libraries are apparently
emitting tab-separated tables (mysql or mssql)

https://secwiki.org/w/Nmap/Code_Standards
2014-02-03 16:49:26 +00:00
dmiller
31a2c432e1 Final re-indent for scripts. 2014-02-02 15:33:39 +00:00
dmiller
d309fecd12 Re-indent some more scripts. Whitespace-only commit
https://secwiki.org/w/Nmap/Code_Standards
2014-02-02 15:33:29 +00:00
dmiller
c7d4f2ec96 Re-indent some scripts. Whitespace-only commit
https://secwiki.org/w/Nmap/Code_Standards
2014-01-31 21:01:26 +00:00
dmiller
298be5bfaa Re-indent some scripts. Whitespace-only commit
https://secwiki.org/w/Nmap/Code_Standards
2014-01-31 17:36:09 +00:00
dmiller
bcf991c128 Add missing require in redis-info 2014-01-31 17:36:02 +00:00