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
078aa688c9 Reindent some scripts. Whitespace only.
https://secwiki.org/w/Nmap/Code_Standards
2014-01-31 16:37:27 +00:00
dmiller
32936167c2 Fix dns-fuzz portrule (was defaulting to tcp) 2014-01-31 15:32:23 +00:00
dmiller
b4994505c3 Add TCP support to dns-fuzz. Also suggest -sU in usage 2014-01-31 15:28:54 +00:00
dmiller
972d799143 Add TCP support to dns.lua
Slightly modified from patch from John Bond:
http://seclists.org/nmap-dev/2014/q1/118
2014-01-31 15:14:31 +00:00
dmiller
d36c08dcf5 Re-indent some scripts. Whitespace-only commit
https://secwiki.org/w/Nmap/Code_Standards
2014-01-31 13:02:29 +00:00
henri
64fb5b3482 Added safe fd_set operations.
Only FD_SET and FD_CLR were available. Added a FD_ISSET equivalent.
Implemented them as static inline instead of macros for consistency.

These functions abort() if the FD number is higher than FD_SETSIZE
(except on windows where no check is performed).
2014-01-30 19:02:57 +00:00
henri
bf872bf113 Extract and publish more information about redis.
* Get OS
  * Get redis version (and set it to port.version)
  * Get architecture (and set it to port.extraversion)
  * Make and set an application CPE
2014-01-30 18:35:25 +00:00
henri
1cb2aba30f Updated the redis scripts portrules. 2014-01-30 18:35:21 +00:00
henri
4f5be9bfab Designate the redis service as "redis".
This makes it consistent with the GET probe.
2014-01-30 18:35:13 +00:00
dmiller
4eaa21e7cb Integrate David's ssl-enum-ciphers improvements
From this thread: http://seclists.org/nmap-dev/2014/q1/105

* Extensions now better supported in tls.lua
* ssl-enum-ciphers sends all EC options to ensure servers reply with
  supported EC suites
* tls.lua supports multiple messages of a single type within 1 record
* tls.record_buffer will read an entire TLS record into a buffer
* ssl-date and tls-nextprotoneg updated to use tls.record_buffer
2014-01-30 18:12:14 +00:00
dmiller
83fd814a2c Really fix nsock's pcap configuration
This wasn't using Nmap's included libpcap if no options were specified,
instead compiling nsock without pcap support if no libpcap could be
found (which breaks Nmap)
2014-01-30 03:40:26 +00:00
dmiller
cd7df91ce0 Fix a bug introduced in r32678
string.gsub returns 2 values, the new string and the number of
replacements made. It also has a 4th argument, the number of
replacements to make. So when you use the return value of gsub as the
3rd argument, and no replacements were made, it instructs the next call
to not make any replacements. Thanks to Ron Bowes for reporting this
issue.
2014-01-29 13:24:30 +00:00
david
d6288c5280 Escape '%' in arguments to Thread:d.
A user reported this crash when scanning a target whose name contained
the '%' character:

NSE: Script Engine Scan Aborted.
An error was thrown by the engine: nse_main.lua:322: invalid capture index
stack traceback:
	[C]: in function 'gsub'
	nse_main.lua:322: in function 'd'
	nse_main.lua:377: in function 'start'
	nse_main.lua:912: in function 'run'
	nse_main.lua:1390: in function <nse_main.lua:1293>
	[C]: in ?

I'm not sure how a name with '%' got resolved, but I was able to
reproduce the crash by adding this line to /etc/hosts:
	127.0.0.1	a%40b
and then running
	./nmap --script=banner a%40b -d --top-ports 5

The gsub function recognizes "%d", where d is a digit, as a capture
index. The constructed string is then passed to print_debug, which is
like printf. Therefore we escape every occurrence of "%" twice, to get
"%%%%".
2014-01-27 22:56:29 +00:00
dmiller
1d9fa6bea2 Fix some bugs in sstp-discover reported on IRC 2014-01-27 19:13:22 +00:00
d33tah
e35d0a0c23 Add a comment to explain numIncompleteHostsLessThan. 2014-01-27 00:44:16 +00:00
dmiller
3bd86146ac Don't clean Ndiff if it wasn't built 2014-01-26 16:54:13 +00:00
dmiller
16505b5cc7 Nsock: let libpcap decisions set LDFLAGS, needed for make check 2014-01-26 16:38:24 +00:00
dmiller
2e047114f6 Improve support for non-included libpcap in nsock 2014-01-26 16:38:22 +00:00
dmiller
6251f85c9e Let nsock handle --with-libpcap in the same way as Nmap 2014-01-26 16:38:18 +00:00
dmiller
ef61c11831 Retab creds.lua (Fixes some nsedoc ugliness) 2014-01-23 21:52:38 +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
dmiller
86ac3c0a19 Whitespace fixing on packetdecoders.lua
Changed indentation to 2 spaces, converted \r\n line endings to \n,
changed line-internal tabs to single space, removed whitespace at line
endings, reindented entire file with vim.
https://secwiki.org/w/Nmap/Code_Standards
2014-01-22 18:26:02 +00:00
dmiller
db1d82ad1f Fixed global assignments with nse_check_globals
All fixes made by hand. A couple real bugs/errors fixed, due to
copy-paste of code from other scripts without changing variable names.
2014-01-22 17:45:00 +00:00
dmiller
8a07146936 Define in-use-but-undefined ScriptDBSyntaxError
Subclassed SyntaxError to provide some useful info when this happens. It
was happening with unittest.nse because it wasn't part of any category.
Previously, this would crash Zenmap because ScriptDBSyntaxError was
undefined. Now it crashes because there's really a syntax error (fixed
in previous revision)
2014-01-21 22:17:16 +00:00
dmiller
2ea4934bbf Add unittest.nse to 'safe' category 2014-01-21 22:17:13 +00:00
sophron
7b43ab1ff6 [NSE] Symbol '%' missing in the urls. 2014-01-20 14:44:45 +00:00
dmiller
726b259b20 Consolidate "contains" functions into stdnse.contains
These implementations were all functionally identical. The replacement
has an extra feature of returning the index where the value was found,
currently unused.
2014-01-16 22:57:33 +00:00
dmiller
197f28265f New function stdnse.format_mac
This function will format a MAC address as colon-separated hex bytes.
It's really very simple: stdnse.tohex(mac, {separator=":"})

This commit updates all the instances I could find of the varying
convoluted attempts at performing this conversion.
2014-01-16 21:50:30 +00:00
dmiller
a6b79f9976 Add CHANGELOG entry for tls library 2014-01-16 21:50:26 +00:00
dmiller
b61d378d3a Update script.db 2014-01-16 19:09:13 +00:00
dmiller
a998d97216 Add sstp-discover NSE script from Niklaus Schiess 2014-01-16 19:07:43 +00:00
dmiller
645ef2a0bd Update ssl-date to use tls lib 2014-01-16 18:10:04 +00:00
dmiller
760da1788f Let tls-nextprotoneg use tls.lua library
Required fixes to tls lib's extensions (did not previously support
extension data)
2014-01-16 18:10:02 +00:00
dmiller
35148980ef Update ssl-enum-ciphers to use tls.lua 2014-01-16 18:09:59 +00:00
dmiller
71b0769fc3 New tls.lua library for handling TLS records 2014-01-16 18:09:57 +00:00
dmiller
b083fb98e6 Update comm library NSEdoc
Document some missing options to the functions, and adjust an error
message to use the correct option name.
2014-01-15 20:11:39 +00:00
dmiller
3b5b0ba154 Note that HTTPS is supported by http NSE library 2014-01-15 16:52:46 +00:00
dmiller
55c7fb605f Improve performance of StringPool.unique
This saves a function call by using subclassing dict instead of using a
real dict. When a cache hit occurs, there is no overhead beyond a
standard dict lookup, which in most implementations is very fast. Cache
miss is similar performance to previous.

Also added a unittest for this functionality.
2014-01-15 15:37:25 +00:00
dmiller
2b2edabc80 Fix typo in Nmap XML parsing in zenmap 2014-01-14 23:18:30 +00:00
dmiller
c5a4ef91fb Add more unittests to ipOps 2014-01-14 23:18:28 +00:00
dmiller
8b70dfa0a4 Replace exception-as-flow-control pattern
In general, it's better to use explicit flow control than to throw
and/or catch generic exceptions. Example:

try:
    thing = d["key"]
except:
    pass

This 1. catches an inspecific exception (probably KeyError), 2. can be
replaced with a check for ("key" is in d), and 3. can often be replaced
with d.get("key", some_default_value).
2014-01-13 15:37:39 +00:00
henri
0b2a445ddd Use strjoin() instead of '..' to concatenate strings.
This significantly decreases CPU usage, that could reach
100% on large scans.
2014-01-13 08:35:00 +00:00
dmiller
4b34673a0b Add more complete unittests for ipOps.compare_ip 2014-01-11 15:05:43 +00:00
robert
0772a10895 Updated Nmap NSIS file to use WinPcap 4.1.3 installer. 2014-01-11 15:00:05 +00:00
robert
98ed1cb771 Updated WinPcap to 4.1.3. 2014-01-11 14:55:10 +00:00
dmiller
da0c947004 Enforce PEP 8 style on Ndiff
Issues fixed:

1       E111 indentation is not a multiple of four
1       E201 whitespace after '['
14      E251 no spaces around keyword / parameter equals
7       E301 expected 1 blank line, found 0
55      E302 expected 2 blank lines, found 1
69      E501 line too long (80 characters)
3       W291 trailing whitespace
4       W601 .has_key() is deprecated, use 'in'
2014-01-10 20:43:32 +00:00
dmiller
393b4b21ee Add Ndiff tests to "make check" 2014-01-10 16:26:42 +00:00
dmiller
434efb1266 Cause make check to run nmap --script=unittest 2014-01-10 16:26:40 +00:00
dmiller
098d3b9b1a Restore missing import of zenmapCore.I18N
This was causing make check to fail because _() was not defined
2014-01-10 16:26:38 +00:00
dmiller
4d5c493e8e PEP 8 style issues: space after comma, blank lines between defs 2014-01-09 22:33:29 +00:00