@@ -2022,6 +2022,19 @@ def cmd_set_tabs(str, words)
2022
2022
end
2023
2023
end
2024
2024
2025
+ unless str . blank?
2026
+ res = res . select { |term | term . upcase . start_with? ( str . upcase ) }
2027
+ res = res . map { |term |
2028
+ if str == str . upcase
2029
+ str + term [ str . length ..-1 ] . upcase
2030
+ elsif str == str . downcase
2031
+ str + term [ str . length ..-1 ] . downcase
2032
+ else
2033
+ str + term [ str . length ..-1 ]
2034
+ end
2035
+ }
2036
+ end
2037
+
2025
2038
return res
2026
2039
end
2027
2040
@@ -2719,13 +2732,17 @@ def tab_complete_option(str, words)
2719
2732
# Is this option used by the active module?
2720
2733
if ( mod . options . include? ( opt ) )
2721
2734
res . concat ( option_values_dispatch ( mod . options [ opt ] , str , words ) )
2735
+ elsif ( mod . options . include? ( opt . upcase ) )
2736
+ res . concat ( option_values_dispatch ( mod . options [ opt . upcase ] , str , words ) )
2722
2737
end
2723
2738
2724
2739
# How about the selected payload?
2725
2740
if ( mod . exploit? and mod . datastore [ 'PAYLOAD' ] )
2726
2741
p = framework . payloads . create ( mod . datastore [ 'PAYLOAD' ] )
2727
2742
if ( p and p . options . include? ( opt ) )
2728
2743
res . concat ( option_values_dispatch ( p . options [ opt ] , str , words ) )
2744
+ elsif ( p and p . options . include? ( opt . upcase ) )
2745
+ res . concat ( option_values_dispatch ( p . options [ opt . upcase ] , str , words ) )
2729
2746
end
2730
2747
end
2731
2748
@@ -2759,8 +2776,10 @@ def option_values_dispatch(o, str, words)
2759
2776
end
2760
2777
2761
2778
when 'Msf::OptAddressRange'
2762
-
2763
2779
case str
2780
+ when /^file:(.*)/
2781
+ files = tab_complete_filenames ( $1, words )
2782
+ res += files . map { |f | "file:" + f } if files
2764
2783
when /\/ $/
2765
2784
res << str +'32'
2766
2785
res << str +'24'
@@ -2791,9 +2810,20 @@ def option_values_dispatch(o, str, words)
2791
2810
o . enums . each do |val |
2792
2811
res << val
2793
2812
end
2813
+
2794
2814
when 'Msf::OptPath'
2795
- files = tab_complete_filenames ( str , words )
2815
+ files = tab_complete_filenames ( str , words )
2796
2816
res += files if files
2817
+
2818
+ when 'Msf::OptBool'
2819
+ res << 'true'
2820
+ res << 'false'
2821
+
2822
+ when 'Msf::OptString'
2823
+ if ( str =~ /^file:(.*)/ )
2824
+ files = tab_complete_filenames ( $1, words )
2825
+ res += files . map { |f | "file:" + f } if files
2826
+ end
2797
2827
end
2798
2828
2799
2829
return res
0 commit comments