mirror of
https://github.com/nmap/nmap.git
synced 2025-12-29 02:49:01 +00:00
Remove many ERROR outputs from non-debug NSE output
This commit is contained in:
@@ -53,6 +53,8 @@ local function build_qry(apikey, url)
|
||||
return string.format("https://sb-ssl.google.com/safebrowsing/api/lookup?client=%s&apikey=%s&appver=1.5.2&pver=3.0&url=%s", SCRIPT_NAME, apikey, url)
|
||||
end
|
||||
|
||||
local function fail (err) return stdnse.format_output(false, err) end
|
||||
|
||||
---
|
||||
--MAIN
|
||||
---
|
||||
@@ -72,8 +74,7 @@ action = function(host, port)
|
||||
local target_url = stdnse.get_script_args("http-google-malware.url") or string.format("%s://%s", port.service, target)
|
||||
|
||||
if string.len(apikey) < 25 then
|
||||
return string.format("[ERROR] No API key found. Update the variable APIKEY in %s or set it in the argument %s.api",
|
||||
SCRIPT_NAME, SCRIPT_NAME)
|
||||
return fail(("No API key found. Use the %s.api argument"):format(SCRIPT_NAME))
|
||||
end
|
||||
|
||||
stdnse.debug1("Checking host %s", target_url)
|
||||
@@ -82,7 +83,7 @@ action = function(host, port)
|
||||
stdnse.debug2("%s", qry)
|
||||
|
||||
if ( req.status > 400 ) then
|
||||
return "[ERROR] Request failed (invalid API key?)"
|
||||
return fail("Request failed (invalid API key?)")
|
||||
end
|
||||
|
||||
--The Safe Lookup API responds with a type when site is on the lists
|
||||
|
||||
Reference in New Issue
Block a user