1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 14:11:29 +00:00
Commit Graph

57 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
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
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
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
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
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
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
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
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
ron
f2ed53ebfc Removed an undeclared variable in http.lua. 2009-08-18 02:20:33 +00:00
ron
6aee1ce91c Fixed a spelling mistake in http.lua. 2009-08-18 01:40:33 +00:00
batrick
d5748b1d83 If the response is already a table (from an error in http.request) then do not
try to parse a result, instead return nil.  This fixes an error where we try to
index match as though response is a string.
2009-08-15 14:53:28 +00:00
joao
a2dcbb7cd5 Fixing a bug where getPipelineMax was not returning any value, when it sould, at least, return 1. 2009-08-15 14:32:17 +00:00
joao
0a3a1b091c Applying a lot of new features to http.lua:
- Cookie Support
- Pipelining Support
- New lib modularization (previously, single functions were taking care of too many tasks, we have splitted these tasks for better code reuse)
2009-08-12 01:40:06 +00:00
batrick
990cb8965d Removed unused bopt variable. 2009-08-11 05:56:41 +00:00
batrick
ac55b3ca78 Fixed a regexp escape sequence and shortened code. 2009-08-10 12:51:14 +00:00
joao
6218ce14a5 Added POST and HEAD support to http.lua 2009-07-24 08:00:32 +00:00
batrick
67f31fd170 Fixed a global access for 'opts' using check_globals script. 2009-07-15 14:16:14 +00:00
david
426ed74a8b Add the http-date.nse script. Also the function http.parse_date that
parses an HTTP date in any of three possible formats.

http-date.nse gets the Date: header field value from and HTTP server,
then displays it with how much it differs from local time.
2009-07-13 22:03:02 +00:00
joao
c455e12b7d http.lua using a different approach to deal with ssl connections. Now it is using the comm.tryssl method. 2009-07-13 15:24:14 +00:00
david
36b12c9a21 Make decoding of the "chunked" transfer encoding more robust in
http.lua. Previously the code was not careful about checking its input,
and would loop forever if it got something non-hex where it expected a
hex chunk-size. See http://seclists.org/nmap-dev/2009/q3/0013.html.

This code raises an error whenever decoding fails for whatever reason.
It also handles chunk extensions. The reference is section 3.6.1 of
RFC 2616.
2009-07-09 03:07:31 +00:00
joao
53c5e64c43 Fixed local/global issues with some vars 2009-07-05 09:59:02 +00:00
batrick
1963fe7b96 Removed some code that did nothing. 2009-07-03 04:05:10 +00:00
ron
c213cc97b1 Added an initial WebDAV vulnerability-detection attempt for testing 2009-05-19 20:56:07 +00:00
jah
d757338fa2 Fix http.table_augment which was preventing user-supplied HTTP headers from
being sent in HTTP requests.
2009-05-03 19:03:53 +00:00
david
54a8caae65 Make http.request conform to its documentation; it now interprets any header
fields passed to it and adds them to the request. Previously it ignored them,
relying on http.get to concatentate the header fields into a string for it.
2009-03-01 19:02:33 +00:00
batrick
b901089c19 Corrected documentation. 2008-12-01 04:12:13 +00:00
jah
fece92c4f7 Add http-alt and https-alt to the services handled by html-title.nse
Modified http.request() to connect using ssl for the https-alt service.
html-title.nse can now deal with a redirect which changes the url scheme
as long as a port is present in the url and it is the port being scanned.
2008-11-17 22:06:58 +00:00
jah
c38aa90312 Fix http.lua which ignores port.protocol and assumes it to be 'tcp' even if it is 'udp'.
Now http.request() returns nil if port.protocol is not 'tcp'.
Changed the portrule in html-title.nse to accept only TCP ports.

Fixed a redirect rule in html-title.nse which was comparing the string url.port with
the number port.number - which would always be false.
2008-11-10 22:55:08 +00:00
david
5f166e19ec Don't use empty parentheses when referring to functions by name in NSE
documentation.
2008-11-07 22:49:49 +00:00
david
bf635081c3 Proofread and update documentation of http, ipOps, and listop. 2008-10-24 04:59:36 +00:00
david
7e15f259a4 Standardize the @copyright fields of NSE modules; change "See nmaps COPYING for
license" to "Same as Nmap--See http://nmap.org/book/man-legal.html" like
scripts commonly use. I added the field to some modules I know to be under the
Nmap license: bin, datafiles, dns, nmap, unpwdb. I left alone bin, bit, pcre,
and url, which come from outside sources.
2008-10-24 00:44:22 +00:00
david
dafa60743b Break description summaries in http.lua into their own paragraphs. 2008-10-16 23:37:54 +00:00
david
12e34eb5b0 Reformat and merge documentation for some NSE modules: comm, datafiles, dns,
http, ipOps, listop, and match. This is mainly merging the best documentation
from the module source and scripting.xml into the module, with the aim of
making the source code the canonical source for module documentation.
2008-10-15 22:03:14 +00:00
sven
83ec6aa665 It is unnecessary to prefer targetname over the ip in the request()
function since host is only passed to socket:connect() which would have to
resolve the targetname back to the ip.
2008-10-03 17:17:45 +00:00
david
d8e40a3546 Add Sven's modifications to http.lua. In his words:
It is unnecessary to prefer targetname over the ip in the request()
function since host is only passed to socket:connect() which would have to
resolve the targetname back to the ip.
I've rewritten the header/body separation to use a single regex which
should do the same as your code and since the first match is non-greedy
should always prefer the shorter version.
I've done something similar for the header splitting.
I've removed the type checks for header and body since they are always
strings.
2008-10-03 15:43:38 +00:00
david
ebaf939f5f Make the http NSE module better handle different delimiters in the headers of
messages (and in the body when chunked encoding is used). The patch is from
jah.
2008-10-03 01:00:55 +00:00
fyodor
f67049b2d3 o Fix a bug in the NSE http library which would cause some scripts to
give the error: SCRIPT ENGINE: C:\Program
  Files\Nmap\nselib/http.lua:77: attempt to call field 'parse' (a nil
  value) [Jah]

Also added Win2K dependencies section to nmap-install (I should have
done a separate checkin for that)
2008-09-03 06:22:13 +00:00
fyodor
8b29c19a76 o The NSE http library now supports chunked encoding. [Sven Klemm] 2008-08-29 09:24:24 +00:00
batrick
670792a4a6 Updated all libraries documentation.
packet and url both need more work.
2008-08-18 04:03:45 +00:00
batrick
462c289f4a Fixed all the modules to give a default name if absent.
Also necessary for the documentation system to know the name
of the module.
2008-08-16 04:20:15 +00:00
fyodor
22fac0e3e5 apply patch by Jah to handle some bogus responses from some devices. See http://seclists.org/nmap-dev/2008/q2/0731.html and http://seclists.org/nmap-dev/2008/q2/0732.html 2008-06-29 04:26:20 +00:00
batrick
b589575472 Applied Jah's patch for http.lua discussed in:
http://seclists.org/nmap-dev/2008/q2/0833.html
2008-06-23 03:42:57 +00:00