File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -125,13 +125,12 @@ def cmd_check(*args)
125
125
defanged?
126
126
127
127
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' )
129
129
130
130
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
+
135
134
# Check multiple hosts
136
135
last_rhost_opt = mod . rhost
137
136
last_rhosts_opt = mod . datastore [ 'RHOSTS' ]
@@ -144,7 +143,14 @@ def cmd_check(*args)
144
143
mod . datastore [ 'RHOSTS' ] = last_rhosts_opt
145
144
mod . cleanup
146
145
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
147
152
end
153
+
148
154
rescue ::Interrupt
149
155
# When the user sends interrupt trying to quit the task, some threads will still be active.
150
156
# This means even though the console tells the user the task has aborted (or at least they
You can’t perform that action at this time.
0 commit comments