@@ -123,7 +123,9 @@ def commands
123
123
"go_pro" => "Launch Metasploit web GUI" ,
124
124
"grep" => "Grep the output of another command" ,
125
125
"help" => "Help menu" ,
126
- "info" => "Displays information about one or more module" ,
126
+ "advanced" => "Displays advanced options for one or more modules" ,
127
+ "info" => "Displays information about one or more modules" ,
128
+ "options" => "Displays global options or for one or more modules" ,
127
129
"irb" => "Drop into irb scripting mode" ,
128
130
"jobs" => "Displays and manages jobs" ,
129
131
"rename_job" => "Rename a job" ,
@@ -712,6 +714,36 @@ def cmd_sleep(*args)
712
714
Rex ::ThreadSafe . sleep ( args [ 0 ] . to_f )
713
715
end
714
716
717
+ def cmd_advanced_help
718
+ print_line 'Usage: advanced [mod1 mod2 ...]'
719
+ print_line
720
+ print_line 'Queries the supplied module or modules for advanced options. If no module is given,'
721
+ print_line 'show advanced options for the currently active module.'
722
+ print_line
723
+ end
724
+
725
+ def cmd_advanced ( *args )
726
+ if args . empty?
727
+ if ( active_module )
728
+ show_advanced_options ( active_module )
729
+ return true
730
+ else
731
+ print_error ( 'No module active' )
732
+ return false
733
+ end
734
+ end
735
+
736
+ args . each { |name |
737
+ mod = framework . modules . create ( name )
738
+
739
+ if ( mod == nil )
740
+ print_error ( "Invalid module: #{ name } " )
741
+ else
742
+ show_advanced_options ( mod )
743
+ end
744
+ }
745
+ end
746
+
715
747
def cmd_info_help
716
748
print_line "Usage: info <module name> [mod2 mod3 ...]"
717
749
print_line
@@ -748,17 +780,66 @@ def cmd_info(*args)
748
780
}
749
781
end
750
782
783
+ def cmd_options_help
784
+ print_line 'Usage: options [mod1 mod2 ...]'
785
+ print_line
786
+ print_line 'Queries the supplied module or modules for options. If no module is given,'
787
+ print_line 'show options for the currently active module.'
788
+ print_line
789
+ end
790
+
791
+ def cmd_options ( *args )
792
+ if args . empty?
793
+ if ( active_module )
794
+ show_options ( active_module )
795
+ return true
796
+ else
797
+ show_global_options
798
+ return true
799
+ end
800
+ end
801
+
802
+ args . each { |name |
803
+ mod = framework . modules . create ( name )
804
+
805
+ if ( mod == nil )
806
+ print_error ( "Invalid module: #{ name } " )
807
+ else
808
+ show_options ( mod )
809
+ end
810
+ }
811
+ end
812
+
751
813
#
752
- # Tab completion for the info command (same as use)
814
+ # Tab completion for the advanced command (same as use)
753
815
#
754
- # @param str [String] the string currently being typed before tab was hit
755
- # @param words [Array<String>] the previously completed words on the command line. words is always
756
- # at least 1 when tab completion has reached this stage since the command itself has been completed
816
+ # @param str (see #cmd_use_tabs)
817
+ # @param words (see #cmd_use_tabs)
818
+
819
+ def cmd_advanced_tabs ( str , words )
820
+ cmd_use_tabs ( str , words )
821
+ end
822
+
823
+ #
824
+ # Tab completion for the advanced command (same as use)
825
+ #
826
+ # @param str (see #cmd_use_tabs)
827
+ # @param words (see #cmd_use_tabs)
757
828
758
829
def cmd_info_tabs ( str , words )
759
830
cmd_use_tabs ( str , words )
760
831
end
761
832
833
+ #
834
+ # Tab completion for the advanced command (same as use)
835
+ #
836
+ # @param str (see #cmd_use_tabs)
837
+ # @param words (see #cmd_use_tabs)
838
+
839
+ def cmd_options_tabs ( str , words )
840
+ cmd_use_tabs ( str , words )
841
+ end
842
+
762
843
def cmd_irb_help
763
844
print_line "Usage: irb"
764
845
print_line
@@ -2204,7 +2285,7 @@ def cmd_setg_tabs(str, words)
2204
2285
end
2205
2286
2206
2287
def cmd_show_help
2207
- global_opts = %w{ all encoders nops exploits payloads auxiliary plugins options }
2288
+ global_opts = %w{ all encoders nops exploits payloads auxiliary plugins info options }
2208
2289
print_status ( "Valid parameters for the \" show\" command are: #{ global_opts . join ( ", " ) } " )
2209
2290
2210
2291
module_opts = %w{ missing advanced evasion targets actions }
@@ -2244,6 +2325,8 @@ def cmd_show(*args)
2244
2325
show_auxiliary
2245
2326
when 'post'
2246
2327
show_post
2328
+ when 'info'
2329
+ cmd_info ( *args [ 1 , args . length ] )
2247
2330
when 'options'
2248
2331
if ( mod )
2249
2332
show_options ( mod )
@@ -3465,7 +3548,7 @@ def show_actions(mod) # :nodoc:
3465
3548
3466
3549
def show_advanced_options ( mod ) # :nodoc:
3467
3550
mod_opt = Serializer ::ReadableText . dump_advanced_options ( mod , ' ' )
3468
- print ( "\n Module advanced options:\n \n #{ mod_opt } \n " ) if ( mod_opt and mod_opt . length > 0 )
3551
+ print ( "\n Module advanced options ( #{ mod . fullname } ) :\n \n #{ mod_opt } \n " ) if ( mod_opt and mod_opt . length > 0 )
3469
3552
3470
3553
# If it's an exploit and a payload is defined, create it and
3471
3554
# display the payload's options
0 commit comments