From e738915a12e2eba59613e22b14af1fab800b0b6f Mon Sep 17 00:00:00 2001 From: gyani Date: Tue, 23 Jun 2015 21:15:19 +0000 Subject: [PATCH] Added a few scripts i comitted to CHANGELOG. Updated http-put to add xmloutput and relax resposne status checks. Closes #150. --- CHANGELOG | 10 ++++++++++ scripts/http-put.nse | 20 +++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7c286ef6c..189f34b7d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,15 @@ # Nmap Changelog ($Id$); -*-text-*- +o [NSE] Added additional checks for succesful put request in http-put. [Oleg Mitrofanov] + +o [NSE] Added an update for http-methods that checks all possible methods not in Allow + or Public header of OPTIONS response. [Gyanendra Mishra] + +o [NSE] Added SLAXML, an XML Parser in lua Originally written by Gavin Kistner + or Phrogz. [Gyanendra Mishra] + +o [NSE] Added hnap-info, detects and outputs info for hnap devices. [Gyanendra Mishra] + o [NSE] Allow ssl-enum-ciphers to run on non-typical ports when it is selected by name. It will now send a service detection probe if the port is not a typical SSL port and version scan (-sV) was not used. [Daniel Miller] diff --git a/scripts/http-put.nse b/scripts/http-put.nse index 5d206194c..191d79f62 100644 --- a/scripts/http-put.nse +++ b/scripts/http-put.nse @@ -20,8 +20,8 @@ Uploads a local file to a remote web server using the HTTP PUT method. You must -- @args http-put.file - The full path to the local file that should be uploaded to the server -- @args http-put.url - The remote directory and filename to store the file to e.g. (/uploads/file.txt) -- - --- +-- @xmloutput +-- /HNAP1 was successfully created -- -- Version 0.1 -- Created 10/15/2011 - v0.1 - created by Patrik Karlsson @@ -33,10 +33,10 @@ license = "Same as Nmap--See http://nmap.org/book/man-legal.html" categories = {"discovery", "intrusive"} -portrule = shortport.port_or_service( {80, 443}, {"http", "https"}, "tcp", "open") +portrule = shortport.http action = function( host, port ) - + local output = stdnse.output_table() local fname, url = stdnse.get_script_args('http-put.file', 'http-put.url') if ( not(fname) or not(url) ) then return @@ -44,16 +44,18 @@ action = function( host, port ) local f = io.open(fname, "r") if ( not(f) ) then - return stdnse.format_output(true, ("ERROR: Failed to open file: %s"):format(fname)) + output.error = ("ERROR: Failed to open file: %s"):format(fname) + return output, output.error end local content = f:read("*all") f:close() local response = http.put(host, port, url, nil, content) - - if ( response.status == 200 or response.status == 204 ) then - return stdnse.format_output(true, ("%s was successfully created"):format(url)) + if ( 200 <= response.status and response.status < 210 ) then + output.result = ("%s was successfully created"):format(url) + return output, output.result end - return stdnse.format_output(true, ("ERROR: %s could not be created"):format(url)) + output.error = ("ERROR: %s could not be created"):format(url) + return output, output.error end