mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Added missing second parameter for receive_buf which caused errors with new
Lua version.
This commit is contained in:
@@ -49,7 +49,7 @@ Response = {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
receive = function(self)
|
receive = function(self)
|
||||||
local status, data = self.socket:receive_buf("\r\n")
|
local status, data = self.socket:receive_buf("\r\n", false)
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return false, "Failed to receive data from server"
|
return false, "Failed to receive data from server"
|
||||||
end
|
end
|
||||||
@@ -78,7 +78,7 @@ Response = {
|
|||||||
|
|
||||||
local len = tonumber(data:match("^%$(%d*)"))
|
local len = tonumber(data:match("^%$(%d*)"))
|
||||||
-- we should only have a single line, so we can just peel of the length
|
-- we should only have a single line, so we can just peel of the length
|
||||||
status, data = self.socket:receive_buf(match.numbytes(len))
|
status, data = self.socket:receive_buf(match.numbytes(len), false)
|
||||||
if( not(status) ) then
|
if( not(status) ) then
|
||||||
return false, "Failed to receive data from server"
|
return false, "Failed to receive data from server"
|
||||||
end
|
end
|
||||||
@@ -93,12 +93,12 @@ Response = {
|
|||||||
|
|
||||||
for i=1, count do
|
for i=1, count do
|
||||||
-- peel of the length
|
-- peel of the length
|
||||||
local status = self.socket:receive_buf("\r\n")
|
local status = self.socket:receive_buf("\r\n", false)
|
||||||
if( not(status) ) then
|
if( not(status) ) then
|
||||||
return false, "Failed to receive data from server"
|
return false, "Failed to receive data from server"
|
||||||
end
|
end
|
||||||
|
|
||||||
status, data = self.socket:receive_buf("\r\n")
|
status, data = self.socket:receive_buf("\r\n", false)
|
||||||
if( not(status) ) then
|
if( not(status) ) then
|
||||||
return false, "Failed to receive data from server"
|
return false, "Failed to receive data from server"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ Helper = {
|
|||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return false, err
|
return false, err
|
||||||
end
|
end
|
||||||
local status, data = self.socket:receive_buf("\n")
|
local status, data = self.socket:receive_buf("\n", false)
|
||||||
if( not(status) ) then
|
if( not(status) ) then
|
||||||
return false, err
|
return false, err
|
||||||
end
|
end
|
||||||
@@ -119,7 +119,7 @@ Helper = {
|
|||||||
|
|
||||||
local modules = {}
|
local modules = {}
|
||||||
while(true) do
|
while(true) do
|
||||||
status, data = self.socket:receive_buf("\n")
|
status, data = self.socket:receive_buf("\n", false)
|
||||||
if (not(status)) then
|
if (not(status)) then
|
||||||
return false, data
|
return false, data
|
||||||
end
|
end
|
||||||
@@ -152,13 +152,13 @@ Helper = {
|
|||||||
return false, data
|
return false, data
|
||||||
end
|
end
|
||||||
|
|
||||||
status, data = self.socket:receive_buf(match.numbytes(4))
|
status, data = self.socket:receive_buf(match.numbytes(4), false)
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return false, data
|
return false, data
|
||||||
end
|
end
|
||||||
|
|
||||||
local pos, len = bin.unpack("<S", data)
|
local pos, len = bin.unpack("<S", data)
|
||||||
status, data = self.socket:receive_buf(match.numbytes(len))
|
status, data = self.socket:receive_buf(match.numbytes(len), false)
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return false, data
|
return false, data
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ Comm = {
|
|||||||
-- @return response containing a response instance
|
-- @return response containing a response instance
|
||||||
-- err string containing an error message, if status is false
|
-- err string containing an error message, if status is false
|
||||||
recv = function(self)
|
recv = function(self)
|
||||||
local status, hdr_data = self.socket:receive_buf(match.numbytes(Header.size))
|
local status, hdr_data = self.socket:receive_buf(match.numbytes(Header.size), false)
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return false, "Failed to receive response from server"
|
return false, "Failed to receive response from server"
|
||||||
end
|
end
|
||||||
@@ -246,7 +246,7 @@ Comm = {
|
|||||||
return false, "Failed to parse response header"
|
return false, "Failed to parse response header"
|
||||||
end
|
end
|
||||||
|
|
||||||
local status, data = self.socket:receive_buf(match.numbytes(header.length))
|
local status, data = self.socket:receive_buf(match.numbytes(header.length), false)
|
||||||
if ( header.type == MessageType.BINDING_RESPONSE ) then
|
if ( header.type == MessageType.BINDING_RESPONSE ) then
|
||||||
local resp = Response.Bind.parse(hdr_data .. data)
|
local resp = Response.Bind.parse(hdr_data .. data)
|
||||||
return true, resp
|
return true, resp
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ XMPP = {
|
|||||||
-- previous message.
|
-- previous message.
|
||||||
self.socket:set_timeout(1)
|
self.socket:set_timeout(1)
|
||||||
repeat
|
repeat
|
||||||
local status = self.socket:receive_buf("\0")
|
local status = self.socket:receive_buf("\0", false)
|
||||||
until(not(status))
|
until(not(status))
|
||||||
self.socket:set_timeout(self.options.timeout * 1000)
|
self.socket:set_timeout(self.options.timeout * 1000)
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ action = function(host, port)
|
|||||||
local srvinfo
|
local srvinfo
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
local status, data = socket:receive_buf("\r\n")
|
local status, data = socket:receive_buf("\r\n", false)
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return fail("Failed to read response from server")
|
return fail("Failed to read response from server")
|
||||||
elseif ( data:match("^5") ) then
|
elseif ( data:match("^5") ) then
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ earlier. The vulnerability is the consequence of weak service configuration.
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local status, data = socket:receive_buf("DOTO00000000")
|
local status, data = socket:receive_buf("DOTO00000000", false)
|
||||||
|
|
||||||
if ( status ) then
|
if ( status ) then
|
||||||
local output = data:match("SOUT%w%w%w%w%w%w%w%w(.*)")
|
local output = data:match("SOUT%w%w%w%w%w%w%w%w(.*)")
|
||||||
|
|||||||
@@ -159,11 +159,11 @@ action = function(host, port)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- If there's an error we get a response back, and only then
|
-- If there's an error we get a response back, and only then
|
||||||
local status, data = socket:receive_buf("\n")
|
local status, data = socket:receive_buf("\n", false)
|
||||||
if( status and data ~= "<error>" ) then
|
if( status and data ~= "<error>" ) then
|
||||||
return fail("An unknown error occured, aborting ...")
|
return fail("An unknown error occured, aborting ...")
|
||||||
elseif ( status ) then
|
elseif ( status ) then
|
||||||
status, data = socket:receive_buf("\n")
|
status, data = socket:receive_buf("\n", false)
|
||||||
if ( status ) then
|
if ( status ) then
|
||||||
return fail(data)
|
return fail(data)
|
||||||
else
|
else
|
||||||
@@ -176,7 +176,7 @@ action = function(host, port)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local tags = {}
|
local tags = {}
|
||||||
local status, tag = socket:receive_buf("\n")
|
local status, tag = socket:receive_buf("\n", false)
|
||||||
while(true) do
|
while(true) do
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
break
|
break
|
||||||
@@ -194,7 +194,7 @@ action = function(host, port)
|
|||||||
|
|
||||||
while(true) do
|
while(true) do
|
||||||
local data
|
local data
|
||||||
status, data = socket:receive_buf("\n")
|
status, data = socket:receive_buf("\n", false)
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ action = function(host, port)
|
|||||||
|
|
||||||
repeat
|
repeat
|
||||||
local entry
|
local entry
|
||||||
status, line = socket:receive_buf("\r\n")
|
status, line = socket:receive_buf("\r\n", false)
|
||||||
if ( status ) then
|
if ( status ) then
|
||||||
status, entry = gps.NMEA.parse(line)
|
status, entry = gps.NMEA.parse(line)
|
||||||
if ( status ) then
|
if ( status ) then
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ action = function(host, port)
|
|||||||
return fail("Failed to send request to server")
|
return fail("Failed to send request to server")
|
||||||
end
|
end
|
||||||
|
|
||||||
local status, resp = socket:receive_buf("\r\n\r\n")
|
local status, resp = socket:receive_buf("\r\n\r\n", false)
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return fail("Failed to receive response from server")
|
return fail("Failed to receive response from server")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ end
|
|||||||
local function recvResponse(socket)
|
local function recvResponse(socket)
|
||||||
local kvs = {}
|
local kvs = {}
|
||||||
repeat
|
repeat
|
||||||
local status, response = socket:receive_buf("\r\n")
|
local status, response = socket:receive_buf("\r\n", false)
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return false, "Failed to receive response from server"
|
return false, "Failed to receive response from server"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ Driver = {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
login = function(self, username, password)
|
login = function(self, username, password)
|
||||||
local status, line = self.socket:receive_buf("\r\n")
|
local status, line = self.socket:receive_buf("\r\n", false)
|
||||||
if ( line:match("^220 VMware Authentication Daemon.*SSL Required") ) then
|
if ( line:match("^220 VMware Authentication Daemon.*SSL Required") ) then
|
||||||
self.socket:reconnect_ssl()
|
self.socket:reconnect_ssl()
|
||||||
end
|
end
|
||||||
@@ -57,7 +57,7 @@ Driver = {
|
|||||||
return false, err
|
return false, err
|
||||||
end
|
end
|
||||||
|
|
||||||
local status, response = self.socket:receive_buf("\r\n")
|
local status, response = self.socket:receive_buf("\r\n", false)
|
||||||
if ( not(status) or not(response:match("^331") ) ) then
|
if ( not(status) or not(response:match("^331") ) ) then
|
||||||
local err = brute.Error:new( "Received unexpected response from server" )
|
local err = brute.Error:new( "Received unexpected response from server" )
|
||||||
err:setRetry( true )
|
err:setRetry( true )
|
||||||
@@ -70,7 +70,7 @@ Driver = {
|
|||||||
err:setRetry( true )
|
err:setRetry( true )
|
||||||
return false, err
|
return false, err
|
||||||
end
|
end
|
||||||
status, response = self.socket:receive_buf("\r\n")
|
status, response = self.socket:receive_buf("\r\n", false)
|
||||||
|
|
||||||
if ( response:match("^230") ) then
|
if ( response:match("^230") ) then
|
||||||
return true, brute.Account:new(username, password, creds.State.VALID)
|
return true, brute.Account:new(username, password, creds.State.VALID)
|
||||||
@@ -93,7 +93,7 @@ local function checkAuthd(host, port)
|
|||||||
return false, "Failed to connect to server"
|
return false, "Failed to connect to server"
|
||||||
end
|
end
|
||||||
|
|
||||||
local status, line = socket:receive_buf("\r\n")
|
local status, line = socket:receive_buf("\r\n", false)
|
||||||
socket:close()
|
socket:close()
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
return false, "Failed to receive response from server"
|
return false, "Failed to receive response from server"
|
||||||
|
|||||||
Reference in New Issue
Block a user