File tree Expand file tree Collapse file tree 1 file changed +16
-9
lines changed
lib/msf/ui/console/command_dispatcher Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -66,30 +66,37 @@ def local_editor
66
66
end
67
67
68
68
def cmd_edit_help
69
- msg = "Edit the currently active module"
70
- msg = "#{ msg } #{ local_editor ? "with #{ local_editor } " : "(LocalEditor or $VISUAL/$EDITOR should be set first)" } ."
71
- print_line "Usage: edit"
69
+ print_line "Usage: edit [file/to/edit.rb]"
72
70
print_line
73
- print_line msg
74
- print_line "When done editing, you must reload the module with 'reload' or 'rerun'."
71
+ print_line "Edit a local file or the currently active module with #{ local_editor } "
72
+ print_line "If a file path is specified it will automatically be reloaded after editing"
73
+ print_line "Otherwise, you can reload the active module with 'reload' or 'rerun'."
75
74
print_line
76
75
end
77
76
78
77
#
79
78
# Edit the currently active module
80
79
#
81
- def cmd_edit
82
- if active_module
83
- editor = local_editor
84
- path = active_module . file_path
80
+ def cmd_edit ( *args )
81
+ if args . length > 0
82
+ path = args [ 0 ]
83
+ elsif active_module
84
+ path = active_module . file_path
85
+ end
85
86
87
+ if path
88
+ editor = local_editor
86
89
if editor . nil?
87
90
editor = 'vim'
88
91
print_warning ( "LocalEditor or $VISUAL/$EDITOR should be set. Falling back on #{ editor } ." )
89
92
end
90
93
91
94
print_status ( "Launching #{ editor } #{ path } " )
92
95
system ( editor , path )
96
+
97
+ if args . length > 0
98
+ load args [ 0 ]
99
+ end
93
100
else
94
101
print_error ( 'Nothing to edit -- try using a module first.' )
95
102
end
You can’t perform that action at this time.
0 commit comments