Add user_data_is_match? method

bug/bundler_fix
James Lee 2015-03-09 15:35:53 -05:00
parent ff91953f92
commit 838746b021
No known key found for this signature in database
GPG Key ID: 2D6094C7CEA0A321
2 changed files with 19 additions and 0 deletions

View File

@ -278,6 +278,14 @@ class Module
raise RuntimeError, "#{reason.to_s}: #{msg}"
end
# Whether {user_data} contains everything necessary to make a
# `MetasploitDataModels::AutomaticExploitation::MatchResult`
#
# @return [bool]
def user_data_is_match?
user_data.kind_of?(Hash) && user_data.keys == [ :match, :match_set, :run ]
end
##
#
# Just some handy quick checks

View File

@ -46,6 +46,17 @@ describe Msf::Module do
it { is_expected.to respond_to :is_usable }
end
describe '#user_data_is_match?' do
subject(:msf_module) {
msf_module = described_class.new
msf_module.user_data = { match: 'match', match_set: 'match_set', run: 'run' }
msf_module
}
specify do
expect(msf_module.user_data_is_match?).to eq(true)
end
end
describe "cloning modules into replicants" do
module MsfExtensionTestFoo; def my_test1; true; end; end;
module MsfExtensionTestBar; def my_test2; true; end; end;