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

9911 Commits

Author SHA1 Message Date
dmiller
2ad3aafa71 Integrate 584 service submissions (http) 2014-10-08 14:33:45 +00:00
sophron
4651a8f4ae [NSE] Updated http-robtex-* scripts to match current robtex API. 2014-10-08 01:39:30 +00:00
dmiller
b4988f1f5b Improvements to http-server-header
If service scan failed to find a match, the probe responses are cached.
Now http-server-header will look through those responses before sending
a probe of its own. This should result in better detection with fewer
probes sent.

Also changed the Server header string match to case-insensitive.
2014-10-01 19:54:34 +00:00
dmiller
58f1b845d6 Let lpeg-utility.escaped_quote only remove escaped escapes and quotes 2014-10-01 17:56:19 +00:00
dmiller
092c19a702 Integrate 84 service fingerprint submissions (ftp, ftp-proxy) 2014-09-30 14:05:33 +00:00
dmiller
a93781df6f run sv-tidy and correct some errors 2014-09-29 12:09:49 +00:00
dmiller
6bb3a7ae34 Integrate 363 service fingerprint submissions (ssh & telnet) 2014-09-29 01:37:09 +00:00
dmiller
f9abb3108c Streamline starttls functions for smtp, pop3, and imap 2014-09-24 20:31:47 +00:00
dmiller
3e2ac00e55 Leverage ftp and comm libs in sslcert.lua
This should result in faster (comm.lua's timeouts) and more reliable
(ftp.lua's response processing) STARTTLS for FTP
2014-09-24 20:31:45 +00:00
dmiller
278450ce94 Fix a script crash when comm.opencon was called without opts 2014-09-24 20:31:44 +00:00
dmiller
23d4abd5e9 New docker-version script
http://seclists.org/nmap-dev/2014/q3/265
2014-09-24 20:31:42 +00:00
dmiller
a472ea34ab Major improvements to http-form-brute
Credit nnposter: http://seclists.org/nmap-dev/2014/q3/479
2014-09-23 13:42:00 +00:00
dmiller
99cc5102c3 Correct a typo: tables don't work like strings 2014-09-23 13:41:58 +00:00
dmiller
e42409be93 XML structured output for brute.lua and creds.lua
The @xmloutput section documentation is not done, and I'm not sure how
to best do it, since it will be the same for all brute.lua scripts. This
is how it looks:

metasploit-msgrpc-brute:
<table key="Accounts">
  <table>
    <elem key="username">root</elem>
    <elem key="state">Valid credentials</elem>
    <elem key="password">root</elem>
  </table>
</table>
<elem key="Statistics">Performed 3 guesses in 4 seconds, average tps: 0</elem>

creds-summary:
<table key="127.0.0.1">
  <table key="9929/nping-echo">
    <table>
      <elem key="password">123456</elem>
      <elem key="state">Valid credentials</elem>
    </table>
  </table>
  <table key="55553/unknown">
    <table>
      <elem key="username">root</elem>
      <elem key="state">Valid credentials</elem>
      <elem key="password">root</elem>
    </table>
  </table>
</table>
2014-09-23 05:23:19 +00:00
dmiller
aaf7838b10 Improve error handling in comm.opencon and tryssl 2014-09-23 05:23:17 +00:00
dmiller
b8d2327c5e Correct some field typos in creds.Account 2014-09-23 05:23:16 +00:00
dmiller
f37ac44380 Move brute.Account to creds.Account
In addition to fitting better (brute library is the verb, creds library
is the noun), this will allow creds.lua to use creds.Account internally
where necessary (see subsequent commits)

Also change old references to string argument "OPEN" into
creds.State.VALID.
2014-09-23 05:23:13 +00:00
dmiller
379759d539 Avoid __pairs metamethod in stdnse.keys
This allows stdnse.keys to be used in a __pairs metamethod to, for
instance, yield keys in sorted order. Using next() bypasses the __pairs
metamethod that would be called when pairs() was used. Otherwise,
infinite recursion was possible.
2014-09-23 05:23:06 +00:00
fyodor
4312ef5133 Add docker ports 2014-09-22 18:08:14 +00:00
dmiller
a101e58a4c Abstract case-insensititive html tag searching 2014-09-20 14:49:57 +00:00
dmiller
ed9ecc54ea Improve html form parsing, patch from nnposter
http://seclists.org/nmap-dev/2014/q3/418
2014-09-20 14:49:55 +00:00
dmiller
1d5da8bccb Get rid of redundant/useless tonumber()s in script arg processing 2014-09-20 06:03:25 +00:00
dmiller
47d31171b0 Some NSE globals cleanup. 2014-09-20 05:40:49 +00:00
dmiller
0224e0515a Make http-vuln-wnr1000-creds actually return something 2014-09-20 05:40:47 +00:00
dmiller
bf457ee12c Normalize some timeouts in scripts
Added use of stdnse.parse_timespec for timeout args. Used comm.lua
default timeouts in a couple cases. Corrected 2 cases of incorrect
documentation ("Default 60" when the default was 30 seconds).
2014-09-20 05:40:46 +00:00
dmiller
5db940fc70 Update http-server-header in a few ways
1. Use "softmatched" to let Nmap print the service fingerprint for the
user to submit.

2. Run even if version detection got a good match. This allows it to be
run by-name, or to provide additional info if available. Existing match
will not be clobbered, though.

3. Use comm.lua's default timeouts. Also, no need to pass port.protocol,
since comm.tryssl will use the port table directly.

4. XML output
2014-09-20 05:40:44 +00:00
dmiller
d50436def8 Let scripts set/preserve port.version.service_fp
Previously, calling nmap.set_port_version would delete a service
fingerprint if it existed. Now, setting probestate to anything but
"hardmatched" will preserve the fingerprint, if it exists. This allows
scripts (like http-server-header) to use "softmatched" to set version
info but still encourage users to submit fingerprints.
2014-09-20 05:40:43 +00:00
fyodor
0351db35b9 Update copyright year to 2014 2014-09-19 04:32:58 +00:00
dmiller
791566faf0 Let imap and pop3 use shorter connect timeouts 2014-09-19 03:10:10 +00:00
dmiller
45ff211483 Refactor smtp.connect to use comm.opencon 2014-09-19 03:10:09 +00:00
dmiller
004851bb06 Reindent comm.lua (whitespace-only) 2014-09-19 03:10:07 +00:00
dmiller
77a1c5c79c Some comm.lua internal changes
1. export the comm.opencon function. Does all the connect/request
timeout, recv_before, and first data payload stuff that tryssl does, but
without trying SSL. Ought to save some boilerplate in some scripts

2. Make opencon use setup_connect instead of duplicating code.

3. Move a debug message about tryssl to tryssl from opencon

4. Transparently handle UDP in tryssl, in case someone does that. Debug
message about DTLS not being supported is printed, but otherwise just
connects with opencon. Previously, doing this would result in a
connection to the TCP version of the port, even if you passed in a port
table with port.protocol=="udp".
2014-09-19 03:10:06 +00:00
dmiller
e8eddb6cfe Use comm.lua default timeouts for http.pipeline_go, remove unused get_default_timeout 2014-09-18 04:11:28 +00:00
dmiller
a7b86fa0fa Change timeouts for comm.lua
As reported by nnposter (http://seclists.org/nmap-dev/2014/q3/472) using
the rtt-based timeouts for read timeouts is not a good idea, since host
processing time can be considerably longer, especially for SSL
connections. comm.lua already allowed for different connect_ and
request_timeout values to reflect this truth, so this commit switches to
using the rtt-based timeout for the connect timeout and adding 6 seconds
to get the request timeout. This value is based on the totalwaitms value
in nmap-service-probes, and is still well short of the default 30s nsock
timeout.
2014-09-18 03:38:24 +00:00
dmiller
327496d50c Relax http.parse_form to allow forms without an action
Patch from nnposter: http://seclists.org/nmap-dev/2014/q3/384
2014-09-18 03:38:23 +00:00
dmiller
d518e2dbcb Use http.parse_redirect and allow arbitrary verbs in http-form-brute
There's no reason we can't use other verbs besides GET and POST. Other
verbs are handled like GET requests (parameters in the URI string). Any
redirect responses will be followed with GET requests, though.
2014-09-17 21:57:59 +00:00
dmiller
440ed59396 Export http.parse_redirect, a useful function 2014-09-17 21:57:57 +00:00
dmiller
5c9d6a3a75 Let http-form-brute use GET in addition to POST
Patch from nnposter. http://seclists.org/nmap-dev/2014/q3/262
2014-09-17 21:57:56 +00:00
dmiller
26faf21ae1 Work around weird AIX traceroute hang
std::list::size() was hanging because list traversal was broken for this
particular static list (timedout_hops). Could not reproduce with a small
test program, but another AIX user confirmed. Exhausted other options
before switching it to dynamic allocation (of the list itself, not the
elements, which are always dynamically allocated), which somehow
bypasses the problem.
2014-09-16 15:36:44 +00:00
dmiller
2f4f11637b Fix some library ordering (-lnsock must come before -lnbase)
Doesn't matter on most platforms because our own object (.o) files
require the symbols from libnbase, so all of them have been linked by
the time libnsock is encountered, but vasprintf and asprintf were
causing problems on platforms that need the versions defined in
libnbase.
2014-09-16 03:10:17 +00:00
dmiller
3ecd0452d5 Fix a memory leak in NSE's bind function 2014-09-15 22:49:17 +00:00
dmiller
9a155c269d Actually use reply ttl for distance guessing in traceroute
This chunk of code in read_replies was generating valgrind errors
because reply.ttl was uninitialized:

  if (host->state == HostState::COUNTING_DOWN) {
    /* If this probe was past the target, skip ahead to what we think the
       actual distance is. */
    int distance = get_initial_ttl_guess(reply.ttl) - reply.ttl + 1;
    if (distance > 0 && distance < host->current_ttl)
      host->current_ttl = MIN(distance, MAX_TTL);
  }

My compiler was setting the initial value to 0, which meant that
distance was always 33, clearly wrong. Setting reply.ttl in decode_reply
silences the error and causes distance to be more accurate.
2014-09-15 17:27:10 +00:00
dmiller
53135e80b9 Remove large files support from nse_fs
This was a hassle to support on AIX (several broken implmentations) and
the move to a more portable solution (using autoconfig macros) was also
troublesome. Upon review, nse_fs.cc only uses directory and link
functions, so large files support shouldn't matter. Stripping it out.
2014-09-15 13:59:01 +00:00
fyodor
d9ef693a93 remove a TODO item which is an addition to a proposed feature which itself isn't yet in Nmap. So I think it's better to track this one separately 2014-09-11 09:21:46 +00:00
dmiller
47ad1bf67c Add a problematic TCP option to validateTCPhdr 2014-09-10 18:48:15 +00:00
dmiller
ed604aedc7 Fix a bug (infinite loop) with connect scan on AIX 2014-09-10 15:55:51 +00:00
dmiller
be4cf76125 Actually use nmap_config.h in nse_fs.h (see r33661) 2014-09-10 15:55:50 +00:00
dmiller
c22c1119e9 Note last commit in libdnet/NMAP_MODIFICATIONS 2014-09-09 21:19:09 +00:00
dmiller
73275cc872 dnet: Fix hw address getting on AIX 2014-09-09 21:19:08 +00:00
dmiller
9847a701e4 Make large files support conditional
nse_fs.cc was forcing large files support, and it was broken on AIX due
to this GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20366

Now we let autoconf handle setting the appropriate defines, and also
check for this particular bug before defining.
2014-09-09 05:04:17 +00:00