Introduce a user-controlled timeout for SunRPC stuff
parent
7098d89058
commit
151df3ae05
|
@ -38,24 +38,26 @@ module Exploit::Remote::SunRPC
|
|||
|
||||
register_advanced_options(
|
||||
[
|
||||
# XXX: Use portmapper to do call - Direct portmap to make the request to the program portmap_req
|
||||
OptInt.new('TIMEOUT', [true, 'Number of seconds to wait for responses to RPC calls', 5])
|
||||
# XXX: Use portmapper to do call - Direct portmap to make the request to the program portmap_req
|
||||
], Msf::Exploit::Remote::SunRPC)
|
||||
|
||||
register_options(
|
||||
[
|
||||
# XXX: XPORT
|
||||
# XXX: XPORT
|
||||
Opt::RHOST,
|
||||
Opt::RPORT(111),
|
||||
], Msf::Exploit::Remote::SunRPC
|
||||
)
|
||||
end
|
||||
|
||||
def sunrpc_create(protocol, program, version)
|
||||
def sunrpc_create(protocol, program, version, timeout = timeout)
|
||||
self.rpcobj = Rex::Proto::SunRPC::Client.new(
|
||||
:rhost => rhost,
|
||||
:rport => rport.to_i,
|
||||
:proto => protocol,
|
||||
:program => program,
|
||||
:timeout => timeout,
|
||||
:version => version,
|
||||
:context => {
|
||||
'Msf' => framework,
|
||||
|
@ -82,7 +84,7 @@ module Exploit::Remote::SunRPC
|
|||
rpcobj.pport = arr[5]
|
||||
end
|
||||
|
||||
def sunrpc_call(proc, buf, timeout=20)
|
||||
def sunrpc_call(proc, buf, timeout = timeout)
|
||||
ret = rpcobj.call(proc, buf, timeout)
|
||||
raise ::Rex::Proto::SunRPC::RPCError, "#{rhost}:#{rport} - SunRPC - No response to SunRPC call for procedure: #{proc}" unless ret
|
||||
|
||||
|
@ -157,6 +159,11 @@ module Exploit::Remote::SunRPC
|
|||
return "UNKNOWN-#{number}"
|
||||
end
|
||||
|
||||
# Returns the time that this module will wait for RPC responses, in seconds
|
||||
def timeout
|
||||
datastore['TIMEOUT']
|
||||
end
|
||||
|
||||
# Used to track the last SunRPC context
|
||||
attr_accessor :rpcobj
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue