Class: Proxy::OpenSCAP::Parse

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_proxy_openscap/openscap_report_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(arf_data) ⇒ Parse

Returns a new instance of Parse.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/smart_proxy_openscap/openscap_report_parser.rb', line 14

def initialize(arf_data)
  OpenSCAP.oscap_init
  size         = arf_data.size
  @arf_digest  = Digest::SHA256.hexdigest(arf_data)
  @arf         = OpenSCAP::DS::Arf.new(:content => arf_data, :path => 'arf.xml.bz2', :length => size)
  @test_result  = @arf.test_result

  @results      = @test_result.rr
  @sds          = @arf.report_request
  bench_source = @sds.select_checklist!
  @benchmark    = OpenSCAP::Xccdf::Benchmark.new(bench_source)
  @items        = @benchmark.items
end

Instance Method Details

#as_jsonObject



36
37
38
# File 'lib/smart_proxy_openscap/openscap_report_parser.rb', line 36

def as_json
  parse_report.to_json
end

#cleanupObject



28
29
30
31
32
33
34
# File 'lib/smart_proxy_openscap/openscap_report_parser.rb', line 28

def cleanup
  @test_result.destroy if @test_result
  @benchmark.destroy if @benchmark
  @sds.destroy if @sds
  @arf.destroy if @arf
  OpenSCAP.oscap_cleanup
end