Class: Risu::Templates::PCICompliance

Inherits:
Base::TemplateBase show all
Includes:
TemplateHelper
Defined in:
lib/risu/templates/pci_compliance.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

#initializePCICompliance

Returns a new instance of PCICompliance.



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

def initialize
	@template_info =
	{
		:name => "pci_compliance",
		:author => "hammackj",
		:version => "0.0.6",
		:renderer => "PDF",
		:description => "Generates a PCI Compliance Overview Report"
	}
end

Instance Method Details

#render(output) ⇒ Object



38
39
40
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
# File 'lib/risu/templates/pci_compliance.rb', line 38

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

	report_title Report.title
	report_subtitle "PCI / DSS Compliance Overview"
	report_author "This report was prepared by\n#{Report.author}"

	text "\n\n\n"

	#@hosts_count = Host.find(:all, :conditions => ["pci_dss_compliance is not null"]).count
	@hosts_count = HostProperty.where(:name => "pci-dss-compliance").count
	#@hosts_passed = Host.find(:all, :conditions => ["pci_dss_compliance like 'passed'"])
	@hosts_passed = HostProperty.where(:name => "pci-dss-compliance").where(:value => "passed")
	#@hosts_failed = Host.find(:all, :conditions => ["pci_dss_compliance like 'failed'"])
	@hosts_failed = HostProperty.where(:name => "pci-dss-compliance").where(:value => "failed")

	output.font_size(20) do
		output.text "Summary\n", :style => :bold
	end

	text "Of #{@hosts_count} total hosts, #{@hosts_passed.count} passed and #{@hosts_failed.count} failed."

	text "\n\n"

	if @hosts_passed.length > 0
		output.font_size(20) do
			output.fill_color "00FF00"
			output.text "PCI / DSS Compliant Hosts", :style => :bold
			output.fill_color "000000"
		end

		output.text "\n"

		@hosts_passed.each do |host_prop|
			host = host_prop.host
			text "#{host.ip} / #{host.fqdn} - passed\n"
		end unless @hosts_passed == nil

		output.start_new_page
	end

	if @hosts_failed.length > 0
		output.font_size(20) do
			output.fill_color "FF0000"
			output.text "Non PCI / DSS Compliant Hosts", :style => :bold
			output.fill_color "000000"
		end

		text "\n"

		@hosts_failed.each do |host_prop|
			host_id = host_prop.host_id
			host = host_prop.host
			plugin = Plugin.find(:first, :conditions => { :id => 33929 })
			item = Item.find(:first, :conditions => { :host_id => host_id, :plugin_id => plugin.id })

			output.text "#{host.ip} / #{host.fqdn} - failed\n", :style => :bold
			output.text "Description:\n", :style => :bold
			output.text "#{plugin.description}\n"
			output.text "Plugin Output:\n", :style => :bold
			output.text "#{item.plugin_output}\n"

			text "\n"

		end unless @hosts_failed == nil

		output.start_new_page
	end

end