diff --git a/nselib/rpc.lua b/nselib/rpc.lua index c0c9014ee..03955ceaa 100644 --- a/nselib/rpc.lua +++ b/nselib/rpc.lua @@ -231,6 +231,7 @@ Comm = { -- @return status boolean true on success, false on failure -- @return string containing error message (if status is false) ChkVersion = function(self) + if not self.checkprogver then return true end if ( self.version > RPC_version[self.program].max or self.version < RPC_version[self.program].min ) then return false, string.format("RPC library does not support: %s version %d", diff --git a/scripts/rpc-grind.nse b/scripts/rpc-grind.nse index 70137041b..3c76029c5 100644 --- a/scripts/rpc-grind.nse +++ b/scripts/rpc-grind.nse @@ -41,7 +41,7 @@ categories = {"version"} portrule = function(host, port) - if port.service ~= nil and port.service ~= 'rpcbind' then + if port.service ~= nil and port.version.service_dtype ~= "table" and port.service ~= 'rpcbind' then -- Exclude services that have already been detected as something -- different than rpcbind. return false @@ -157,9 +157,8 @@ local rpcGrinder = function(host, port, iterator, result) -- We use a random, most likely unsupported version so that -- we also trigger min and max version disclosure for the target service. version = math.random(12345, 123456789) - rpcConn = rpc.Comm:new() + rpcConn = rpc.Comm:new("rpcbind", version) rpcConn:SetCheckProgVer(false) - rpcConn:SetVersion(version) status, err = rpcConn:Connect(host, port) if not status then