Skip to content

Commit a5ca516

Browse files
committed
Fix nil deref in spool command
Occurs when no module is currently `use`d
1 parent de6e2ef commit a5ca516

File tree

1 file changed

+6
-1
lines changed
  • lib/msf/ui/console/command_dispatcher

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,8 +1516,13 @@ def cmd_spool(*args)
15161516
# Restore color and prompt
15171517
driver.output.config[:color] = color
15181518
prompt = framework.datastore['Prompt'] || Msf::Ui::Console::Driver::DefaultPrompt
1519+
if active_module
1520+
# intentionally += and not << because we don't want to modify
1521+
# datastore or the constant DefaultPrompt
1522+
prompt += " #{active_module.type}(%bld%red#{active_module.shortname}%clr)"
1523+
end
15191524
prompt_char = framework.datastore['PromptChar'] || Msf::Ui::Console::Driver::DefaultPromptChar
1520-
driver.update_prompt("#{prompt} #{active_module.type}(%bld%red#{active_module.shortname}%clr) ", prompt_char, true)
1525+
driver.update_prompt("#{prompt} ", prompt_char, true)
15211526

15221527
print_status(msg)
15231528
return

0 commit comments

Comments
 (0)