Skip to content

Commit b0fac48

Browse files
committed
Stop caring about order of keys in user_data
1 parent 023f47f commit b0fac48

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/msf/core/module.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ class Module
5757
# datastore, consumed by #replicant to allow clean override of MSF module methods.
5858
REPLICANT_EXTENSION_DS_KEY = 'ReplicantExtensions'
5959

60+
# The set of keys in {#user_data} that make {#user_data_is_match?} return
61+
# true
62+
MATCH_KEYS = Set.new([ :match, :match_set, :run ])
63+
6064
# Make include public so we can runtime extend
6165
public_class_method :include
6266

@@ -278,12 +282,12 @@ def fail_with(reason, msg=nil)
278282
raise RuntimeError, "#{reason.to_s}: #{msg}"
279283
end
280284

281-
# Whether {user_data} contains everything necessary to make a
285+
# Whether {#user_data} contains everything necessary to make a
282286
# `MetasploitDataModels::AutomaticExploitation::MatchResult`
283287
#
284288
# @return [bool]
285289
def user_data_is_match?
286-
user_data.kind_of?(Hash) && user_data.keys == [ :match, :match_set, :run ]
290+
user_data.kind_of?(Hash) && Set.new(user_data.keys).superset?(MATCH_KEYS)
287291
end
288292

289293
##
@@ -329,6 +333,8 @@ def self.cached?
329333
# {Msf::Simple::Exploit#exploit_simple} or
330334
# {Msf::Simple::Auxiliary#run_simple} for correlating where modules came
331335
# from.
336+
#
337+
# @see #user_data_is_match?
332338
attr_accessor :user_data
333339

334340
protected

0 commit comments

Comments
 (0)