File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
lib/msf/ui/console/command_dispatcher Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -628,10 +628,13 @@ def cmd_connect(*args)
628
628
true
629
629
end
630
630
631
+ def local_editor
632
+ Rex ::Compat . getenv ( 'VISUAL' ) || Rex ::Compat . getenv ( 'EDITOR' ) || '/usr/bin/vim'
633
+ end
634
+
631
635
def cmd_edit_help
632
- editor = Rex ::Compat . getenv ( 'VISUAL' ) || Rex ::Compat . getenv ( 'EDITOR' )
633
636
msg = "Edit the currently active module"
634
- msg = "#{ msg } #{ editor ? "with #{ editor } " : "($EDITOR must be set first)" } ."
637
+ msg = "#{ msg } #{ local_editor ? "with #{ local_editor } " : "($EDITOR must be set first)" } ."
635
638
print_line "Usage: edit"
636
639
print_line
637
640
print_line msg
@@ -643,19 +646,18 @@ def cmd_edit_help
643
646
# Edit the currently active module
644
647
#
645
648
def cmd_edit
646
- editor = ENV [ 'VISUAL' ] || ENV [ 'EDITOR' ]
647
- unless editor
649
+ unless local_editor
648
650
print_error "$EDITOR must be set first. Try 'export EDITOR=/usr/bin/vim'"
649
651
return
650
652
end
651
- unless ::File . executable_real? editor
652
- print_error "#{ editor } doesn't seem to be executable by you."
653
+ unless ::File . executable_real? local_editor
654
+ print_error "#{ local_editor } doesn't seem to be executable by you."
653
655
return
654
656
end
655
657
if active_module
656
658
path = active_module . file_path
657
- print_status "Launching #{ editor } #{ path } "
658
- system ( editor , path )
659
+ print_status "Launching #{ local_editor } #{ path } "
660
+ system ( local_editor , path )
659
661
else
660
662
print_error "Nothing to edit -- try using a module first."
661
663
end
You can’t perform that action at this time.
0 commit comments