From 6e5e5cf72f560e9ba3c7063d37c88ef9d45d0af3 Mon Sep 17 00:00:00 2001 From: paulino Date: Fri, 7 Oct 2011 07:01:08 +0000 Subject: [PATCH] Updates the script to use stdnse.get_script_args() instead of reading the arguments from the registry and removes extra commented lines. --- scripts/http-headers.nse | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/scripts/http-headers.nse b/scripts/http-headers.nse index 979460288..49165b0c9 100644 --- a/scripts/http-headers.nse +++ b/scripts/http-headers.nse @@ -34,17 +34,14 @@ require "http" portrule = shortport.http action = function(host, port) - local path = nmap.registry.args.path + local path = stdnse.get_script_args(SCRIPT_NAME..".path") or "/" + local useget = stdnse.get_script_args(SCRIPT_NAME..".useget") local request_type = "HEAD" - if(path == nil) then - path = '/' - end - local status = false local result -- Check if the user didn't want HEAD to be used - if(nmap.registry.args.useget == nil) then + if(useget == nil) then -- Try using HEAD first status, result = http.can_use_head(host, port, nil, path) end @@ -73,10 +70,7 @@ action = function(host, port) end table.insert(result.rawheader, "(Request type: " .. request_type .. ")") --- for _, header in ipairs(result.rawheader) do --- response = response .. header .. "\n" --- end - + return stdnse.format_output(true, result.rawheader) end