mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 22:21:29 +00:00
Added ability to disable for program and version support checking in rpc.lua. Authentication now defaults to NULL.
This commit is contained in:
@@ -142,6 +142,7 @@ Comm = {
|
|||||||
self.__index = self
|
self.__index = self
|
||||||
o.program = program
|
o.program = program
|
||||||
o.program_id = Util.ProgNameToNumber(program)
|
o.program_id = Util.ProgNameToNumber(program)
|
||||||
|
o.checkprogver = true
|
||||||
o:SetVersion(version)
|
o:SetVersion(version)
|
||||||
return o
|
return o
|
||||||
end,
|
end,
|
||||||
@@ -242,15 +243,27 @@ Comm = {
|
|||||||
--
|
--
|
||||||
-- @return status boolean true
|
-- @return status boolean true
|
||||||
SetVersion = function(self, version)
|
SetVersion = function(self, version)
|
||||||
|
if self.checkprogver then
|
||||||
if (RPC_version[self.program] and RPC_args[self.program] and
|
if (RPC_version[self.program] and RPC_args[self.program] and
|
||||||
nmap.registry.args and nmap.registry.args[RPC_args[self.program].ver]) then
|
nmap.registry.args and nmap.registry.args[RPC_args[self.program].ver]) then
|
||||||
self.version = tonumber(nmap.registry.args[RPC_args[self.program].ver])
|
self.version = tonumber(nmap.registry.args[RPC_args[self.program].ver])
|
||||||
elseif (not(self.version) and version) then
|
elseif (not(self.version) and version) then
|
||||||
self.version = version
|
self.version = version
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
self.version = version
|
||||||
|
end
|
||||||
return true, nil
|
return true, nil
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
SetCheckProgVer = function(self, check)
|
||||||
|
self.checkprogver = check
|
||||||
|
end,
|
||||||
|
|
||||||
|
SetProgID = function(self, progid)
|
||||||
|
self.program_id = progid
|
||||||
|
end,
|
||||||
|
|
||||||
--- Checks if data contains enough bytes to read the <code>needed</code> amount
|
--- Checks if data contains enough bytes to read the <code>needed</code> amount
|
||||||
-- If it doesn't it attempts to read the remaining amount of bytes from the socket
|
-- If it doesn't it attempts to read the remaining amount of bytes from the socket
|
||||||
--
|
--
|
||||||
@@ -286,12 +299,9 @@ Comm = {
|
|||||||
local RPC_VERSION = 2
|
local RPC_VERSION = 2
|
||||||
local packet
|
local packet
|
||||||
|
|
||||||
if not(xid) then
|
local auth = auth or {type = Portmap.AuthType.NULL}
|
||||||
xid = math.random(1234567890)
|
local xid = xid or math.random(1234567890)
|
||||||
end
|
local procedure = procedure or 0
|
||||||
if not auth then
|
|
||||||
return false, "Comm.CreateHeader: No authentication specified"
|
|
||||||
end
|
|
||||||
|
|
||||||
packet = bin.pack( ">IIIIII", xid, Portmap.MessageType.CALL, RPC_VERSION,
|
packet = bin.pack( ">IIIIII", xid, Portmap.MessageType.CALL, RPC_VERSION,
|
||||||
self.program_id, self.version, procedure )
|
self.program_id, self.version, procedure )
|
||||||
|
|||||||
Reference in New Issue
Block a user