Introduce a user-controlled timeout for SunRPC stuff
parent
7098d89058
commit
151df3ae05
|
@ -38,6 +38,7 @@ module Exploit::Remote::SunRPC
|
|||
|
||||
register_advanced_options(
|
||||
[
|
||||
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)
|
||||
|
||||
|
@ -50,12 +51,13 @@ module 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