Skip to content

Commit 73742d7

Browse files
committed
Land @busterb's rapid7#9261, which makes the default prompt include the longer name of the module,
avoiding ambiguity and providing more context
2 parents 55f56a5 + c848379 commit 73742d7

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

lib/msf/core/module/full_name.rb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ def fullname
2424
type + '/' + refname
2525
end
2626

27+
def promptname
28+
refname
29+
end
30+
2731
def shortname
2832
refname.split('/').last
2933
end
@@ -55,9 +59,16 @@ def refname
5559
end
5660

5761
#
58-
# Returns the module's framework short name. This is a
59-
# possibly conflicting name used for things like console
60-
# prompts.
62+
# Returns the module's framework prompt-friendly name.
63+
#
64+
# reverse_tcp
65+
#
66+
def promptname
67+
self.class.promptname
68+
end
69+
70+
#
71+
# Returns the module's framework short name.
6172
#
6273
# reverse_tcp
6374
#

lib/msf/ui/console/command_dispatcher/core.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ def cmd_spool(*args)
11071107
if active_module
11081108
# intentionally += and not << because we don't want to modify
11091109
# datastore or the constant DefaultPrompt
1110-
prompt += " #{active_module.type}(%bld%red#{active_module.shortname}%clr)"
1110+
prompt += " #{active_module.type}(%bld%red#{active_module.promptname}%clr)"
11111111
end
11121112
prompt_char = framework.datastore['PromptChar'] || Msf::Ui::Console::Driver::DefaultPromptChar
11131113
driver.update_prompt("#{prompt} ", prompt_char, true)

lib/msf/ui/console/command_dispatcher/modules.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ def cmd_use(*args)
661661
# Update the command prompt
662662
prompt = framework.datastore['Prompt'] || Msf::Ui::Console::Driver::DefaultPrompt
663663
prompt_char = framework.datastore['PromptChar'] || Msf::Ui::Console::Driver::DefaultPromptChar
664-
driver.update_prompt("#{prompt} #{mod.type}(%bld%red#{mod.shortname}%clr) ", prompt_char, true)
664+
driver.update_prompt("#{prompt} #{mod.type}(%bld%red#{mod.promptname}%clr) ", prompt_char, true)
665665
end
666666

667667
#

0 commit comments

Comments
 (0)