Add comments and use run scope on match

MSP-13119
This commit is contained in:
Fernando Arias 2015-09-15 15:09:26 -05:00
parent 621af7311c
commit 382e01d680
No known key found for this signature in database
GPG Key ID: 89EC07CE01DF79A1
2 changed files with 13 additions and 12 deletions

View File

@ -179,19 +179,11 @@ module Msf::DBManager::ExploitAttempt
end
# Create a MetasploitDataModels::AutomaticExploitation::Match result for the given vuln
# @option opts [Integer] :run_id
# @return [void]
def create_match_result_for_vuln(vuln, opts)
run_id = opts[:run_id]
# match = MetasploitDataModels::AutomaticExploitation::Match.joins(
# MetasploitDataModels::AutomaticExploitation::Match.join_association(:match_set),
# MetasploitDataModels::AutomaticExploitation::MatchSet.join_association(:runs)
# ).where(
# MetasploitDataModels::AutomaticExploitation::Run[:id].eq(run_id)
# ).last
require 'pry'
binding.pry
match = MetasploitDataModels::AutomaticExploitation::Match.by_run_id(run_id).last
# If no match found for run, create a run if a vuln has a match
@ -206,6 +198,10 @@ module Msf::DBManager::ExploitAttempt
end
end
# Create a MetasploitDataModels::AutomaticExploitation::Match result with a success or failure state
# @option opts [MetasploitDataModels::AutomaticExploitation::Match] :match
# @option opts [MetasploitDataModels::AutomaticExploitation::Run] :run
# @return [void]
def create_match_result(opts)
if opts[:session_id]
state = MetasploitDataModels::AutomaticExploitation::MatchResult::SUCCEEDED
@ -220,6 +216,11 @@ module Msf::DBManager::ExploitAttempt
)
end
# Create a MetasploitDataModels::AutomaticExploitation::Run for the given vuln
# @option vuln [Mdm::Vuln] :vuln
# @option opts [Mdm::Workspace] :workspace
# @option opts [String] :username
# @return [ MetasploitDataModels::AutomaticExploitation::Match, MetasploitDataModels::AutomaticExploitation::Run]
def create_run_for_vuln(vuln,opts)
wspace = opts[:workspace] || workspace
username = opts[:username]

View File

@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
# Metasploit::Credential database models
spec.add_runtime_dependency 'metasploit-credential', '1.0.1'
# Database models shared between framework and Pro.
spec.add_runtime_dependency 'metasploit_data_models', '1.2.5'
spec.add_runtime_dependency 'metasploit_data_models', '1.2.7'
# depend on metasploit-framewrok as the optional gems are useless with the actual code
spec.add_runtime_dependency 'metasploit-framework', "= #{spec.version}"
# Needed for module caching in Mdm::ModuleDetails