risu 1.4.4 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/NEWS.markdown +14 -1
  2. data/README.markdown +23 -41
  3. data/TODO.markdown +48 -39
  4. data/lib/risu.rb +4 -9
  5. data/lib/risu/base.rb +15 -0
  6. data/lib/risu/base/prawn_templater.rb +37 -0
  7. data/lib/risu/{schema.rb → base/schema.rb} +34 -15
  8. data/lib/risu/base/template_base.rb +23 -0
  9. data/lib/risu/base/template_manager.rb +106 -0
  10. data/lib/risu/base/templater.rb +37 -0
  11. data/lib/risu/cli/application.rb +28 -8
  12. data/lib/risu/models.rb +1 -2
  13. data/lib/risu/models/host.rb +147 -23
  14. data/lib/risu/models/item.rb +131 -43
  15. data/lib/risu/models/plugin.rb +1 -1
  16. data/lib/risu/models/report.rb +11 -1
  17. data/lib/risu/models/serverpreference.rb +0 -2
  18. data/lib/risu/models/servicedescription.rb +10 -0
  19. data/lib/risu/parsers.rb +2 -3
  20. data/lib/risu/parsers/nessus/nessus_document.rb +69 -0
  21. data/lib/risu/parsers/nessus/nessus_sax_listener.rb +278 -0
  22. data/lib/risu/templates/assets.rb +45 -18
  23. data/lib/risu/templates/cover_sheet.rb +70 -42
  24. data/lib/risu/templates/exec_summary.rb +64 -45
  25. data/lib/risu/templates/executive_summary.rb +185 -161
  26. data/lib/risu/templates/finding_statistics.rb +44 -17
  27. data/lib/risu/templates/findings_host.rb +70 -46
  28. data/lib/risu/templates/findings_summary.rb +78 -54
  29. data/lib/risu/templates/findings_summary_with_pluginid.rb +80 -54
  30. data/lib/risu/templates/graphs.rb +46 -19
  31. data/lib/risu/templates/host_summary.rb +62 -39
  32. data/lib/risu/templates/ms_patch_summary.rb +59 -35
  33. data/lib/risu/templates/ms_update_summary.rb +59 -35
  34. data/lib/risu/templates/pci_compliance.rb +88 -64
  35. data/lib/risu/templates/technical_findings.rb +132 -106
  36. data/lib/risu/templates/template.rb +24 -0
  37. metadata +12 -6
  38. data/lib/risu/listener.rb +0 -274
  39. data/lib/risu/nessusdocument.rb +0 -66
  40. data/lib/risu/prawn_templater.rb +0 -38
@@ -1,21 +1,48 @@
1
- text Report.classification, :align => :center
2
- text "\n"
1
+ module Risu
2
+ module Modules
3
+ class Assests < Risu::Base::TemplateBase
4
+
5
+ #
6
+ #
7
+ def initialize ()
8
+ @template_info =
9
+ {
10
+ :name => "assets",
11
+ :author => "hammackj",
12
+ :version => "0.0.1",
13
+ :description => "Generates a Assets Summary Report"
14
+ }
15
+ end
16
+
17
+ #
18
+ #
19
+ def render(output)
20
+ output.text Report.classification, :align => :center
21
+ output.text "\n"
3
22
 
4
- font_size(22) { text Report.title, :align => :center }
5
- font_size(18) {
6
- text "Networked Assets", :align => :center
7
- text "\n"
8
- text "This report was prepared by\n#{Report.author}", :align => :center
9
- }
23
+ output.font_size(22) {
24
+ output.text Report.title, :align => :center
25
+ }
26
+
27
+ output.font_size(18) {
28
+ output.text "Networked Assets", :align => :center
29
+ output.text "\n"
30
+ output.text "This report was prepared by\n#{Report.author}", :align => :center
31
+ }
10
32
 
11
- text "\n\n"
33
+ output.text "\n\n"
34
+
35
+ Host.sorted.each do |host|
36
+ output.text "Name: #{host.name}\n"
37
+ output.text "FQDN: #{host.fqdn}\n" unless host.fqdn == nil
38
+ output.text "IP Address: #{host.ip}\n" unless host.ip == nil
39
+ output.text "NetBios: #{host.netbios}\n" unless host.netbios == nil
40
+ output.text sprintf "Mac Address: %s\n", host.mac.chomp.gsub("\n", ", ") unless host.mac == nil
41
+ output.text sprintf "Operation System: %s\n", host.os.chomp.gsub("\n", "/") unless host.os == nil
42
+ output.text "\n"
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
12
48
 
13
- Host.sorted.each do |host|
14
- text "Name: #{host.name}\n"
15
- text "FQDN: #{host.fqdn}\n" unless host.fqdn == nil
16
- text "IP Address: #{host.ip}\n" unless host.ip == nil
17
- text "NetBios: #{host.netbios}\n" unless host.netbios == nil
18
- text sprintf "Mac Address: %s\n", host.mac.chomp.gsub("\n", ", ") unless host.mac == nil
19
- text sprintf "Operation System: %s\n", host.os.chomp.gsub("\n", "/") unless host.os == nil
20
- text "\n"
21
- end
@@ -1,42 +1,70 @@
1
- image File.dirname(template) + "/data/nessuslogo.jpg", :scale => 0.2, :position => :left, :vposition => :top
2
-
3
- text "\n"
4
- text "\n"
5
- text "\n"
6
- text "\n"
7
- text "\n"
8
- text "\n"
9
- text "\n"
10
-
11
- font_size(24) { text Report.title, :align => :center }
12
-
13
- font_size(18) {
14
- text "Coversheet Example", :align => :center
15
- text "\n"
16
- text "This report was prepared by\n#{Report.author}", :align => :center
17
- }
18
-
19
- text "\n"
20
- text "\n"
21
- text "\n"
22
- text "\n"
23
- text "\n"
24
- text "\n"
25
- text "\n"
26
- text "\n"
27
- text "\n"
28
- text "\n"
29
- text "\n"
30
- text "\n"
31
- text "\n"
32
- text "\n"
33
- text "\n"
34
- text "\n"
35
- text "\n"
36
- text "\n"
37
- text "\n"
38
- text "\n"
39
- text "\n"
40
- text "\n"
41
-
42
- text "Nessus is a Registered Trademark of Tenable Network Security, Inc."
1
+ module Risu
2
+ module Modules
3
+ class CoverSheet < Risu::Base::TemplateBase
4
+
5
+ #
6
+ #
7
+ def initialize ()
8
+ @template_info =
9
+ {
10
+ :name => "cover_sheet",
11
+ :author => "hammackj",
12
+ :version => "0.0.1",
13
+ :description => "Generates a coversheet with a logo (Example Template)"
14
+ }
15
+ end
16
+
17
+ #
18
+ #
19
+ def render(output)
20
+ output.image "#{File.expand_path(File.dirname(__FILE__))}/data/nessuslogo.jpg", :scale => 0.2, :position => :left, :vposition => :top
21
+
22
+ output.text "\n"
23
+ output.text "\n"
24
+ output.text "\n"
25
+ output.text "\n"
26
+ output.text "\n"
27
+ output.text "\n"
28
+ output.text "\n"
29
+
30
+ output.font_size(24) do
31
+ output.text Report.title, :align => :center
32
+ end
33
+
34
+ output.font_size(18) do
35
+ output.text "Coversheet Example", :align => :center
36
+ output.text "\n"
37
+ output.text "This report was prepared by\n#{Report.author}", :align => :center
38
+ end
39
+
40
+ output.text "\n"
41
+ output.text "\n"
42
+ output.text "\n"
43
+ output.text "\n"
44
+ output.text "\n"
45
+ output.text "\n"
46
+ output.text "\n"
47
+ output.text "\n"
48
+ output.text "\n"
49
+ output.text "\n"
50
+ output.text "\n"
51
+ output.text "\n"
52
+ output.text "\n"
53
+ output.text "\n"
54
+ output.text "\n"
55
+ output.text "\n"
56
+ output.text "\n"
57
+ output.text "\n"
58
+ output.text "\n"
59
+ output.text "\n"
60
+ output.text "\n"
61
+ output.text "\n"
62
+
63
+ output.text "Nessus is a Registered Trademark of Tenable Network Security, Inc."
64
+ end
65
+ end
66
+ end
67
+ end
68
+
69
+
70
+
@@ -1,56 +1,75 @@
1
- text Report.classification, :align => :center
2
- text "\n"
1
+ module Risu
2
+ module Modules
3
+ class ExecSummary < Risu::Base::TemplateBase
4
+
5
+ #
6
+ #
7
+ def initialize ()
8
+ @template_info =
9
+ {
10
+ :name => "exec_summary",
11
+ :author => "hammackj",
12
+ :version => "0.0.1",
13
+ :description => "Generates a simple executive summary."
14
+ }
15
+ end
16
+
17
+ #
18
+ #
19
+ def render(output)
20
+ output.text Report.classification, :align => :center
21
+ output.text "\n"
3
22
 
4
- font_size(22) { text Report.title, :align => :center }
5
- font_size(18) {
6
- text "Executive Summary", :align => :center
7
- text "\n"
8
- text "This report was prepared by\n#{Report.author}", :align => :center
9
- }
23
+ output.font_size(22) { output.text Report.title, :align => :center }
24
+ output.font_size(18) {
25
+ output.text "Executive Summary", :align => :center
26
+ output.text "\n"
27
+ output.text "This report was prepared by\n#{Report.author}", :align => :center
28
+ }
10
29
 
11
- text "\n\n\n"
30
+ output.text "\n\n\n"
12
31
 
13
- text "Scan Date:", :style => :bold
14
- text "#{Report.scan_date}"
15
- text "\n"
32
+ output.text "Scan Date:", :style => :bold
33
+ output.text "#{Report.scan_date}"
34
+ output.text "\n"
16
35
 
17
- 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\n"
36
+ 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\n"
18
37
 
19
- text "A total of #{Host.count} hosts were found and scanned for vulnerabities.\n\n"
38
+ output.text "A total of #{Host.count} hosts were found and scanned for vulnerabities.\n\n"
20
39
 
21
- text "There were #{Item.risks.count} vulnerabilities found during this scan. Of these, #{Item.high_risks.count} were high vulnerabilities, #{Item.medium_risks.count} were medium vulnerabilities, #{Item.low_risks.count} were low vulnerabilities and #{Item.info_risks.count} were information findings.\n\n"
40
+ output.text "There were #{Item.risks.count} vulnerabilities found during this scan. Of these, #{Item.high_risks.count} were high vulnerabilities, #{Item.medium_risks.count} were medium vulnerabilities, #{Item.low_risks.count} were low vulnerabilities and #{Item.info_risks.count} were information findings.\n\n"
22
41
 
23
- text "Scan Statistics", :style => :bold
24
- text "\n"
42
+ output.text "Scan Statistics", :style => :bold
43
+ output.text "\n"
25
44
 
26
- table([["Number of hosts","Number of risks","High Risks", "Medium Risks", "Low Risks", "Info Risks"],
27
- [Host.count, Item.risks.count, Item.high_risks.count, Item.medium_risks.count, Item.low_risks.count, Item.info_risks.count]],
28
- :cell_style => { :padding =>12 }, :width => bounds.width)
29
- text "\n\n\n"
45
+ output.table([["Number of hosts","Number of risks","High Risks", "Medium Risks", "Low Risks", "Info Risks"],
46
+ [Host.count, Item.risks.count, Item.high_risks.count, Item.medium_risks.count, Item.low_risks.count, Item.info_risks.count]],
47
+ :cell_style => { :padding =>12 }, :width => output.bounds.width)
48
+ output.text "\n\n\n"
30
49
 
31
- text "Graphs of key finding statistics", :style => :bold
32
- text "\n\n\n"
50
+ output.text "Graphs of key finding statistics", :style => :bold
51
+ output.text "\n\n\n"
33
52
 
34
- cury = y
35
- image Item.risks_by_severity_graph, :width => 250, :at => [bounds.left, cury]
36
- image Host.top_vuln_graph(10), :width => 250, :at => [bounds.right - 250, cury]
37
- move_down 50
38
- if (y <= 300)
39
- start_new_page
40
- move_down 75
53
+ cury = output.y
54
+ output.image Item.risks_by_severity_graph, :width => 250, :at => [output.bounds.left, cury]
55
+ output.image Host.top_vuln_graph(10), :width => 250, :at => [output.bounds.right - 250, cury]
56
+ output.move_down 50
57
+ if (output.y <= 300)
58
+ output.start_new_page
59
+ output.move_down 75
60
+ end
61
+ cury = output.y
62
+ output.image Item.risks_by_service_graph(10), :width => 250, :at => [output.bounds.left, cury]
63
+ output.image Host.other_os_graph, :width => 250, :at => [output.bounds.right - 250, cury]
64
+ output.move_down 250
65
+ #if (y <= 300)
66
+ # output.start_new_page
67
+ # cury = y
68
+ #end
69
+ cury = output.y
70
+ #move_down 550
71
+ output.image Host.windows_os_graph, :width => 250, :at => [output.bounds.left, cury]
72
+ end
73
+ end
74
+ end
41
75
  end
42
- cury = y
43
- image Item.risks_by_service_graph(10), :width => 250, :at => [bounds.left, cury]
44
- image Host.other_os_graph, :width => 250, :at => [bounds.right - 250, cury]
45
- move_down 250
46
- #if (y <= 300)
47
- # start_new_page
48
- # cury = y
49
- #end
50
- cury = y
51
- #move_down 550
52
- image Host.windows_os_graph, :width => 250, :at => [bounds.left, cury]
53
-
54
-
55
-
56
-
@@ -1,182 +1,206 @@
1
- #Author: Ed Davison <EDavison@getmns.com>
1
+ module Risu
2
+ module Modules
3
+ class ExecutiveSummaryDetailed < Risu::Base::TemplateBase
4
+
5
+ #
6
+ #
7
+ def initialize ()
8
+ @template_info =
9
+ {
10
+ :name => "exec_summary_detailed",
11
+ :author => "Ed Davison <EDavison@getmns.com>",
12
+ :version => "0.0.1",
13
+ :description => "Generates a detailed executive summary report"
14
+ }
15
+ end
16
+
17
+ #
18
+ #
19
+ def render(output)
20
+ output.font_size 10
21
+ output.font "Times-Roman"
2
22
 
3
- font_size 10
4
- font "Times-Roman"
23
+ output.image "#{File.expand_path(File.dirname(__FILE__))}/data/nessuslogo.jpg", :scale => 1.0, :position => :left, :vposition => :top
5
24
 
6
- image File.dirname(template) + "/data/nessuslogo.jpg", :scale => 1.0, :position => :left, :vposition => :top
25
+ output.text "\n"
26
+ output.text "\n"
27
+ output.text "\n"
28
+ output.text "\n"
29
+ output.text "\n"
30
+ output.text "\n"
31
+ output.text "\n"
7
32
 
8
- text "\n"
9
- text "\n"
10
- text "\n"
11
- text "\n"
12
- text "\n"
13
- text "\n"
14
- text "\n"
33
+ output.font_size(24) do
34
+ output.text Report.title, :align => :center
35
+ end
36
+
37
+ output.font_size(18) do
38
+ output.text "Executive Summary Report", :align => :center
39
+ output.text "\n"
40
+ output.text "This report was prepared by\n", :align => :center
41
+ output.text "#{Report.author}", :align => :center
42
+ output.text "#{Report.company}", :align => :center
43
+ output.text "\n"
44
+ output.text "#{Report.scan_date}", :align => :center
45
+ output.text "\n"
46
+ end
15
47
 
16
- font_size(24) { text Report.title, :align => :center }
48
+ output.text "\n"
17
49
 
18
- font_size(18) {
19
- text "Executive Summary Report", :align => :center
20
- text "\n"
21
- text "This report was prepared by\n", :align => :center
22
- text "#{Report.author}", :align => :center
23
- text "#{Report.company}", :align => :center
24
- text "\n"
25
- text "#{Report.scan_date}", :align => :center
26
- text "\n"
27
- }
50
+ output.start_new_page
28
51
 
29
- text "\n"
52
+ output.font_size(18) { output.text "Executive Summary Report", :align => :center }
53
+ output.text "\n"
30
54
 
31
- start_new_page
55
+ 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"
56
+ output.text "\n"
32
57
 
33
- font_size(18) { text "Executive Summary Report", :align => :center }
34
- text "\n"
58
+ 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"
59
+ output.text "\n"
35
60
 
36
- 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"
37
- text "\n"
61
+ output.text "Scan Statistics", :style => :bold
62
+ output.text "\n"
38
63
 
39
- 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"
40
- text "\n"
64
+ headers = ["Number of hosts","Number of risks","High Risks", "Medium Risks", "Low Risks", "Info Risks"]
65
+ data = [[Host.count, Item.risks.count, Item.high_risks.count, Item.medium_risks.count, Item.low_risks.count, Item.info_risks.count]]
41
66
 
42
- text "Scan Statistics", :style => :bold
43
- text "\n"
67
+ output.table([headers] + data, :header => true, :row_colors => ['ffffff', 'f0f0f0']) do
68
+ row(0).style(:font_style => :bold, :background_color => 'cccccc')
69
+ cells.borders = [:top, :bottom, :left, :right]
70
+ end unless data == nil
44
71
 
45
- headers = ["Number of hosts","Number of risks","High Risks", "Medium Risks", "Low Risks", "Info Risks"]
46
- data = [[Host.count, Item.risks.count, Item.high_risks.count, Item.medium_risks.count, Item.low_risks.count, Item.info_risks.count]]
72
+ output.text "\n\n\n"
47
73
 
48
- table([headers] + data, :header => true, :row_colors => ['ffffff', 'f0f0f0']) do
49
- row(0).style(:font_style => :bold, :background_color => 'cccccc')
50
- cells.borders = [:top, :bottom, :left, :right]
51
- end unless data == nil
74
+ output.text "A total of #{Host.count} hosts were found and scanned for vulnerabities.\n"
75
+ output.text "\n"
52
76
 
53
- text "\n\n\n"
77
+ output.text "There were #{Item.risks.count} risks found during this scan. Of these, #{Item.high_risks.count} were High risk vulnerabilities. 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"
78
+ output.text "\n"
54
79
 
55
- text "A total of #{Host.count} hosts were found and scanned for vulnerabities.\n"
56
- text "\n"
80
+ high_host_count = Item.where(:severity => 3).group(:host_id).all.count
81
+ medium_host_count = Item.where(:severity => 2).group(:host_id).all.count
82
+ low_host_count = Item.where(:severity => 1).group(:host_id).all.count
83
+ info_host_count = Item.where(:severity => 0).group(:host_id).all.count
84
+
85
+ output.text "There were #{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."
86
+ output.text "\n"
87
+
88
+ 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 sizeable footprint for an attacker to exploit in an attempt to compromise.\n"
89
+ output.text "\n"
90
+
91
+ results = Array.new
92
+ headers = ["Count", "Vulnerability"]
93
+ header_widths = {0 => 75, 1=> 400}
94
+
95
+ top10vulns = Item.risks_by_plugin(5)
96
+
97
+ top10vulns.each do |vuln|
98
+ row = Array.new
99
+
100
+ plugin = Plugin.find_by_id(vuln.plugin_id)
101
+ plug = Item.find(:all, :conditions => {:plugin_id => vuln.plugin_id})
102
+ #output.text "#{plug.count} - #{plugin.plugin_name}"
103
+
104
+ row.push(plug.count)
105
+ row.push(plugin.plugin_name)
106
+ results.push(row)
107
+ end
108
+
109
+ output.table([headers] + results, :header => true, :column_widths => header_widths, :row_colors => ['ffffff', 'f0f0f0']) do
110
+ row(0).style(:font_style => :bold, :background_color => 'D0D0D0')
111
+ cells.borders = [:top, :bottom, :left, :right]
112
+ end unless results == nil
113
+
114
+ output.text "\n"
115
+
116
+ 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"
117
+ output.text "\n"
118
+
119
+ results = Array.new
120
+ headers = ["Count", "Host"]
121
+ header_widths = {0 => 75, 1=> 400}
122
+
123
+ top10vulns = Item.risks_by_host(5)
124
+
125
+ top10vulns.each do |vuln|
126
+ row = Array.new
127
+
128
+ #plugin = Plugin.find_by_id(vuln.plugin_id)
129
+ ip = Host.find_by_id(vuln.host_id).name
130
+ count = Item.where(:host_id => vuln.host_id).where("severity IN (?)", [0,1,2,3]).count
131
+ #output.text "#{plugin.plugin_name}"
132
+
133
+ row.push(count)
134
+ row.push(ip)
135
+ results.push(row)
136
+ end
137
+
138
+ output.table([headers] + results, :header => true, :column_widths => header_widths, :row_colors => ['ffffff', 'f0f0f0']) do
139
+ row(0).style(:font_style => :bold, :background_color => 'D0D0D0')
140
+ cells.borders = [:top, :bottom, :left, :right]
141
+ end unless results == nil
57
142
 
58
- text "There were #{Item.risks.count} risks found during this scan. Of these, #{Item.high_risks.count} were High risk vulnerabilities. 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"
59
- text "\n"
143
+ output.text "\n"
60
144
 
61
- high_host_count = Item.where(:severity => 3).group(:host_id).all.count
62
- medium_host_count = Item.where(:severity => 2).group(:host_id).all.count
63
- low_host_count = Item.where(:severity => 1).group(:host_id).all.count
64
- info_host_count = Item.where(:severity => 0).group(:host_id).all.count
145
+ 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"
146
+ output.text "\n"
65
147
 
66
- text "There were #{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."
67
- text "\n"
148
+ results = Array.new
149
+ headers = ["Count", "Service"]
150
+ header_widths = {0 => 75, 1=> 400}
68
151
 
69
- text "The following table shows the top 5 vulnerabilities that were found. These are the most important vulnerabilities to address as they represent a sizeable footprint for an attacker to exploit in an attempt to compromise.\n"
70
- text "\n"
71
-
72
- results = Array.new
73
- headers = ["Count", "Vulnerability"]
74
- header_widths = {0 => 75, 1=> 400}
75
-
76
- top10vulns = Item.risks_by_plugin(5)
77
-
78
- top10vulns.each do |vuln|
79
- row = Array.new
80
-
81
- plugin = Plugin.find_by_id(vuln.plugin_id)
82
- plug = Item.find(:all, :conditions => {:plugin_id => vuln.plugin_id})
83
- #text "#{plug.count} - #{plugin.plugin_name}"
84
-
85
- row.push(plug.count)
86
- row.push(plugin.plugin_name)
87
- results.push(row)
88
- end
89
-
90
- table([headers] + results, :header => true, :column_widths => header_widths, :row_colors => ['ffffff', 'f0f0f0']) do
91
- row(0).style(:font_style => :bold, :background_color => 'D0D0D0')
92
- cells.borders = [:top, :bottom, :left, :right]
93
- end unless results == nil
94
-
95
- text "\n"
96
-
97
- text "The following 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"
98
- text "\n"
99
-
100
- results = Array.new
101
- headers = ["Count", "Host"]
102
- header_widths = {0 => 75, 1=> 400}
103
-
104
- top10vulns = Item.risks_by_host(5)
105
-
106
- top10vulns.each do |vuln|
107
- row = Array.new
108
-
109
- #plugin = Plugin.find_by_id(vuln.plugin_id)
110
- ip = Host.find_by_id(vuln.host_id).name
111
- count = Item.where(:host_id => vuln.host_id).where("severity IN (?)", [0,1,2,3]).count
112
- #text "#{plugin.plugin_name}"
113
-
114
- row.push(count)
115
- row.push(ip)
116
- results.push(row)
117
- end
118
-
119
- table([headers] + results, :header => true, :column_widths => header_widths, :row_colors => ['ffffff', 'f0f0f0']) do
120
- row(0).style(:font_style => :bold, :background_color => 'D0D0D0')
121
- cells.borders = [:top, :bottom, :left, :right]
122
- end unless results == nil
123
-
124
- text "\n"
125
-
126
- text "The following 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"
127
- text "\n"
128
-
129
- results = Array.new
130
- headers = ["Count", "Service"]
131
- header_widths = {0 => 75, 1=> 400}
132
-
133
- top10vulns = Item.risks_by_service(5)
134
-
135
- top10vulns.each do |service|
136
- row = Array.new
137
-
138
- #plugin = Plugin.find_by_id(service.plugin_id)
139
- svc = Item.find(:all, :conditions => {:svc_name => service.svc_name})
140
- #text "#{svc.count} - #{service.svc_name}"
141
-
142
- row.push(svc.count)
143
- row.push(service.svc_name)
144
- results.push(row)
145
- end
146
-
147
- table([headers] + results, :header => true, :column_widths => header_widths, :row_colors => ['ffffff', 'f0f0f0']) do
148
- row(0).style(:font_style => :bold, :background_color => 'D0D0D0')
149
- cells.borders = [:top, :bottom, :left, :right]
150
- end unless results == nil
151
-
152
- text "\n\n\n"
153
- if (y <= 300)
154
- start_new_page
155
- move_down 50
156
- end
157
-
158
- text "Summary Graphs of Key Finding Statistics", :style => :bold
159
- text "\n\n\n"
160
- text "\n"
161
- text "\n"
162
-
163
- cury = y
164
- image Item.risks_by_severity_graph, :width => 250, :at => [bounds.left, cury]
165
- image Host.top_vuln_graph(10), :width => 250, :at => [bounds.right - 250, cury]
166
- move_down 225
167
- if (y <= 300)
168
- start_new_page
169
- move_down 50
170
- end
171
- cury = y
172
- image Item.risks_by_service_graph(10), :width => 250, :at => [bounds.left, cury]
173
- image Host.other_os_graph, :width => 250, :at => [bounds.right - 250, cury]
174
- move_down 225
175
- if (y <= 300)
176
- start_new_page
177
- move_down 50
152
+ top10vulns = Item.risks_by_service(5)
153
+
154
+ top10vulns.each do |service|
155
+ row = Array.new
156
+
157
+ #plugin = Plugin.find_by_id(service.plugin_id)
158
+ svc = Item.find(:all, :conditions => {:svc_name => service.svc_name})
159
+ #output.text "#{svc.count} - #{service.svc_name}"
160
+
161
+ row.push(svc.count)
162
+ row.push(service.svc_name)
163
+ results.push(row)
164
+ end
165
+
166
+ output.table([headers] + results, :header => true, :column_widths => header_widths, :row_colors => ['ffffff', 'f0f0f0']) do
167
+ row(0).style(:font_style => :bold, :background_color => 'D0D0D0')
168
+ cells.borders = [:top, :bottom, :left, :right]
169
+ end unless results == nil
170
+
171
+ output.text "\n\n\n"
172
+ if (output.y <= 300)
173
+ output.start_new_page
174
+ move_down 50
175
+ end
176
+
177
+ output.text "Summary Graphs of Key Finding Statistics", :style => :bold
178
+ output.text "\n\n\n"
179
+ output.text "\n"
180
+ output.text "\n"
181
+
182
+ cury = output.y
183
+ output.image Item.risks_by_severity_graph, :width => 250, :at => [output.bounds.left, cury]
184
+ output.image Host.top_vuln_graph(10), :width => 250, :at => [output.bounds.right - 250, cury]
185
+ output.move_down 225
186
+ if (output.y <= 300)
187
+ output.start_new_page
188
+ output.move_down 50
189
+ end
190
+ cury = output.y
191
+ output.image Item.risks_by_service_graph(10), :width => 250, :at => [output.bounds.left, cury]
192
+ output.image Host.other_os_graph, :width => 250, :at => [output.bounds.right - 250, cury]
193
+ output.move_down 225
194
+ if (output.y <= 300)
195
+ output.start_new_page
196
+ output.move_down 50
197
+ end
198
+ cury = output.y
199
+ output.image Host.windows_os_graph, :width => 250, :at => [output.bounds.left, cury]
200
+
201
+ output.number_pages "<page> of <total>", :at => [output.bounds.right - 50, 0], :width => 150, :page_filter => :all
202
+ end
203
+ end
204
+ end
178
205
  end
179
- cury = y
180
- image Host.windows_os_graph, :width => 250, :at => [bounds.left, cury]
181
206
 
182
- number_pages "<page> of <total>", :at => [bounds.right - 50, 0], :width => 150, :page_filter => :all