From 1c57c0092cb54a5c2b69810d3458f7a631643582 Mon Sep 17 00:00:00 2001 From: Spencer McIntyre Date: Wed, 2 Apr 2014 23:27:11 -0400 Subject: [PATCH] Tab complete case insensitive module options too --- lib/msf/ui/console/command_dispatcher/core.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/msf/ui/console/command_dispatcher/core.rb b/lib/msf/ui/console/command_dispatcher/core.rb index 9e42ec66fc..3baf4bbc11 100644 --- a/lib/msf/ui/console/command_dispatcher/core.rb +++ b/lib/msf/ui/console/command_dispatcher/core.rb @@ -2035,7 +2035,7 @@ class Core unless str.blank? res = res.select { |term| term.upcase.start_with?(str.upcase) } - res = res.map { |term| str << term[str.length..-1] } + res = res.map { |term| str + term[str.length..-1] } end return res @@ -2735,6 +2735,8 @@ class Core # Is this option used by the active module? if (mod.options.include?(opt)) res.concat(option_values_dispatch(mod.options[opt], str, words)) + elsif (mod.options.include?(opt.upcase)) + res.concat(option_values_dispatch(mod.options[opt.upcase], str, words)) end # How about the selected payload? @@ -2779,8 +2781,8 @@ class Core when 'Msf::OptAddressRange' case str when /^file:(.*)/ - files = tab_complete_filenames($1,words) - res += files.map { |f| "file:" << f } if files + files = tab_complete_filenames($1, words) + res += files.map { |f| "file:" + f } if files when /\/$/ res << str+'32' res << str+'24' @@ -2813,7 +2815,7 @@ class Core end when 'Msf::OptPath' - files = tab_complete_filenames(str,words) + files = tab_complete_filenames(str, words) res += files if files when 'Msf::OptBool' @@ -2822,8 +2824,8 @@ class Core when 'Msf::OptString' if (str =~ /^file:(.*)/) - files = tab_complete_filenames($1,words) - res += files.map { |f| "file:" << f } if files + files = tab_complete_filenames($1, words) + res += files.map { |f| "file:" + f } if files end end