Class: VmScanProfiles

Inherits:
ScanProfilesBase show all
Defined in:
lib/metadata/ScanProfile/VmScanProfiles.rb

Constant Summary collapse

SCAN_TYPE_CATEGORY =
"category"
SCAN_TYPE_REGISTRY =
"registry"
SCAN_ITEM_CATEGORIES =
"categories"

Instance Attribute Summary

Attributes inherited from ScanProfilesBase

#profiles

Instance Method Summary collapse

Methods inherited from ScanProfilesBase

#each, #each_scan_definition, #each_scan_item, get_class, #initialize, #parse_data, scan_item_class, scan_profile_class, scan_profiles_class, #to_hash, #to_xml, #to_yaml

Constructor Details

This class inherits a constructor from ScanProfilesBase

Instance Method Details

#get_categoriesObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/metadata/ScanProfile/VmScanProfiles.rb', line 11

def get_categories
  categories = []
  # Get data from each "category" scan item
  each_scan_definition(SCAN_TYPE_CATEGORY) do |sd|
    # Add the target items from the content array
    sd["content"].each { |si| categories << si["target"] } unless sd["content"].nil?
  end
  if categories.empty?
    categories = @options[SCAN_ITEM_CATEGORIES].split(",") if @options[SCAN_ITEM_CATEGORIES]
  end
  categories.each do |c|
    c.delete!("\"")
    c.strip!
  end
  categories << "profiles"
  categories.uniq
end

#get_registry_filtersObject



29
30
31
32
33
34
35
36
37
# File 'lib/metadata/ScanProfile/VmScanProfiles.rb', line 29

def get_registry_filters
  reg_filters = Hash.new { |h, k| h[k] = [] }
  each_scan_definition(SCAN_TYPE_REGISTRY) do |sd|
    # Add the target items from the content array and
    # split the registry request into hive/key
    sd["content"].each { |si| reg_filters[si["hive"].to_sym] << si }
  end
  reg_filters
end