File tree Expand file tree Collapse file tree 2 files changed +31
-38
lines changed
msf/ui/console/command_dispatcher
rex/post/meterpreter/ui/console/command_dispatcher Expand file tree Collapse file tree 2 files changed +31
-38
lines changed Original file line number Diff line number Diff line change @@ -764,7 +764,7 @@ def cmd_irb_help
764764 print_line "Usage: irb"
765765 print_line
766766 print_line "Execute commands in a Ruby environment"
767- print @@irb_opts . usage ( )
767+ print @@irb_opts . usage
768768 end
769769
770770 #
@@ -778,32 +778,29 @@ def cmd_irb(*args)
778778 # Parse the command options
779779 @@irb_opts . parse ( args ) do |opt , idx , val |
780780 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 )
781+ when '-e'
782+ expressions << val
783+ when '-h'
784+ cmd_irb_help
785+ return false
792786 end
793- return
794787 end
795788
796- print_status ( "Starting IRB shell...\n " )
789+ if expressions . empty?
790+ print_status ( "Starting IRB shell...\n " )
797791
798- begin
799- Rex ::Ui ::Text ::IrbShell . new ( binding ) . run
800- rescue
801- print_error ( "Error during IRB: #{ $!} \n \n #{ $@. join ( "\n " ) } " )
802- end
792+ begin
793+ Rex ::Ui ::Text ::IrbShell . new ( binding ) . run
794+ rescue
795+ print_error ( "Error during IRB: #{ $!} \n \n #{ $@. join ( "\n " ) } " )
796+ end
803797
804- # Reset tab completion
805- if ( driver . input . supports_readline )
806- driver . input . reset_tab_completion
798+ # Reset tab completion
799+ if ( driver . input . supports_readline )
800+ driver . input . reset_tab_completion
801+ end
802+ else
803+ expressions . each { |expression | eval ( expression , binding ) }
807804 end
808805 end
809806
Original file line number Diff line number Diff line change @@ -330,7 +330,7 @@ def cmd_irb_help
330330 print_line "Usage: irb"
331331 print_line
332332 print_line "Execute commands in a Ruby environment"
333- print @@irb_opts . usage ( )
333+ print @@irb_opts . usage
334334 end
335335
336336 #
@@ -342,28 +342,24 @@ def cmd_irb(*args)
342342 # Parse the command options
343343 @@irb_opts . parse ( args ) do |opt , idx , val |
344344 case opt
345- when '-e'
346- expressions << val
347- when '-h'
348- cmd_irb_help
349- return
345+ when '-e'
346+ expressions << val
347+ when '-h'
348+ return cmd_irb_help
350349 end
351350 end
352351
353352 session = client
354353 framework = client . framework
355354
356- if !expressions . empty?
357- expressions . each do |expression |
358- eval ( expression , binding )
359- end
360- return
361- end
362-
363- print_status ( "Starting IRB shell" )
364- print_status ( "The 'client' variable holds the meterpreter client\n " )
355+ if expressions . empty?
356+ print_status ( "Starting IRB shell" )
357+ print_status ( "The 'client' variable holds the meterpreter client\n " )
365358
366- Rex ::Ui ::Text ::IrbShell . new ( binding ) . run
359+ Rex ::Ui ::Text ::IrbShell . new ( binding ) . run
360+ else
361+ expressions . each { |expression | eval ( expression , binding ) }
362+ end
367363 end
368364
369365 @@set_timeouts_opts = Rex ::Parser ::Arguments . new (
You can’t perform that action at this time.
0 commit comments