Class: Risu::Templates::FailedAudits

Inherits:
Base::TemplateBase show all
Includes:
TemplateHelper
Defined in:
lib/risu/templates/failed_audits.rb

Instance Attribute Summary

Attributes inherited from Base::TemplateBase

#output, #template_info

Instance Method Summary collapse

Methods included from TemplateHelper

#default_credential_plugins, #default_credentials_appendix_section, #default_credentials_section, #definition, #has_default_credentials?, #heading1, #heading2, #heading3, #heading4, #heading5, #heading6, #item_count_by_plugin_id, #item_count_by_plugin_name, #new_page, #report_author, #report_classification, #report_subtitle, #report_title, #table, #text, #title

Methods included from ScanHelper

#authenticated_count, #scan_info_to_hash

Methods included from SharesTemplateHelper

#anon_ftp_count, #anon_ftp_section, #anon_smb_count, #anon_smb_query, #anon_smb_section, #shares_appendix_section, #shares_section, #shares_section_has_findings?

Methods included from GraphTemplateHelper

#other_os_graph_page, #risks_by_service_graph_page, #risks_by_severity_graph_page, #root_cause_graph_page, #windows_os_graph_page

Methods included from MalwareTemplateHelper

#conficker_appendix_section, #conficker_count, #conficker_section, #known_malicious_process_appendix_section, #known_malicious_process_count, #known_malicious_process_section, #malware_appendix_section, #malware_section

Methods included from HostTemplateHelper

#unsupported_os, #unsupported_os_appendix_section

Methods inherited from Base::TemplateBase

inherited

Constructor Details

#initializeFailedAudits

Initializes the template loading meta data



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

def initialize
	@template_info =
	{
		:name => "failed_audits",
		:author => "abenson",
		:version => "0.0.2",
		:renderer => "PDF",
		:description => "Failed Audit Checks"
	}
end

Instance Method Details



39
40
41
42
43
44
45
46
# File 'lib/risu/templates/failed_audits.rb', line 39

def print_header(size, text, color)
	oldcolor = @output.fill_color
	@output.font_size(size) do
		@output.fill_color color
		@output.text text, :style => :bold
		@output.fill_color oldcolor
	end
end

#render(output) ⇒ Object

Called during the rendering process



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
# File 'lib/risu/templates/failed_audits.rb', line 50

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

	report_title Report.title
	report_subtitle "Failed Audit Checks"
	report_author "This report was prepared by\n#{Report.author}"

	text "\n\n\n"

	text "Verify each finding. The compliance audits only look for exact matches. For example, if the policy value for minimum password length is 8, and the actual value is 10, this finding can be ignored."

	text "\n\n\n"

	Host.all.each do |h|
		print_header(20, "#{h.name} (#{h.ip})", "000000")

		if h.items.where(:cm_compliance_result => "FAILED").count > 0
			data = [["Name", "Policy", "Value"]]
			h.items.where(:cm_compliance_result => "FAILED").each do |cm|
				data += [[cm.cm_compliance_check_name, cm.cm_compliance_policy_value, cm.cm_compliance_actual_value]]
			end

			output.table(data, :header => true) do
				row(0).style(:font_style => :bold, :background_color => 'D0D0D0')
				cells.borders = [:top, :bottom, :left, :right]
			end
			text "\n"

		elsif h.items.where(:cm_compliance_result => "PASSED").count > 0
			text "Host passed all audits."
		else
			text "Audits were not conducted on host."
		end
	end

	text "\n\n\n"

	output.start_new_page
end