@@ -38,24 +38,26 @@ def initialize(info = {})
38
38
39
39
register_advanced_options (
40
40
[
41
- # XXX: Use portmapper to do call - Direct portmap to make the request to the program portmap_req
41
+ OptInt . new ( 'TIMEOUT' , [ true , 'Number of seconds to wait for responses to RPC calls' , 5 ] )
42
+ # XXX: Use portmapper to do call - Direct portmap to make the request to the program portmap_req
42
43
] , Msf ::Exploit ::Remote ::SunRPC )
43
44
44
45
register_options (
45
46
[
46
- # XXX: XPORT
47
+ # XXX: XPORT
47
48
Opt ::RHOST ,
48
49
Opt ::RPORT ( 111 ) ,
49
50
] , Msf ::Exploit ::Remote ::SunRPC
50
51
)
51
52
end
52
53
53
- def sunrpc_create ( protocol , program , version )
54
+ def sunrpc_create ( protocol , program , version , timeout = timeout )
54
55
self . rpcobj = Rex ::Proto ::SunRPC ::Client . new (
55
56
:rhost => rhost ,
56
57
:rport => rport . to_i ,
57
58
:proto => protocol ,
58
59
:program => program ,
60
+ :timeout => timeout ,
59
61
:version => version ,
60
62
:context => {
61
63
'Msf' => framework ,
@@ -82,7 +84,7 @@ def sunrpc_create(protocol, program, version)
82
84
rpcobj . pport = arr [ 5 ]
83
85
end
84
86
85
- def sunrpc_call ( proc , buf , timeout = 20 )
87
+ def sunrpc_call ( proc , buf , timeout = timeout )
86
88
ret = rpcobj . call ( proc , buf , timeout )
87
89
raise ::Rex ::Proto ::SunRPC ::RPCError , "#{ rhost } :#{ rport } - SunRPC - No response to SunRPC call for procedure: #{ proc } " unless ret
88
90
@@ -157,6 +159,11 @@ def progresolv(number)
157
159
return "UNKNOWN-#{ number } "
158
160
end
159
161
162
+ # Returns the time that this module will wait for RPC responses, in seconds
163
+ def timeout
164
+ datastore [ 'TIMEOUT' ]
165
+ end
166
+
160
167
# Used to track the last SunRPC context
161
168
attr_accessor :rpcobj
162
169
end
0 commit comments