Skip to content

Commit

Permalink
Adds the features configuration to the debug command output
Browse files Browse the repository at this point in the history
  • Loading branch information
cgranleese-r7 committed May 8, 2024
1 parent 82ce0a9 commit c938b10
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/msf/ui/debug.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def self.all(framework, driver)
all_information = preamble
all_information << datastore(framework, driver)
all_information << database_configuration(framework)
all_information << framework_config(framework)
all_information << history(driver)
all_information << errors
all_information << logs
Expand Down Expand Up @@ -201,6 +202,23 @@ def self.database_configuration(framework)
)
end

def self.framework_config(framework)
required_features = framework.features.all.map { |feature| [feature[:name], feature[:enabled].to_s] }
markdown_formatted_features = required_features.map { |feature| "| #{feature.join(' | ')} |" }
required_fields = %w[name enabled]

table = "| #{required_fields.join(' | ')} |\n"
table += '|' + '-:|' * required_fields.count + "\n"
table += markdown_formatted_features.join("\n").to_s

# The markdown table can't be placed in a code block or it will not render as a table.
build_section_no_block(
'Framework Configuration',
'The features are configured as follows:',
table
)
end

def self.history(driver)
end_pos = Readline::HISTORY.length - 1
start_pos = end_pos - COMMAND_HISTORY_TOTAL > driver.hist_last_saved ? end_pos - (COMMAND_HISTORY_TOTAL - 1) : driver.hist_last_saved
Expand Down

0 comments on commit c938b10

Please sign in to comment.