1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-21 23:19:03 +00:00
Commit Graph

4571 Commits

Author SHA1 Message Date
ron
a02756a5e4 Adding a fix for false positives discovered in http-enum.nse and http-userdir-enum.nse. It seems that some hosts (or, at least, one host) returns different results for:
a) Lowercase path (a login page)
b) Paths containing uppercase (becomes a '400 Unknown Error' that indicates a corrupt harddrive)
c) Paths containing a path and no uppercase (the same login page as (a) is displayed, except the font changes colour
The server itself returns that it's 'ACOS HTTPD/1.1.4', and the telnet port says it's 'Lingo VoIP config telnetd'. OS guesses seem to indicate a Telephony device of some sort. In any case, this patch detects these conditions and doesn't bother checking the device if it cannot tell these errors apart
2009-08-24 03:42:01 +00:00
ron
a46298dcc2 Added a script-arg to http.lua: pipeline. Setting pipeline lets you artificially increase/lower pipelining. The primary reason I added it is because sorting through packet captures with a hundred requests pipelined is difficult, so now I can lower it for debugging. I suggest using '--script-args=pipeline=1,limit=5' if troubleshooting issues with http-enum.nse. 2009-08-24 03:26:01 +00:00
batrick
600ec30c9f [NSE] The HTTP Library now caches responses generated from http.get or
http.head (in revision . Because many scripts tend to request the same object,
this helps to prevent sending duplicate requests that consume network
resources needlessly.

The cache is transparent to the script writer in that it will return a cached
result if present when http.get/http.head is called. How the cache is used may
be controlled by options table (described in [1]) passed to the http functions.

Three new boolean values are present:
  o bypass_cache -- The contents of the cache is ignored for the request
                    (method == "GET" or "HEAD")
  o no_cache -- The result of the request is not saved in the cache
                (method == "GET" or "HEAD")
  o no_cache_body -- The body of the request is not saved in the cache
                     (method == "GET" or "HEAD")

The size of the cache is by default 1 MB. The size can be changed using the
script arg (--script-args) http-max-cache-size (e.g. --script-args
http-max-cache-size=1e8).

[1] http://nmap.org/nsedoc/lib/http.html#request
2009-08-24 01:15:28 +00:00
david
4c6bafb3fa o There is a new OS detection pseudo-test, SCAN.DC, which records how
the network distance in SCAN.DS was calculated. Its value can be "L"
  for localhost, "D" for a direct connection, "I" for an ICMP TTL
  calculation, and "T" for a traceroute hop count. This is mainly for
  the benefit of OS integration, when it is sometimes important to
  distinguish between DS=1%DC=I (probably the result of forged TTLs)
  and DS=1%DC=D (a true one-hop connection.) [David]
2009-08-23 23:58:28 +00:00
ron
85e7b4dd89 Some fixes to fingerprints suggested by David Fifield 2009-08-23 22:58:12 +00:00
ron
fbf2c3d6a7 Print the http status along with the result, if it isn't 200 OK. This was the original behaviour, but it got lost along the way. 2009-08-23 16:58:53 +00:00
ron
f8e2fe6429 Added a check for a blank body, due to some false positives I found during a random scan 2009-08-23 04:11:04 +00:00
ron
b2a3cd1114 Added a check for default Ruby on Rails image 2009-08-23 01:01:13 +00:00
ron
fbc8e180ca Converted http-userdir-enum.nse to use my http-enum.nse logic (from http.lua). Also moved the 'displayall' script-arg back into the script, not http.lua, because http-userdir-enum.nse actually wants to find non-200 pages (403 Access Denied, for instance). 2009-08-23 00:43:46 +00:00
ron
cf33de55f3 Moved the definition for the 'displayall' argument into http.lua. 2009-08-23 00:24:23 +00:00
ron
77e7738545 Moved the meat of the http-enum.nse code (the 404-detection, HEAD-detection, etc) into http.lua. It may be a better idea to use http-helper.lua or something similar, but for now http.lua works. I'm open to suggestiosn. 2009-08-23 00:22:20 +00:00
ron
30fe087fd3 Added a '/' before 'robots.txt' 2009-08-23 00:20:18 +00:00
ron
cf91bcf799 Added robots.txt (there's another script for it, but it fits with these fingerprints 2009-08-23 00:08:58 +00:00
ron
532f44d00f added rss/atom to http-fingerprints.nse 2009-08-23 00:00:20 +00:00
ron
4616e62760 Fix some tabs 2009-08-22 23:55:43 +00:00
ron
a546ebc84f Clean up a lot of the http-enum.nse code; add some comments; abstract the 'is this a 404?' logic into a function (so it can eventually used by other scripts 2009-08-22 23:54:27 +00:00
ron
c9a62acf31 A major overhaul of the http-enum.nse script:
* Cleaned up and function-ized the code. Planning to move the functions to http.lua or similar to let other scripts (like http-userdir-enum.nse) use them. 
* Better support for different HTTP error codes
* Significantly improved detection of 404 pages to prevent false positives. Some of the techniques used:
  - Request a non-existent page and check the status code
    - If it's 200, try to remove anything that may change (times, URI, filenames, etc), md5 it if ssl is available, and store it. Request a second 404 page and do the same. If they don't match, abort. 
    - If it's any other error code, store it, and look for it in addition to 404 Not Found
  - Request the root folder, /
    - If it returns a 301 Move Permanently or 401 Authentication Required, abort
* Abstracted the fingerprints into files in the nselib/data directory:
  - http-fingerprints: common files/folders
  - yokoso-fingerprints: common applications (from the Yokoso project, by InGuardians -- used under the Nmap license with pemission from Kevin Johnson -- http://seclists.org/nmap-dev/2009/q3/0685.html)
* Added a script-arg that can display all output (except known 404s), instead of just 200 OK and 401 Authentication Required
* Added a lot of debugging messages
2009-08-22 23:19:16 +00:00
fyodor
cc0081340a update script.db now that apache-userdir-enum has been renamed to http-userdir-enum 2009-08-22 22:31:40 +00:00
ron
393110baf1 Fixed a bug where http.pipeline() would print a cryptic error if no requests were passed for it to perform. Changed it to print a warning if debugging is turned on, and return an empty set. 2009-08-22 22:23:03 +00:00
jah
e0572ea362 Renamed apache-userdir-enum.nse to http-userdir-enum.nse to better indicate its
function which is to test http services - not only apache ones.
2009-08-22 22:04:32 +00:00
fyodor
4d04d37ab5 add some FD_SETSIZE research from David 2009-08-22 21:34:16 +00:00
ron
08073b43b8 Fix two bugs in the http libraries:
1) Re-add 443 to the common ssl ports (it was accidentally removed in an earlier patch)
2) If the header doesn't return the number of pipelined requests to perform, default to 40 instead of leaving it nil
2009-08-21 23:42:07 +00:00
david
b64134be14 Make the TraceGroup::consolidateHops method const. 2009-08-21 01:06:49 +00:00
david
a4ea6d2f7c The previous method of calculating the true hop distance from traceroute
was incorrect; the hopDistance member can be much higher than the actual
number of hops recorded. It was 33 when the real distance was 17.
Instead, enumerate and count all the probes that got a response.
2009-08-21 01:05:41 +00:00
david
5d29abaf05 Change a confusing design in traceroute. The TraceProbes map is a
mapping from source port number to probes. Upon output, the map was
transformed in place to a map of TTL values to probes. Operations that
worked before output wouldn't work after output and vice versa. Now the
TTL-to-probe map is kept separate in a local variable.
2009-08-21 01:01:34 +00:00
david
5c1168c024 After a successful traceroute, set the distance to the host in question
so it appears in OS fingerprints.
2009-08-20 20:57:35 +00:00
david
0ffa072a6b Fix an off-by-one error in traceroute consolidation. In debugging mode,
the list of consolidated hops (the ones that match the reference trace)
was printed out one hop further than it should have been. So if a trace
diverged from the reference trace at the sixth hop, it would print out
the first six hops of the reference trace when it should have done only
five. This extra row, as well as being incorrect, could cause an
assertion failure by making the output table one row bigger than its
preallocated capacity.
2009-08-20 19:52:17 +00:00
david
c3b5c08941 Temporarily increase the size of the traceroute output table by 1 until
I can find the bug that causes too many rows to be printed in debugging
mode in some cases. I get an assertion failure when running
	nmap scanme.nmap.org/26 --top-ports 10 --traceroute -n -d
With this change, the bug manifests itself as some peculiar output:

4   --        66.54.149.185
5   --        63.211.250.17
5   39.17 ms  63.211.250.17
6   47.12 ms  4.68.107.190
7   39.72 ms  4.69.132.37

(Note the doubled 5 with the same IP address.)

10  --        207.88.13.122
11  --        207.88.12.46
12  --        207.88.12.61
13  --        65.106.1.57
13  100.77 ms 65.106.1.65
14  91.75 ms  65.106.5.162

(Note the doubled 13 with a different IP address.)

4   --       66.54.149.185
5   --       63.211.250.17
5   ...
6   39.32 ms 4.68.107.190

(Note the doubled 5 with a timeout.)
2009-08-20 18:22:31 +00:00
david
09ba9eda1f Add a Russian Zenmap translation from Alexander Khodyrev. 2009-08-20 15:38:30 +00:00
fyodor
978b8fc3ae Applied a configure.in patch from Petr Salinger in Debian bug #542388 which apparently fixes the libdnet build on GNU/kFreeBSD 2009-08-20 08:46:00 +00:00
joao
2264838cf8 Fixed bug where socket error messages (like EOF) were appended to the HTTP pipeline response 2009-08-20 03:12:54 +00:00
batrick
34b30d9b7f [NSE] Patch to nse_main.lua to print out all active scripts (running & waiting)
at debugging level 2 or higher and when a key is pressed. This is especially
useful when we have a rare deadlock and we want to know which scripts are
involved and where (a traceback is also printed).
2009-08-20 00:36:49 +00:00
david
745d016000 Fix an incorrect comment. 2009-08-20 00:07:46 +00:00
david
9cff9beb20 Remove the G_ALIVE_TTL traceroute probe state. It was mostly synonymous
with G_DEAD_TTL. I couldn't figure out that the difference was supposed
to be.
2009-08-19 23:07:43 +00:00
david
86b0100dc3 Fix a bug I just introduced in tracerotue.cc: I moved a loop
initialization into the loop header but messed it up so the loop
variable wasn't initialized.
2009-08-19 21:57:58 +00:00
david
c6be484bdf Some more whitespace fixes in traceroute.cc. 2009-08-19 21:37:43 +00:00
david
295b4142e9 Use the dnet.h defiens for ICMP types and codes instead of having ad-hoc
defines in traceroute.h.
2009-08-19 21:26:53 +00:00
david
6c28e9aab8 Normalize whitespace in traceroute.h. 2009-08-19 21:11:47 +00:00
david
fb5610089b Remove a stray trailing space from nmap-header-template.cc. 2009-08-19 21:05:21 +00:00
david
5371550a75 Move some functions from traceroute.h into traceroute.cc so they can be
easily referenced while looking at the code that uses them.
2009-08-19 21:04:40 +00:00
david
43acb0eab8 Normalize whitespace in traceroute.cc. 2009-08-19 20:14:54 +00:00
david
fec2cc40d0 Allow doing --data-length 0. That's the documented way to turn off UDP
payloads.
2009-08-19 17:52:23 +00:00
david
ab09f1974f Adjust indentation and expand tabs in option parsing code. 2009-08-19 17:47:49 +00:00
david
8741504f67 Document what UDP payload probes we have in CHANGELOG. 2009-08-19 17:05:59 +00:00
david
dd51ad05f2 Make some minor whitespace and documentation changes in payload.cc. 2009-08-19 17:00:45 +00:00
david
de19fcda82 Add a UDP payload for port 10080/amanda. 2009-08-19 16:53:28 +00:00
david
7d87fe7aa5 Remove the const qualifier from the SSL pointer returned from
nse_nsock_get_ssl. In older versions of OpenSSL (I don't know how old)
the argument to SSL_get_peer_certificate is not const and it caused a
compiler error reported by Ron Bowes.
2009-08-19 16:33:11 +00:00
david
b904a3864d Update config.sub and config.guess from
http://git.savannah.gnu.org/gitweb/?p=config.git
2009-08-19 01:16:21 +00:00
david
25cfb510e3 Add a missing #include <string.h> to nse_ssl_cert.cc. 2009-08-18 22:58:44 +00:00
fyodor
167e654519 changes from discussion w/David 2009-08-18 22:56:00 +00:00