Skip to content

Commit

Permalink
Land #16015, fix tab completion for RHOSTS
Browse files Browse the repository at this point in the history
  • Loading branch information
space-r7 committed Jan 6, 2022
2 parents d49d823 + 4b37076 commit 27ad15d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions lib/msf/ui/console/module_option_tab_completion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,23 @@ def option_values_dispatch(mod, o, str, words)
res += tab_complete_source_interface(o)
end
end
when Msf::OptAddressRange
when Msf::OptAddressRange, Msf::OptRhosts
case str
when /^file:(.*)/
files = tab_complete_filenames(Regexp.last_match(1), words)
res += files.map { |f| 'file:' + f } if files
when %r{/$}
res << str + '32'
res << str + '24'
res << str + '16'
when /\-$/
res << str + str[0, str.length - 1]
when %r{^(.*)/\d{0,2}$}
left = Regexp.last_match(1)
if Rex::Socket.is_ipv4?(left)
res << left + '/32'
res << left + '/24'
res << left + '/16'
end
when /^(.*)\-$/
left = Regexp.last_match(1)
if Rex::Socket.is_ipv4?(left)
res << str + str[0, str.length - 1]
end
else
option_values_target_addrs(mod).each do |addr|
res << addr
Expand Down

0 comments on commit 27ad15d

Please sign in to comment.