Class: Risu::Templates::MissingRootCauses

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

Instance Attribute Summary

Attributes inherited from Base::TemplateBase

#output, #template_info

Instance Method Summary collapse

Methods inherited from Base::TemplateBase

inherited

Constructor Details

#initializeMissingRootCauses

Returns a new instance of MissingRootCauses.



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

def initialize
	@template_info =
	{
		:name => "missing_root_causes",
		:author => "hammackj",
		:version => "0.0.1",
		:renderer => "PDF",
		:description => "Generates a Report of all the findings without a root cause"
	}
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/risu/templates/missing_root_causes.rb', line 41

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

	output.font_size(22) do
		output.text Report.title, :align => :center
	end

	output.font_size(18) do
		output.text "Missing Root Causes Report", :align => :center
		output.text "\n"
		output.text "This report was prepared by\n#{Report.author}", :align => :center
	end

	output.text "\n\n\n"

	output.font_size(20) {
		output.fill_color "9B30FF"
		output.text "Critical Findings", :style => :bold
		output.fill_color "000000"
	}

	Item.critical_risks_unique_sorted.each do |item|
		plugin = Plugin.find_by_id(item.plugin_id)
		name = Plugin.find_by_id(item.plugin_id).plugin_name
		count = Item.where(:plugin_id => item.plugin_id).count

		if plugin.root_cause != nil
			next
		end

		output.text "#{count} - #{name} - #{item.plugin_id}" 
	end

	output.start_new_page

	output.font_size(20) do
		output.fill_color "FF0000"
		output.text "High Findings", :style => :bold
		output.fill_color "000000"
	end

	Item.high_risks_unique_sorted.each do |item|
		plugin = Plugin.find_by_id(item.plugin_id)
		name = Plugin.find_by_id(item.plugin_id).plugin_name
		count = Item.where(:plugin_id => item.plugin_id).count

		if plugin.root_cause != nil
			next
		end					

		output.text "#{count} - #{name} - #{item.plugin_id}"
	end

	output.start_new_page

	output.font_size(20) {
		output.fill_color "FF8040"
		output.text "Medium Findings", :style => :bold
		output.fill_color "000000"
	}

	Item.medium_risks_unique_sorted.each do |item|
		plugin = Plugin.find_by_id(item.plugin_id)
		name = Plugin.find_by_id(item.plugin_id).plugin_name
		count = Item.where(:plugin_id => item.plugin_id).count

		if plugin.root_cause != nil
			next
		end

		output.text "#{count} - #{name} - #{item.plugin_id}"
	end

	output.start_new_page

	output.font_size(20) {
		output.fill_color "0000FF"
		output.text "Low Findings", :style => :bold
		output.fill_color "000000"
	}

	Item.low_risks_unique_sorted.each do |item|
		plugin = Plugin.find_by_id(item.plugin_id)
		name = Plugin.find_by_id(item.plugin_id).plugin_name
		count = Item.where(:plugin_id => item.plugin_id).count

		if plugin.root_cause != nil
			next
		end

		output.text "#{count} - #{name} - #{item.plugin_id}"
	end

	output.start_new_page

	output.font_size(20) {
		output.fill_color "008000"
		output.text "Info Findings", :style => :bold
		output.fill_color "000000"
	}
	
	Item.info_risks_unique_sorted.each do |item|
		plugin = Plugin.find_by_id(item.plugin_id)
		name = Plugin.find_by_id(item.plugin_id).plugin_name
		count = Item.where(:plugin_id => item.plugin_id).count

		if plugin.root_cause != nil
			next
		end
	
		output.text "#{count} - #{name} - #{item.plugin_id}"
	end
end