Class: HeimdallTools::DBProtectMapper
- Inherits:
-
Object
- Object
- HeimdallTools::DBProtectMapper
- Defined in:
- lib/heimdall_tools/dbprotect_mapper.rb
Instance Method Summary collapse
-
#initialize(xml, _name = nil) ⇒ DBProtectMapper
constructor
A new instance of DBProtectMapper.
- #to_hdf ⇒ Object
Constructor Details
#initialize(xml, _name = nil) ⇒ DBProtectMapper
Returns a new instance of DBProtectMapper.
15 16 17 18 19 20 |
# File 'lib/heimdall_tools/dbprotect_mapper.rb', line 15 def initialize(xml, _name = nil) dataset = xml_to_hash(xml) @entries = compile_findings(dataset['dataset']) rescue StandardError => e raise "Invalid DBProtect XML file provided Exception: #{e};\nNote that XML must be of kind `Check Results Details`." end |
Instance Method Details
#to_hdf ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/heimdall_tools/dbprotect_mapper.rb', line 22 def to_hdf controls = [] @entries.each do |entry| @item = {} @item['id'] = entry['Check ID'] @item['title'] = entry['Check'] @item['desc'] = format_desc(entry) @item['impact'] = impact(entry['Risk DV']) @item['tags'] = {} @item['descriptions'] = [] @item['refs'] = NA_ARRAY @item['source_location'] = NA_HASH @item['code'] = '' @item['results'] = finding(entry) controls << @item end controls = collapse_duplicates(controls) results = HeimdallDataFormat.new(profile_name: @entries.first['Policy'], version: '', title: @entries.first['Job Name'], summary: format_summary(@entries.first), controls: controls) results.to_hdf end |