mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 05:01:29 +00:00
Added the status code to the rawheaders as well (so it's displayed in http-headers.nse). Also updated the @output in the nsedoc.
This commit is contained in:
@@ -967,6 +967,9 @@ function parseResult( response )
|
|||||||
-- build nicer table for header
|
-- build nicer table for header
|
||||||
local last_header, match, key
|
local last_header, match, key
|
||||||
for number, line in ipairs( header or {} ) do
|
for number, line in ipairs( header or {} ) do
|
||||||
|
-- Keep the raw header too, in case a script wants to access it
|
||||||
|
table.insert(result['rawheader'], line)
|
||||||
|
|
||||||
if number == 1 then
|
if number == 1 then
|
||||||
local code = line:match "HTTP/%d%.%d (%d+)";
|
local code = line:match "HTTP/%d%.%d (%d+)";
|
||||||
result.status = tonumber(code)
|
result.status = tonumber(code)
|
||||||
@@ -974,8 +977,6 @@ function parseResult( response )
|
|||||||
else
|
else
|
||||||
match, _, key, value = string.find( line, "(.+): (.*)" )
|
match, _, key, value = string.find( line, "(.+): (.*)" )
|
||||||
if match and key and value then
|
if match and key and value then
|
||||||
-- Keep the raw header too, in case a script wants to access it
|
|
||||||
table.insert(result['rawheader'], line)
|
|
||||||
key = key:lower()
|
key = key:lower()
|
||||||
if result.header[key] then
|
if result.header[key] then
|
||||||
result.header[key] = result.header[key] .. ',' .. value
|
result.header[key] = result.header[key] .. ',' .. value
|
||||||
|
|||||||
@@ -6,16 +6,13 @@ Does a GET request for the root folder ("/"), and displays the HTTP headers retu
|
|||||||
--@output
|
--@output
|
||||||
-- Interesting ports on scanme.nmap.org (64.13.134.52):
|
-- Interesting ports on scanme.nmap.org (64.13.134.52):
|
||||||
-- PORT STATE SERVICE
|
-- PORT STATE SERVICE
|
||||||
-- 80/tcp open http
|
-- 80/tcp open http syn-ack
|
||||||
-- | http-headers:
|
-- | http-headers: (HEAD used)
|
||||||
-- | connection: close
|
-- | HTTP/1.1 200 OK
|
||||||
-- | content-type: text/html; charset=UTF-8
|
-- | Date: Thu, 27 Aug 2009 15:46:39 GMT
|
||||||
-- | content-length: 739
|
-- | Server: Apache/2.2.11 (Unix) PHP/5.2.8
|
||||||
-- | accept-ranges: bytes
|
-- | Connection: close
|
||||||
-- | date: Sun, 23 Aug 2009 01:14:30 GMT
|
-- |_ Content-Type: text/html;charset=ISO-8859-1
|
||||||
-- | etag: "fc8c91-2e3-44d8e17edd540"
|
|
||||||
-- | last-modified: Mon, 19 May 2008 04:49:49 GMT
|
|
||||||
-- |_ server: Apache/2.2.2 (Fedora)
|
|
||||||
--
|
--
|
||||||
--@arg path The path to request, such as '/index.php'. Default: '/'.
|
--@arg path The path to request, such as '/index.php'. Default: '/'.
|
||||||
--@arg useget Set to force GET requests instead of HEAD.
|
--@arg useget Set to force GET requests instead of HEAD.
|
||||||
|
|||||||
Reference in New Issue
Block a user