1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-03 13:19:04 +00:00

Remove many ERROR outputs from non-debug NSE output

This commit is contained in:
dmiller
2015-08-27 20:43:55 +00:00
parent fb5c947453
commit 7852fa3c18
137 changed files with 334 additions and 380 deletions

View File

@@ -1,6 +1,7 @@
local bin = require "bin"
local nmap = require "nmap"
local shortport = require "shortport"
local stdnse = require "stdnse"
local table = require "table"
description = [[
@@ -70,6 +71,8 @@ local function processOptions(data)
return true, { done=( not(#data == pos - 1) ), cmds = result }
end
local function fail(err) return stdnse.format_output(false, err) end
action = function(host, port)
local socket = nmap.new_socket()
@@ -80,17 +83,17 @@ action = function(host, port)
socket:set_timeout(7500)
status, result = socket:send(data)
if ( not(status) ) then
return ("\n ERROR: Failed to send packet: %s"):format(result)
return fail(("Failed to send packet: %s"):format(result))
end
repeat
status, data = socket:receive()
if ( not(status) ) then
return ("\n ERROR: Receiving packet: %s"):format(data)
return fail(("Receiving packet: %s"):format(data))
end
status, result = processOptions(data)
if ( not(status) ) then
return "\n ERROR: Failed to process telnet options"
return fail("Failed to process telnet options")
end
until( result.done or result.cmds['26'] )