Skip to content

Commit

Permalink
Merge pull request #19869 from adfoster-r7/consolidate-datastore-with…
Browse files Browse the repository at this point in the history
…-fallbacks-logic

Consolidate datastore with fallbacks logic
  • Loading branch information
adfoster-r7 authored Feb 10, 2025
2 parents d96d980 + 8e9c144 commit 9396e1c
Show file tree
Hide file tree
Showing 27 changed files with 373 additions and 890 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 9396e1c

Please sign in to comment.