ELK merge - includes new Elastalert, Logstash, Kibana, Elastalert, Auditbeat, Filebeat modules and other misc changes.

This commit is contained in:
thomashaw
2021-11-15 19:13:09 +00:00
parent fcf457711e
commit 7c71c45d29
314 changed files with 4946 additions and 19102 deletions

View File

@@ -89,7 +89,7 @@ class Module
# @return [Object] the module path with _ rather than / for use as a variable name
def module_path_name
module_path_name = module_path.clone
module_path_name.gsub!('/','_')
module_path_name.gsub!('/', '_')
end
# @return [Object] a list of attributes that can be used to re-select the same modules

View File

@@ -2,30 +2,40 @@ require 'json'
require 'base64'
require 'duplicate'
require_relative '../helpers/scenario'
class System
attr_accessor :name
attr_accessor :hostname
attr_accessor :attributes # (basebox selection)
attr_accessor :module_selectors # (filters)
attr_accessor :module_selections # (after resolution)
attr_accessor :num_actioned_module_conflicts
attr_accessor :memory # (RAM allocation for the system)
attr_accessor :options # (command line options hash)
attr_accessor :scenario_path # (path to scenario file associated with this system)
# Attributes for resetting retry loop
attr_accessor :available_mods #(command line options hash)
attr_accessor :original_datastores #(command line options hash)
attr_accessor :original_module_selectors #(command line options hash)
attr_accessor :original_available_modules #(command line options hash)
attr_accessor :available_mods
attr_accessor :original_datastores
attr_accessor :original_module_selectors
attr_accessor :original_available_modules
# Initalizes System object
# @param [Object] name of the system
# @param [Object] attributes such as base box selection
# @param [Object] module_selectors these are modules that define filters for selecting the actual modules to use
def initialize(name, attributes, module_selectors)
def initialize(name, attributes, module_selectors, scenario_file, options)
self.name = name
self.attributes = attributes
self.module_selectors = module_selectors
self.module_selections = []
self.num_actioned_module_conflicts = 0
self.memory = "512"
self.options = options
self.scenario_path = scenario_file
set_hostname
end
# selects from the available modules, based on the selection filters that have been specified
@@ -463,4 +473,36 @@ class System
modules_to_add
end
def has_module(module_name)
has_module = false
module_selections.each do |mod|
if mod.module_path_end == module_name
has_module = true
end
end
has_module
end
def get_module(module_name)
selected_module = nil
module_selections.each do |mod|
if mod.module_path_end == module_name
selected_module = mod
end
end
selected_module
end
def set_options(opts)
self.options = opts if opts != nil and self.options == {}
end
def set_hostname
self.hostname = ScenarioHelper.get_hostname(self.options, self.scenario_path, self.name)
end
def get_hostname
set_hostname
self.hostname
end
end