Fixes to rpc-grind

NSE: rpc-grind Connect(): RPC library does not support: nil protocol
NSE: rpc-grind Connect(): RPC library does not support: rpcbind version
81578896

These errors caused by ChkProgram and ChkVersion called from
rpc.Comm.Connect. Added a dummy program in rpc-grind and a check for
self.checkprogver in ChkVersion, and everything works great.

Also fixed portrule to only fail if the non-rpcbind service name was not
the result of table lookup. Was failing on port 2049 (in nmap-services
as "nfs") without -sV.
This commit is contained in:
dmiller 2012-08-18 03:32:50 +00:00
parent f8335fc3f0
commit 4728d7437d
2 changed files with 3 additions and 3 deletions

View file

@ -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",

View file

@ -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