From ef132f2f2494ea4a1fbdb368acd6e95d0290b8f5 Mon Sep 17 00:00:00 2001 From: dmiller Date: Sat, 13 Apr 2019 21:42:56 +0000 Subject: [PATCH] Clean up response matching and avoid requiring string lib --- scripts/http-hp-ilo-info.nse | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/http-hp-ilo-info.nse b/scripts/http-hp-ilo-info.nse index e39ef02b3..1113bc15a 100644 --- a/scripts/http-hp-ilo-info.nse +++ b/scripts/http-hp-ilo-info.nse @@ -107,13 +107,14 @@ function parseXML(dom) end action = function(host,port) - local response = http.get(host,port,"/xmldata?item=all") - if response["status"] ~= 200 - or string.match(response["body"], '') == nil - or string.match(response["body"], 'iLO') == nil - then - return - end - local domtable = slaxml.parseDOM(response["body"],{stripWhitespace=true}) - return parseXML(domtable) + local response = http.get(host,port,"/xmldata?item=all") + if response["status"] ~= 200 + or not response.body + or not response.body:match('') + or not response.body:match('iLO') + then + return + end + local domtable = slaxml.parseDOM(response["body"],{stripWhitespace=true}) + return parseXML(domtable) end