Skip to content

Commit 7d93d28

Browse files
committed
Support more tab completion features
1 parent c892da4 commit 7d93d28

File tree

1 file changed

+21
-1
lines changed
  • lib/msf/ui/console/command_dispatcher

1 file changed

+21
-1
lines changed

lib/msf/ui/console/command_dispatcher/core.rb

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2033,6 +2033,11 @@ def cmd_set_tabs(str, words)
20332033
end
20342034
end
20352035

2036+
unless str.blank?
2037+
res = res.select { |term| term.upcase.start_with?(str.upcase) }
2038+
res = res.map { |term| str << term[str.length..-1] }
2039+
end
2040+
20362041
return res
20372042
end
20382043

@@ -2737,6 +2742,8 @@ def tab_complete_option(str, words)
27372742
p = framework.payloads.create(mod.datastore['PAYLOAD'])
27382743
if (p and p.options.include?(opt))
27392744
res.concat(option_values_dispatch(p.options[opt], str, words))
2745+
elsif (p and p.options.include?(opt.upcase))
2746+
res.concat(option_values_dispatch(p.options[opt.upcase], str, words))
27402747
end
27412748
end
27422749

@@ -2770,8 +2777,10 @@ def option_values_dispatch(o, str, words)
27702777
end
27712778

27722779
when 'Msf::OptAddressRange'
2773-
27742780
case str
2781+
when /^file:(.*)/
2782+
files = tab_complete_filenames($1,words)
2783+
res += files.map { |f| "file:" << f } if files
27752784
when /\/$/
27762785
res << str+'32'
27772786
res << str+'24'
@@ -2802,9 +2811,20 @@ def option_values_dispatch(o, str, words)
28022811
o.enums.each do |val|
28032812
res << val
28042813
end
2814+
28052815
when 'Msf::OptPath'
28062816
files = tab_complete_filenames(str,words)
28072817
res += files if files
2818+
2819+
when 'Msf::OptBool'
2820+
res << 'true'
2821+
res << 'false'
2822+
2823+
when 'Msf::OptString'
2824+
if (str =~ /^file:(.*)/)
2825+
files = tab_complete_filenames($1,words)
2826+
res += files.map { |f| "file:" << f } if files
2827+
end
28082828
end
28092829

28102830
return res

0 commit comments

Comments
 (0)