File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed
lib/msf/ui/console/command_dispatcher Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,10 @@ class Core
94
94
@@go_pro_opts = Rex ::Parser ::Arguments . new (
95
95
"-h" => [ false , "Help banner." ] )
96
96
97
+ @@irb_opts = Rex ::Parser ::Arguments . new (
98
+ "-h" => [ false , "Help banner." ] ,
99
+ "-e" => [ true , "Expression to evaluate." ] )
100
+
97
101
# The list of data store elements that cannot be set when in defanged
98
102
# mode.
99
103
DefangedProhibitedDataStoreElements = [ "MsfModulePaths" ]
@@ -759,8 +763,8 @@ def cmd_info_tabs(str, words)
759
763
def cmd_irb_help
760
764
print_line "Usage: irb"
761
765
print_line
762
- print_line "Drop into an interactive Ruby environment"
763
- print_line
766
+ print_line "Execute commands in a Ruby environment"
767
+ print @@irb_opts . usage ( )
764
768
end
765
769
766
770
#
@@ -769,6 +773,26 @@ def cmd_irb_help
769
773
def cmd_irb ( *args )
770
774
defanged?
771
775
776
+ expressions = [ ]
777
+
778
+ # Parse the command options
779
+ @@irb_opts . parse ( args ) do |opt , idx , val |
780
+ case opt
781
+ when '-e'
782
+ expressions << val
783
+ when '-h'
784
+ cmd_irb_help
785
+ return false
786
+ end
787
+ end
788
+
789
+ if !expressions . empty?
790
+ expressions . each do |expression |
791
+ eval ( expression , binding )
792
+ end
793
+ return
794
+ end
795
+
772
796
print_status ( "Starting IRB shell...\n " )
773
797
774
798
begin
You can’t perform that action at this time.
0 commit comments