Skip to content

Commit

Permalink
Consolidate datastore with fallbacks logic
Browse files Browse the repository at this point in the history
  • Loading branch information
adfoster-r7 committed Feb 9, 2025
1 parent 300e99d commit 783742e
Show file tree
Hide file tree
Showing 26 changed files with 324 additions and 841 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ OptSomething.new(option_name, [boolean, description, value, *enums*], aliases: *
options](#Filtering-datastore-options) section for more information.
* **fallbacks** *optional*, *key-word only* An array of names that will be used as a fallback if the main option name is
defined by the user. This is useful in the scenario of wanting specialised option names such as `SMBUser`, but to also
support gracefully checking a list of more generic fallbacks option names such as `Username`. This functionality is
currently behind a feature flag, set with `features set datastore_fallbacks true` in msfconsole
support gracefully checking a list of more generic fallbacks option names such as `Username`.

Now let's talk about what classes are available:

Expand Down
2 changes: 1 addition & 1 deletion lib/msf/base/serializer/readable_text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ def self.options_table(missing, mod, options, indent)
)
options.sort_by(&:name).each do |opt|
name = opt.name
if mod.datastore.is_a?(Msf::DataStoreWithFallbacks)
if mod.datastore.is_a?(Msf::DataStore)
val = mod.datastore[name]
else
val = mod.datastore[name].nil? ? opt.default : mod.datastore[name]
Expand Down
Loading

0 comments on commit 783742e

Please sign in to comment.