Skip to content

Commit 17f278e

Browse files
committed
Fix rapid7#3822 - Support file:// syntax for check()
1 parent a65ee6c commit 17f278e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lib/msf/ui/console/module_command_dispatcher.rb

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,12 @@ def cmd_check(*args)
125125
defanged?
126126

127127
ip_range_arg = args.shift || mod.datastore['RHOSTS'] || framework.datastore['RHOSTS'] || ''
128-
hosts = Rex::Socket::RangeWalker.new(ip_range_arg)
128+
opt = Msf::OptAddressRange.new('RHOSTS')
129129

130130
begin
131-
if hosts.ranges.blank?
132-
# Check a single rhost
133-
check_simple
134-
else
131+
if !ip_range_arg.blank? && opt.valid?(ip_range_arg)
132+
hosts = Rex::Socket::RangeWalker.new(opt.normalize(ip_range_arg))
133+
135134
# Check multiple hosts
136135
last_rhost_opt = mod.rhost
137136
last_rhosts_opt = mod.datastore['RHOSTS']
@@ -144,7 +143,14 @@ def cmd_check(*args)
144143
mod.datastore['RHOSTS'] = last_rhosts_opt
145144
mod.cleanup
146145
end
146+
else
147+
# Check a single rhost
148+
unless Msf::OptAddress.new('RHOST').valid?(mod.datastore['RHOST'])
149+
raise Msf::OptionValidateError.new(['RHOST'])
150+
end
151+
check_simple
147152
end
153+
148154
rescue ::Interrupt
149155
# When the user sends interrupt trying to quit the task, some threads will still be active.
150156
# This means even though the console tells the user the task has aborted (or at least they

0 commit comments

Comments
 (0)