Class: Risu::Templates::ExecutiveSummaryDetailed

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

Instance Attribute Summary

Attributes inherited from Base::TemplateBase

#output, #template_info

Instance Method Summary collapse

Methods inherited from Base::TemplateBase

inherited

Constructor Details

#initializeExecutiveSummaryDetailed

Returns a new instance of ExecutiveSummaryDetailed.



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

def initialize
	@template_info =
	{
		:name => "exec_summary_detailed",
		:author => "Ed Davison <[email protected]>",
		:version => "0.0.4",
		:renderer => "PDF",
		:description => "Generates a detailed executive summary report"
	}
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/risu/templates/executive_summary_detailed.rb', line 41

def render output
	output.font_size 10
	output.font "Times-Roman"

	output.image "#{File.expand_path(File.dirname(__FILE__))}/data/nessuslogo.jpg", :scale => 1.0, :position => :left, :vposition => :top

	output.text "\n"
	output.text "\n"
	output.text "\n"
	output.text "\n"
	output.text "\n"
	output.text "\n"
	output.text "\n"

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

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

	output.text "\n"

	output.start_new_page

	output.font_size(18) { output.text "Executive Summary Report", :align => :center }
	output.text "\n"

	output.text "This report contains the results of a security audit performed on #{Report.scan_date}. It contains confidential information about the state of your network. Access to this information by unauthorized personnel may allow them to compromise your network.\n"
	output.text "\n"

	output.text "The periodic assessment of risk to company assets resulting from the operation of an information system is an important activity required by various audit standards.	 #{Report.company} prepared this Security Assessment Report and it summarizes the risks associated with the vulnerabilities identified during the systems Vulnerability Assessment, audits and any other risk assessment activities.	All results were analyzed to provide an assessment of the management, operational and technical controls implemented to protect the confidentiality, integrity and availability of the system.\n"
	output.text "\n"

	output.text "Scan Statistics", :style => :bold
	output.text "\n"

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

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

	output.text "\n\n\n"

	output.text "A total of #{Host.count} hosts were found and scanned for vulnerabilities.\n"
	output.text "\n"

	output.text "There were #{Item.risks.count} risks found during this scan. Of these, #{Item.critical_risks.count} were Critical risk vulnerabilities. #{Item.high_risks.count} were High risk vulnerabilities. Critical and high risk vulnerabilities require immediate attention to handle as they are relatively easy for attackers to exploit frequently resulting in full access to affected systems.	 There were #{Item.medium_risks.count} findings which were Medium risk.	 High risk vulnerabilities are harder to exploit and may not result in full control of the affected system and should be addressed rapidly and with priority. There were #{Item.low_risks.count} findings which were Low risk vulnerabilities. These risks usually let attackers gain information about your network making it easier for launching more advanced attacks and should be handled in a timely manner. And #{Item.info_risks.count} findings which were information findings.\n"
	output.text "\n"

	crit_host_count = Item.where(:severity => 4).group(:host_id).count.count
	high_host_count = Item.where(:severity => 3).group(:host_id).count.count
	medium_host_count = Item.where(:severity => 2).group(:host_id).count.count
	low_host_count = Item.where(:severity => 1).group(:host_id).count.count
	info_host_count = Item.where(:severity => 0).group(:host_id).count.count

	output.text "There were #{crit_host_count} hosts with Critical risk vulnerabilities, #{high_host_count} hosts with High risk vulnerabilities, #{medium_host_count} hosts with Medium risk vulnerabilities, #{low_host_count} hosts with Low risk vulnerabilities and #{info_host_count} hosts with information findings."
	output.text "\n"

	output.text "The following output.table shows the top 5 vulnerabilities that were found. These are the most important vulnerabilities to address as they represent a sizable footprint for an attacker to exploit in an attempt to compromise.\n"
	output.text "\n"

	results = Array.new
	headers = ["Count", "Vulnerability"]
	header_widths = {0 => 75, 1=> 400}

	top10vulns = Item.risks_by_plugin(5)

	top10vulns.each do |vuln|
		row = Array.new

		plugin = Plugin.find_by_id(vuln.plugin_id)
		#rails3
		#plug = Item.find(:all, :conditions => {:plugin_id => vuln.plugin_id})
		#rails4
		plug = Item.all.where(:plugin_id => vuln.plugin_id)

		#output.text "#{plug.count} - #{plugin.plugin_name}"

		row.push(plug.count)
		row.push(plugin.plugin_name)
		results.push(row)
	end

	output.table([headers] + results, :header => true, :column_widths => header_widths, :row_colors => ['ffffff', 'f0f0f0']) do
		row(0).style(:font_style => :bold, :background_color => 'D0D0D0')
		cells.borders = [:top, :bottom, :left, :right]
	end unless results == nil

	output.text "\n"

	output.text "The following output.table shows the top 5 hosts with the most vulnerabilities.	These should be addressed first and resolved in order or priority of the vulnerabilities found for a given host.\n"
	output.text "\n"

	results = Array.new
	headers = ["Count", "Host"]
	header_widths = {0 => 75, 1=> 400}

	top10vulns = Item.risks_by_host(5)

	top10vulns.each do |vuln|
		row = Array.new

		#plugin = Plugin.find_by_id(vuln.plugin_id)
		ip = Host.find_by_id(vuln.host_id).name
		count = Item.where(:host_id => vuln.host_id).where("severity IN (?)", [0,1,2,3]).count
		#output.text "#{plugin.plugin_name}"

		row.push(count)
		row.push(ip)
		results.push(row)
	end

	output.table([headers] + results, :header => true, :column_widths => header_widths, :row_colors => ['ffffff', 'f0f0f0']) do
		row(0).style(:font_style => :bold, :background_color => 'D0D0D0')
		cells.borders = [:top, :bottom, :left, :right]
	end unless results == nil

	output.text "\n"

	output.text "The following output.table shows the top 5 services with the most vulnerabilities.	 These services represent the avenues that an attacker would utilize based on scans to try to gain a foothold into your enterprise.\n"
	output.text "\n"

	results = Array.new
	headers = ["Count", "Service"]
	header_widths = {0 => 75, 1=> 400}

	top10vulns = Item.risks_by_service(5)

	top10vulns.each do |service|
		row = Array.new

		#plugin = Plugin.find_by_id(service.plugin_id)
		#rails3
		#svc = Item.find(:all, :conditions => {:svc_name => service.svc_name})
		svc = Item.all.where(:svc_name => service.svc_name)

		#output.text "#{svc.count} - #{service.svc_name}"

		row.push(svc.count)
		row.push(service.svc_name)
		results.push(row)
	end

	output.table([headers] + results, :header => true, :column_widths => header_widths, :row_colors => ['ffffff', 'f0f0f0']) do
		row(0).style(:font_style => :bold, :background_color => 'D0D0D0')
		cells.borders = [:top, :bottom, :left, :right]
	end unless results == nil

	output.start_new_page

	output.text "Summary Graphs of Key Finding Statistics", :style => :bold
	output.text "\n\n\n"
	output.text "\n"
	output.text "\n"

	cury = output.y
	output.image Item.risks_by_severity_graph, :width => 250, :at => [output.bounds.left, cury]
	output.image Host.top_vuln_graph(10), :width => 250, :at => [output.bounds.right - 250, cury]

	cury = output.y
	output.image Item.risks_by_service_graph(10), :width => 250, :at => [output.bounds.left, cury]
	output.image Host.other_os_graph, :width => 250, :at => [output.bounds.right - 250, cury]
	output.move_down 225

	cury = output.y
	output.image Host.windows_os_graph, :width => 250, :at => [output.bounds.left, cury]
	output.number_pages "<page> of <total>", :at => [output.bounds.right - 50, 0], :width => 150, :page_filter => :all
end