Class: Risu::Templates::FindingStatistics

Inherits:
Base::TemplateBase show all
Defined in:
lib/risu/templates/finding_statistics.rb

Instance Attribute Summary

Attributes inherited from Base::TemplateBase

#output, #template_info

Instance Method Summary collapse

Methods inherited from Base::TemplateBase

inherited

Constructor Details

#initializeFindingStatistics

Returns a new instance of FindingStatistics.



28
29
30
31
32
33
34
35
36
37
# File 'lib/risu/templates/finding_statistics.rb', line 28

def initialize
	@template_info =
	{
		:name => "finding_statistics",
		:author => "hammackj",
		:version => "0.0.1",
		:renderer => "PDF",
		:description => "Generates report finding statistics"
	}
end

Instance Method Details

#render(output) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/risu/templates/finding_statistics.rb', line 41

def render output
	output.text Report.classification.upcase, :align => :center
	output.text "\n"

	output.font_size(22) { output.text Report.title, :align => :center }
	output.font_size(18) {
		output.text "Finding Statistics", :align => :center
		output.text "\n"
		output.text "This report was prepared by\n#{Report.author}", :align => :center
	}

	output.text "\n\n\n"

	output.text "Scan Date:", :style => :bold
	output.text "#{Report.scan_date}"
	output.text "\n"

	headers = ["Number of hosts","Number of risks","High Risks", "Medium Risks", "Low Risks", "Info Risks"]
	data = [Host.count, Item.risks.count, Item.high_risks.count, Item.medium_risks.count, Item.low_risks.count, Item.info_risks.count]

	output.table([headers] + [data], :header => true, :width => output.bounds.width) do
		row(0).style(:font_style => :bold, :background_color => 'cccccc')
		cells.borders = [:top, :bottom, :left, :right]
	end

end