1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-16 04:39:03 +00:00
Commit Graph

3200 Commits

Author SHA1 Message Date
ron
7da313e8ac Added the status code to the rawheaders as well (so it's displayed in http-headers.nse). Also updated the @output in the nsedoc. 2009-08-27 15:47:10 +00:00
ron
62dedb9dc1 Added a 'path' script-arg to http-headers.nse. Changed it to use 'HEAD' by default, and fail to using 'GET' the same way other scripts do (also added a 'useget' script-arg to turn it off). Also fixed some print_debugs in http.lua that were prefixed with 'http-enum.nse:'. 2009-08-27 15:39:17 +00:00
ron
fc2b575fba Added 'rawheader' when parsing http requests. It saves the header fields, in order, preserving the case. Change http-headers.nse to read this instead of the processed headers. 2009-08-27 15:24:09 +00:00
david
d254c85b42 Fix XML traceroute output. I accidentally left in one part of the old
stateful TraceProbes design, which was otherwise removed in r15197.
2009-08-26 23:49:20 +00:00
ron
8a8ae22532 Fixing a fingerprint 2009-08-26 22:10:21 +00:00
ron
1ac3ea773b Adding a new fingerprint after finding a /backup.sql file in a test 2009-08-26 21:10:02 +00:00
david
7d6d5ada0b o [Zenmap] If you have any hosts or services selected, they will
remain selected after aggregating another scan or running a filter
  (as long as they are still up and visible). Before the selection was
  lost whenever the scan inventory was changed.
2009-08-26 20:10:14 +00:00
ron
46711fa004 Fixed a big in the http library that cropped up while scanning multiple hosts at the same ip address. The reason this occurred is because the result would be cached based on the ip address, not the target name, so different vhosts on the same ip address would be considered the same by the cache. 2009-08-26 16:01:00 +00:00
fyodor
48035974b0 2009-08-26 07:01:46 +00:00
ron
5da8f8199e Added http-headers.nse script to database 2009-08-26 00:23:26 +00:00
ron
91518a5222 Added a script-arg to http-enum.nse allowing the user to give a custom fingerprint file. Also changed script to use straight nmap.fetchfile(filename) then to use nmap.fetchfile('nselib/data/' .. filename) to find the fingerprints file, which lets a user give his fingerprints file in the current folder.
It might be better to give priority the other way, though, I'm not really sure.
2009-08-25 23:55:05 +00:00
ron
c1d48010a1 Added caching for the HTTP fingerprint files. It mimics similar code from http-usedir-enum.nse, storing the fingerprints in the registry and checking if it exists before reading them. 2009-08-25 23:45:48 +00:00
ron
0ed14b10b1 Added a script designed to display HTTP headers. 2009-08-25 23:36:49 +00:00
fyodor
58d8401b7c changes from chat w/David 2009-08-25 22:09:49 +00:00
luis
a5ca31db9e Replaced nmap's hex dump functions with new hexdump() included in nbase. Before
Nmap used two functions: one of them, hdump(), just printed raw hex bytes 
(no ASCII equivalents) and the other one, lamont_hdump() had a bug when 
printing buffers where bufflen%16==3. A new function has been implemented 
from scratch, that basically produces the same output as Wireshark. 
Output looks like this:

0000   e8 60 65 86 d7 86 6d 30  35 97 54 87 ff 67 05 9e  .`e...m05.T..g..
0010   07 5a 98 c0 ea ad 50 d2  62 4f 7b ff e1 34 f8 fc  .Z....P.bO{..4..
0020   c4 84 0a 6a 39 ad 3c 10  63 b2 22 c4 24 40 f4 b1  ...j9.<.c.".$@..

Changes:

- The new hexdump() function has been added to nbase.
- Old hdump() and lamont_dump() have been removed from nmap's code.
- A wrapper to the new hexdump(), called nmap_hexdump(), has been added
  to nmap's utils.cc. The wrapper basically prints the buffer returned 
  by hexdump() using nmap's log_write() function.
2009-08-25 18:09:19 +00:00
ron
d63fba1dd6 Add some more fingerprints that a commercial tool just found in an application I'm assessing.
I realize we're getting too many fingerprints to handle, but we can always trim it down later.
2009-08-25 00:05:02 +00:00
david
7c94424d70 Print out a debugging message with a file handle before closing it, not
after, in mmap_file on Windows.
2009-08-24 21:53:27 +00:00
david
f09c8091a4 Avoid doing a calculation with an uninitialized tv_start if no timeout
has been specified.
2009-08-24 21:32:01 +00:00
david
6dc99d0e25 Fix a typo in parse_fingerprint_file; after calling strpbrk we need to
test teh return value, not the (unchanged) value we passed in. This
would cause a segmentation fault instead of a fatal error if nmap-os-db
ended in a Fingerprint line that didn't have a terminating newline.
2009-08-24 21:25:06 +00:00
david
cac58924e0 Avoid dereferencing a NULL key in l_nsock_ncap_close. 2009-08-24 21:18:26 +00:00
david
c371d35714 Add a check against svc->probe_matched being NULL before doing a string
comparison in scanThroughTunnel. It is checked against NULL later in the
function, so presumably it can happen.
2009-08-24 21:14:51 +00:00
david
ddf05afe1b Fix a memory leak in l_nsock_get_info when trying to get information
from a closed socket.
2009-08-24 21:09:47 +00:00
david
cfeb9d6563 fclose the /proc/net/route file handle after reading routes from it. 2009-08-24 21:07:47 +00:00
david
cb226847e5 Move a couple of allocated string variables into the same scope where
they are freed to avoid a memory leak.
2009-08-24 21:02:32 +00:00
david
d6ea9ea18a Fix an array bound passed to GetModuleFileName. It should be the size of
our static buffer, not 1024.
2009-08-24 20:57:32 +00:00
david
41d053a1ed Fix a stupid bug I introduced: Use MAX and not MIN to give a minimum
size to the allocation of space for the --data-length.
2009-08-24 20:47:28 +00:00
ron
986ba5ab8c Realized the my check_get() function was elminating perfectly good hosts. Some of our printers use a '301 Moved Permanently' to redirect you to their login page from the root page, but my script was mistaking those for an off-site redirect. I changed check_get() to display a warning rather than causing the scan to fail. 2009-08-24 19:56:52 +00:00
david
66ec6eab6f Fix a memory leak in parse_single_fingerprint. This function isn't used
in Nmap, but only in the separate fingerprint utilities.
2009-08-24 19:19:11 +00:00
david
6bd9760f3b In xml_convert, handle the case when repl is the empty string on the
first iteration. This can't happen with the current data definitions,
but if it did it would result in memcpy being passed a null pointer.
(memcpy would be asked to do a zero-byte copy, so it would probably be
okay anyway, but it's better to be safe.)
2009-08-24 18:10:12 +00:00
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