Skip to content

Commit d689b33

Browse files
committed
more error handling, deal with user error
1 parent 87e683c commit d689b33

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

modules/exploits/linux/misc/drb_remote_codeexec.rb

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ def initialize(info = {})
4343

4444
register_options(
4545
[
46-
OptString.new('URI',
47-
"The URI of the target host (druby://host:port) (overrides RHOST/RPORT)"),
46+
OptString.new('URI', [false, "The URI of the target host (druby://host:port) (overrides RHOST/RPORT)", nil]),
4847
Opt::RHOST(nil, false),
4948
Opt::RPORT(8787)
5049
])
@@ -110,6 +109,16 @@ def method_syscall(p)
110109
end
111110

112111
def exploit
112+
if !datastore['URI'].blank? && !datastore['RHOST'].blank?
113+
print_error("URI and RHOST are specified, unset one")
114+
return
115+
end
116+
117+
if datastore['URI'].blank? && datastore['RHOST'].blank?
118+
print_error("neither URI nor RHOST are specified, set one")
119+
return
120+
end
121+
113122
unless datastore['URI'].blank?
114123
serveruri = datastore['URI']
115124
else
@@ -130,12 +139,12 @@ class << p
130139

131140
methods.each do |method|
132141
begin
133-
print_status("trying to exploit #{method}")
142+
print_status("Trying to exploit #{method} method")
134143
send("method_" + method, p)
135144
handler(nil)
136145
break
137146
rescue SecurityError, DRb::DRbConnError, NoMethodError
138-
print_warning("target is not vulnerable to #{method}")
147+
print_warning("Target is not vulnerable to #{method} method")
139148
end
140149
end
141150

0 commit comments

Comments
 (0)