Land @busterb's #9261, which makes the default prompt include the longer name of the module,

avoiding ambiguity and providing more context
This commit is contained in:
Jon Hart 2017-11-30 12:45:31 -08:00
commit 73742d7de5
No known key found for this signature in database
GPG Key ID: 2FA9F0A3AFA8E9D3
3 changed files with 16 additions and 5 deletions

View File

@ -24,6 +24,10 @@ module Msf::Module::FullName
type + '/' + refname
end
def promptname
refname
end
def shortname
refname.split('/').last
end
@ -55,9 +59,16 @@ module Msf::Module::FullName
end
#
# Returns the module's framework short name. This is a
# possibly conflicting name used for things like console
# prompts.
# Returns the module's framework prompt-friendly name.
#
# reverse_tcp
#
def promptname
self.class.promptname
end
#
# Returns the module's framework short name.
#
# reverse_tcp
#

View File

@ -1107,7 +1107,7 @@ class Core
if active_module
# intentionally += and not << because we don't want to modify
# datastore or the constant DefaultPrompt
prompt += " #{active_module.type}(%bld%red#{active_module.shortname}%clr)"
prompt += " #{active_module.type}(%bld%red#{active_module.promptname}%clr)"
end
prompt_char = framework.datastore['PromptChar'] || Msf::Ui::Console::Driver::DefaultPromptChar
driver.update_prompt("#{prompt} ", prompt_char, true)

View File

@ -661,7 +661,7 @@ module Msf
# Update the command prompt
prompt = framework.datastore['Prompt'] || Msf::Ui::Console::Driver::DefaultPrompt
prompt_char = framework.datastore['PromptChar'] || Msf::Ui::Console::Driver::DefaultPromptChar
driver.update_prompt("#{prompt} #{mod.type}(%bld%red#{mod.shortname}%clr) ", prompt_char, true)
driver.update_prompt("#{prompt} #{mod.type}(%bld%red#{mod.promptname}%clr) ", prompt_char, true)
end
#