Class: Risu::Templates::NotableTemplateDetailed

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

#initializeNotableTemplateDetailed

Creates an instance of the [NotableTemplateDetailed] class and initializes its meta-data



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

def initialize
	@template_info =
	{
		:name => "notable_detailed",
		:author => "hammackj",
		:version => "0.0.6",
		:renderer => "PDF",
		:description => "Notable Vulnerabilities Detailed"
	}
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
# File 'lib/risu/templates/notable_detailed.rb', line 41

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

	report_title Report.title
	report_subtitle "Notable Vulnerabilities"
	report_author "This report was prepared by\n#{Report.author}"

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

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

	#data = Item.top_10_sorted_raw

	unique_risks = Array.new
	unique_risks << Hash[:title => "Notable Findings", :color => "9B30FF", :values => Item.top_10_sorted_raw[0..9]]
	counter = 1

	unique_risks.each do |h|
		if h[:values].length > 1
			@output.text "\n"

			h[:values].each do |f|
				plugin_id = f[0]

				hosts = Item.where(:plugin_id => plugin_id).group(:host_id)
				#item = Item.where(:plugin_id => plugin_id)
				plugin = Plugin.find_by_id(plugin_id)

				references = Reference.where(:plugin_id => plugin.id).group(:value).order(:reference_name)

				heading3 "#{counter}: #{Item.scrub_plugin_name(plugin.plugin_name)}\n"

				if hosts.length > 1
					@output.text "Hosts (#{hosts.length})", :style => :bold
				else
					@output.text "Host", :style => :bold
				end

				hostlist = Array.new
				hosts.each do |host|
					h = Host.find_by_id(host.host_id)
					host_string = "#{h.name}"
					host_string << " (#{h.fqdn})" if h.fqdn != nil
					hostlist << host_string
				end

				@output.text hostlist.join(', ')

				#if item.plugin_output != nil
				#	@output.text "\nPlugin output", :style => :bold
				#	@output.text f.plugin_output
				#end

				if plugin.description != nil
					@output.text "\nDescription", :style => :bold
					@output.text plugin.description.gsub(/[ ]{2,}/, " ")
				end

				if plugin.synopsis != nil
					@output.text "\nSynopsis", :style => :bold
					@output.text plugin.synopsis
				end

				if plugin.cvss_base_score != nil
					@output.text "\nCVSS Base Score", :style => :bold
					@output.text plugin.cvss_base_score
				end

				if plugin.exploit_available != nil
					@output.text "\nExploit Available", :style => :bold

					plugin.exploit_available? ? "Yes" : "No"
				end

				if plugin.solution != nil
					@output.text "\nSolution", :style => :bold
					@output.text plugin.solution
				end

				if references.size != 0
					@output.text "\nReferences", :style => :bold
					@output.text plugin.references.reference_string, :inline_format => true
					@output.text "<b>nessus_plugin</b>: http://www.tenablesecurity.com/plugins/index.php?view=single&id=#{plugin_id}", :inline_format => true
				end



				@output.text "\n"
				counter += 1
			end
		end

		@output.start_new_page unless h[:values] == nil
	end

	@output.number_pages "<page> of <total>", :at => [@output.bounds.right - 75, 0], :width => 150, :page_filter => :all
end