risu 1.4.8 → 1.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,16 +5,15 @@ require 'risu'
5
5
  module Risu
6
6
  module Parsers
7
7
  module Nessus
8
+
8
9
  # NessusSaxListener
9
10
  #
10
- #
11
11
  # @author Jacob Hammack <jacob.hammack@hammackj.com>
12
12
  class NessusSaxListener
13
13
  include LibXML::XML::SaxParser::Callbacks
14
14
 
15
15
  # Sets up a array of all valid xml fields
16
16
  #
17
- #
18
17
  def initialize
19
18
  @vals = Hash.new
20
19
 
@@ -27,23 +26,24 @@ module Risu
27
26
  "Report", "Family", "Preferences", "PluginsPreferences", "FamilySelection", "IndividualPluginSelection", "PluginId",
28
27
  "pci-dss-compliance", "exploitability_ease", "cvss_temporal_vector", "exploit_framework_core", "cvss_temporal_score",
29
28
  "exploit_available", "metasploit_name", "exploit_framework_canvas", "canvas_package", "exploit_framework_metasploit",
30
- "plugin_type", "cpe"]
31
-
32
- # This makes adding new host properties really easy.
29
+ "plugin_type", "cpe", "exploithub_sku", "exploit_framework_exploithub", "stig_severity"]
30
+
31
+ # This makes adding new host properties really easy, except for the
32
+ #MS patch numbers, this are handled differently.
33
33
  @valid_host_properties = {
34
- "HOST_END" => :end ,
35
- "mac-address" => :mac ,
36
- "HOST_START" => :start ,
34
+ "HOST_END" => :end,
35
+ "mac-address" => :mac,
36
+ "HOST_START" => :start,
37
37
  "operating-system" => :os,
38
- "host-ip" => :ip ,
39
- "host-fqdn" => :fqdn ,
40
- "netbios-name" => :netbios ,
41
- "local-checks-proto" => :local_checks_proto ,
42
- "smb-login-used" => :smb_login_used ,
43
- "ssh-auth-meth" => :ssh_auth_meth ,
44
- "ssh-login-used" => :ssh_login_used ,
45
- "pci-dss-compliance" => :pci_dss_compliance ,
46
- "pci-dss-compliance:" => :pci_dss_compliance_ ,
38
+ "host-ip" => :ip,
39
+ "host-fqdn" => :fqdn,
40
+ "netbios-name" => :netbios,
41
+ "local-checks-proto" => :local_checks_proto,
42
+ "smb-login-used" => :smb_login_used,
43
+ "ssh-auth-meth" => :ssh_auth_meth,
44
+ "ssh-login-used" => :ssh_login_used,
45
+ "pci-dss-compliance" => :pci_dss_compliance,
46
+ "pci-dss-compliance:" => :pci_dss_compliance_ , #I think this is a Tenable bug~
47
47
  "pcidss:compliance:failed" => :pcidss_compliance_failed,
48
48
  "pcidss:compliance:passed" => :pcidss_compliance_passed,
49
49
  "pcidss:deprecated_ssl" => :pcidss_deprecated_ssl,
@@ -52,162 +52,16 @@ module Risu
52
52
  "pcidss:medium_risk_flaw" => :pcidss_medium_risk_flaw,
53
53
  "pcidss:reachable_db" => :pcidss_reachable_db,
54
54
  "pcidss:www:xss" => :pcidss_www_xss,
55
+ "pcidss:directory_browsing" => :pcidss_directory_browsing,
56
+ "pcidss:known_credentials" => :pcidss_known_credentials,
57
+ "pcidss:compromised_host:worm" => :pcidss_compromised_host_worm,
55
58
  "system-type" => :system_type,
56
59
  "pcidss:obsolete_operating_system" => :pcidss_obsolete_operating_system,
57
- "pcidss:dns_zone_transfer" => :pcidss_dns_zone_transfer
60
+ "pcidss:dns_zone_transfer" => :pcidss_dns_zone_transfer,
61
+ "pcidss:unprotected_mssql_db" => :pcidss_unprotected_mssql_db,
62
+ "pcidss:obsolete_software" => :pcidss_obsolete_software,
63
+ "pcidss:www:sql_injection" => :pcidss_www_sql_injection
58
64
  }
59
- #@todo change this to an array and use a dynamic ms_patches table
60
- @valid_ms_patches = [
61
- "MS11-030",
62
- "MS11-026",
63
- "MS11-034",
64
- "MS11-021",
65
- "MS11-029",
66
- "MS11-023",
67
- "MS11-022",
68
- "MS09-027",
69
- "MS11-033",
70
- "MS11-019",
71
- "MS11-024",
72
- "MS11-031",
73
- "MS11-020",
74
- "MS11-018",
75
- "MS11-028",
76
- "MS11-032",
77
- "MS040-016",
78
- "MS08-50",
79
- "MS09-055",
80
- "MS10-008",
81
- "MS10-034",
82
- "MS10-082",
83
- "MS11-003",
84
- "MS07-021",
85
- "MS09-062",
86
- "MS07-022",
87
- "MS10-096",
88
- "MS09-062",
89
- "MS07-017",
90
- "MS07-031",
91
- "MS08-020",
92
- "MS10-002",
93
- "MS10-035",
94
- "MS11-007",
95
- "MS10-018",
96
- "MS09-069",
97
- "MS09-001",
98
- "MS10-073",
99
- "MS09-044",
100
- "MS08-021",
101
- "MS08-001",
102
- "MS11-011",
103
- "MS07-004",
104
- "MS07-006",
105
- "MS07-007",
106
- "MS07-008",
107
- "MS07-009",
108
- "MS07-011",
109
- "MS07-012",
110
- "MS07-013",
111
- "MS07-016",
112
- "MS07-019",
113
- "MS07-020",
114
- "MS07-027",
115
- "MS08-002",
116
- "MS08-007",
117
- "MS08-008",
118
- "MS08-010",
119
- "MS08-022",
120
- "MS09-006",
121
- "MS09-007",
122
- "MS09-010",
123
- "MS09-011",
124
- "MS09-012",
125
- "MS09-013",
126
- "MS09-014",
127
- "MS09-015",
128
- "MS09-019",
129
- "MS09-022",
130
- "MS09-025",
131
- "MS09-026",
132
- "MS09-034",
133
- "MS09-037",
134
- "MS09-038",
135
- "MS09-040",
136
- "MS09-041",
137
- "MS09-042",
138
- "MS09-045",
139
- "MS09-046",
140
- "MS09-047",
141
- "MS09-048",
142
- "MS09-051",
143
- "MS09-052",
144
- "MS09-054",
145
- "MS09-056",
146
- "MS09-057",
147
- "MS09-058",
148
- "MS09-065",
149
- "MS09-071",
150
- "MS09-072",
151
- "MS09-073",
152
- "MS10-001",
153
- "MS10-005",
154
- "MS10-006",
155
- "MS10-011",
156
- "MS10-012",
157
- "MS10-013",
158
- "MS10-015",
159
- "MS10-016",
160
- "MS10-019",
161
- "MS10-020",
162
- "MS10-021",
163
- "MS10-022",
164
- "MS10-026",
165
- "MS10-027",
166
- "MS10-029",
167
- "MS10-030",
168
- "MS10-032",
169
- "MS10-033",
170
- "MS10-037",
171
- "MS10-041",
172
- "MS10-042",
173
- "MS10-046",
174
- "MS10-047",
175
- "MS10-048",
176
- "MS10-049",
177
- "MS10-050",
178
- "MS10-051",
179
- "MS10-052",
180
- "MS10-053",
181
- "MS10-054",
182
- "MS10-055",
183
- "MS10-061",
184
- "MS10-062",
185
- "MS10-063",
186
- "MS10-066",
187
- "MS10-067",
188
- "MS10-069",
189
- "MS10-070",
190
- "MS10-071",
191
- "MS10-074",
192
- "MS10-076",
193
- "MS10-078",
194
- "MS10-081",
195
- "MS10-083",
196
- "MS10-084",
197
- "MS10-090",
198
- "MS10-091",
199
- "MS10-097",
200
- "MS10-098",
201
- "MS10-099",
202
- "MS11-002",
203
- "MS11-006",
204
- "MS11-010",
205
- "MS11-012",
206
- "MS11-013",
207
- "MS11-014",
208
- "MS11-015",
209
- "MS11-017"
210
- ]
211
65
  end
212
66
 
213
67
  # Callback for when the start of a xml element is reached
@@ -250,7 +104,7 @@ module Risu
250
104
  @attr = nil
251
105
 
252
106
  if attributes["name"] =~ /[M|m][S|s]\d{2}-\d{2,}/
253
- @attr = if @valid_ms_patches.include?(attributes["name"])
107
+ @attr = if attributes["name"] =~ /[M|m][S|s]\d{2}-\d{2,}/
254
108
  attributes["name"]
255
109
  else
256
110
  nil
@@ -418,7 +272,10 @@ module Risu
418
272
  :metasploit_name => @vals["metasploit_name"],
419
273
  :exploit_framework_canvas => @vals["exploit_framework_canvas"],
420
274
  :canvas_package => @vals["canvas_package"],
421
- :cpe => @vals["cpe"]
275
+ :cpe => @vals["cpe"],
276
+ :exploit_framework_exploithub => @vals["exploit_framework_exploithub"],
277
+ :exploithub_sku => @vals["exploithub_sku"],
278
+ :stig_severity => @vals["stig_severity"]
422
279
  }
423
280
  @plugin.save
424
281
  end
@@ -17,18 +17,18 @@ module Risu
17
17
  #
18
18
  #
19
19
  def render(output)
20
- output.text Report.classification, :align => :center
20
+ output.text Report.classification.upcase, :align => :center
21
21
  output.text "\n"
22
22
 
23
- output.font_size(22) {
23
+ output.font_size(22) do
24
24
  output.text Report.title, :align => :center
25
- }
25
+ end
26
26
 
27
- output.font_size(18) {
27
+ output.font_size(18) do
28
28
  output.text "Networked Assets", :align => :center
29
29
  output.text "\n"
30
30
  output.text "This report was prepared by\n#{Report.author}", :align => :center
31
- }
31
+ end
32
32
 
33
33
  output.text "\n\n"
34
34
 
@@ -9,7 +9,7 @@ module Risu
9
9
  {
10
10
  :name => "cover_sheet",
11
11
  :author => "hammackj",
12
- :version => "0.0.1",
12
+ :version => "0.0.2",
13
13
  :description => "Generates a coversheet with a logo (Example Template)"
14
14
  }
15
15
  end
@@ -9,7 +9,7 @@ module Risu
9
9
  {
10
10
  :name => "exec_summary",
11
11
  :author => "hammackj",
12
- :version => "0.0.1",
12
+ :version => "0.0.2",
13
13
  :description => "Generates a simple executive summary."
14
14
  }
15
15
  end
@@ -17,15 +17,18 @@ module Risu
17
17
  #
18
18
  #
19
19
  def render(output)
20
- output.text Report.classification, :align => :center
20
+ output.text Report.classification.upcase, :align => :center
21
21
  output.text "\n"
22
22
 
23
- output.font_size(22) { output.text Report.title, :align => :center }
24
- output.font_size(18) {
23
+ output.font_size(22) do
24
+ output.text Report.title, :align => :center
25
+ end
26
+
27
+ output.font_size(18) do
25
28
  output.text "Executive Summary", :align => :center
26
29
  output.text "\n"
27
30
  output.text "This report was prepared by\n#{Report.author}", :align => :center
28
- }
31
+ end
29
32
 
30
33
  output.text "\n\n\n"
31
34
 
@@ -9,7 +9,7 @@ module Risu
9
9
  {
10
10
  :name => "exec_summary_detailed",
11
11
  :author => "Ed Davison <EDavison@getmns.com>",
12
- :version => "0.0.1",
12
+ :version => "0.0.2",
13
13
  :description => "Generates a detailed executive summary report"
14
14
  }
15
15
  end
@@ -171,7 +171,7 @@ module Risu
171
171
  output.text "\n\n\n"
172
172
  if (output.y <= 300)
173
173
  output.start_new_page
174
- move_down 50
174
+ output.move_down 50
175
175
  end
176
176
 
177
177
  output.text "Summary Graphs of Key Finding Statistics", :style => :bold
@@ -17,7 +17,7 @@ module Risu
17
17
  #
18
18
  #
19
19
  def render(output)
20
- output.text Report.classification, :align => :center
20
+ output.text Report.classification.upcase, :align => :center
21
21
  output.text "\n"
22
22
 
23
23
  output.font_size(22) { output.text Report.title, :align => :center }
@@ -17,7 +17,7 @@ module Risu
17
17
  #
18
18
  #
19
19
  def render(output)
20
- output.text Report.classification, :align => :center
20
+ output.text Report.classification.upcase, :align => :center
21
21
  output.text "\n"
22
22
 
23
23
  output.font_size(22) { output.text Report.title, :align => :center }
@@ -17,23 +17,26 @@ module Risu
17
17
  #
18
18
  #
19
19
  def render(output)
20
- output.text Report.classification, :align => :center
20
+ output.text Report.classification.upcase, :align => :center
21
21
  output.text "\n"
22
22
 
23
- output.font_size(22) { output.text Report.title, :align => :center }
24
- output.font_size(18) {
23
+ output.font_size(22) do
24
+ output.text Report.title, :align => :center
25
+ end
26
+
27
+ output.font_size(18) do
25
28
  output.text "Findings Summary Report", :align => :center
26
29
  output.text "\n"
27
30
  output.text "This report was prepared by\n#{Report.author}", :align => :center
28
- }
31
+ end
29
32
 
30
33
  output.text "\n\n\n"
31
34
 
32
- output.font_size(20) {
35
+ output.font_size(20) do
33
36
  output.fill_color "FF0000"
34
37
  output.text "High Findings", :style => :bold
35
38
  output.fill_color "000000"
36
- }
39
+ end
37
40
 
38
41
  Item.high_risks_unique_sorted.each do |item|
39
42
  name = Plugin.find_by_id(item.plugin_id).plugin_name
@@ -44,11 +47,11 @@ module Risu
44
47
 
45
48
  output.start_new_page
46
49
 
47
- output.font_size(20) {
50
+ output.font_size(20) do
48
51
  output.fill_color "FF8040"
49
52
  output.text "Medium Findings", :style => :bold
50
53
  output.fill_color "000000"
51
- }
54
+ end
52
55
 
53
56
  Item.medium_risks_unique_sorted.each do |item|
54
57
  name = Plugin.find_by_id(item.plugin_id).plugin_name
@@ -17,7 +17,7 @@ module Risu
17
17
  #
18
18
  #
19
19
  def render(output)
20
- output.text Report.classification, :align => :center
20
+ output.text Report.classification.upcase, :align => :center
21
21
  output.text "\n"
22
22
 
23
23
  output.font_size(22) do
@@ -18,7 +18,7 @@ module Risu
18
18
  #
19
19
  #
20
20
  def render(output)
21
- output.text Report.classification, :align => :center
21
+ output.text Report.classification.upcase, :align => :center
22
22
  output.text "\n"
23
23
 
24
24
  output.font_size(24) do
@@ -17,7 +17,7 @@ module Risu
17
17
  #
18
18
  #
19
19
  def render(output)
20
- output.text Report.classification, :align => :center
20
+ output.text Report.classification.upcase, :align => :center
21
21
  output.text "\n"
22
22
 
23
23
  output.font_size(22) { output.text Report.title, :align => :center }
@@ -17,7 +17,7 @@ module Risu
17
17
  #
18
18
  #
19
19
  def render(output)
20
- output.text Report.classification, :align => :center
20
+ output.text Report.classification.upcase, :align => :center
21
21
  output.text "\n"
22
22
 
23
23
  output.font_size(22) { output.text Report.title, :align => :center }
@@ -17,7 +17,7 @@ module Risu
17
17
  #
18
18
  #
19
19
  def render(output)
20
- output.text Report.classification, :align => :center
20
+ output.text Report.classification.upcase, :align => :center
21
21
  output.text "\n"
22
22
 
23
23
  output.font_size(22) { output.text Report.title, :align => :center }
@@ -0,0 +1,45 @@
1
+ module Risu
2
+ module Modules
3
+ class Top10 < Risu::Base::TemplateBase
4
+
5
+ #
6
+ #
7
+ def initialize ()
8
+ @template_info =
9
+ {
10
+ :name => "notable",
11
+ :author => "hammackj",
12
+ :version => "0.0.2",
13
+ :description => "Notable Vulnerabilities"
14
+ }
15
+ end
16
+
17
+ #
18
+ #
19
+ def render(output)
20
+ output.text Report.classification.upcase, :align => :center
21
+ output.text "\n"
22
+
23
+ output.font_size(22) {
24
+ output.text Report.title, :align => :center
25
+ }
26
+
27
+ output.font_size(18) {
28
+ output.text "Notable Vulnerabilities", :align => :center
29
+ output.text "\n"
30
+ output.text "This report was prepared by\n#{Report.author}", :align => :center
31
+ }
32
+
33
+ output.text "\n\n\n"
34
+
35
+ output.text "Scan Date:", :style => :bold
36
+ output.text "#{Report.scan_date}"
37
+ output.text "\n"
38
+
39
+ Item.top_10_table(output)
40
+
41
+ end
42
+ end
43
+ end
44
+ end
45
+
@@ -0,0 +1,135 @@
1
+ module Risu
2
+ module Modules
3
+ class Top10Detailed < Risu::Base::TemplateBase
4
+
5
+ #
6
+ #
7
+ def initialize ()
8
+ @template_info =
9
+ {
10
+ :name => "notable_detailed",
11
+ :author => "hammackj",
12
+ :version => "0.0.3",
13
+ :description => "Notable Vulnerabilities Detailed"
14
+ }
15
+ end
16
+
17
+ #
18
+ #
19
+ def render(output)
20
+ output.text Report.classification.upcase, :align => :center
21
+ output.text "\n"
22
+
23
+ output.font_size(22) {
24
+ output.text Report.title, :align => :center
25
+ }
26
+
27
+ output.font_size(18) {
28
+ output.text "Notable Vulnerabilities", :align => :center
29
+ output.text "\n"
30
+ output.text "This report was prepared by\n#{Report.author}", :align => :center
31
+ }
32
+
33
+ output.text "\n\n\n"
34
+
35
+ output.text "Scan Date:", :style => :bold
36
+ output.text "#{Report.scan_date}"
37
+ output.text "\n"
38
+
39
+ output.font_size(10)
40
+
41
+ data = Item.top_10_sorted_raw
42
+
43
+ unique_risks = Array.new
44
+ unique_risks << Hash[:title => "High Findings", :color => "FF0000", :values => Item.top_10_sorted_raw[0..9]]
45
+ counter = 1
46
+
47
+ unique_risks.each do |h|
48
+ if h[:values].length > 1
49
+ output.text "\n"
50
+
51
+ h[:values].each do |f|
52
+ plugin_id = f[0]
53
+
54
+ hosts = Item.where(:plugin_id => plugin_id)
55
+ item = Item.where(:plugin_id => plugin_id)
56
+ plugin = Plugin.find_by_id(plugin_id)
57
+
58
+ references = Reference.where(:plugin_id => plugin.id).group(:value).order(:reference_name)
59
+
60
+ output.font_size(16) do
61
+ output.text "#{counter}: #{plugin.plugin_name}\n"
62
+ end
63
+
64
+ if hosts.length > 1
65
+ output.text "Hosts", :style => :bold
66
+ else
67
+ output.text "Host", :style => :bold
68
+ end
69
+
70
+ hostlist = Array.new
71
+ hosts.each do |host|
72
+ h = Host.find_by_id(host.host_id)
73
+ hostlist << h.name
74
+ end
75
+
76
+ output.text hostlist.join(', ')
77
+
78
+ #if item.plugin_output != nil
79
+ # output.text "\nPlugin output", :style => :bold
80
+ # output.text f.plugin_output
81
+ #end
82
+
83
+ if plugin.description != nil
84
+ output.text "\nDescription", :style => :bold
85
+ output.text plugin.description
86
+ end
87
+
88
+ if plugin.synopsis != nil
89
+ output.text "\nSynopsis", :style => :bold
90
+ output.text plugin.synopsis
91
+ end
92
+
93
+ if plugin.cvss_base_score != nil
94
+ output.text "\nCVSS Base Score", :style => :bold
95
+ output.text plugin.cvss_base_score
96
+ end
97
+
98
+ if plugin.exploit_available != nil
99
+ output.text "\nExploit Available", :style => :bold
100
+
101
+ if plugin.exploit_available == "true"
102
+ output.text "Yes"
103
+ else
104
+ output.text "No"
105
+ end
106
+ end
107
+
108
+ if plugin.solution != nil
109
+ output.text "\nSolution", :style => :bold
110
+ output.text plugin.solution
111
+ end
112
+
113
+ if references.size != 0
114
+ output.text "\nReferences", :style => :bold
115
+ references.each do |ref|
116
+ ref_text = sprintf "%s: %s\n", ref.reference_name, ref.value
117
+ output.text ref_text
118
+ end
119
+ output.text "\nNessus Plugin", :style => :bold
120
+ output.text "http://www.tenablesecurity.com/plugins/index.php?view=single&id=#{plugin_id}"
121
+ end
122
+ output.text "\n"
123
+ counter += 1
124
+ end
125
+ end
126
+
127
+ output.start_new_page unless h[:values] == nil
128
+ end
129
+
130
+ output.number_pages "<page> of <total>", :at => [output.bounds.right - 75, 0], :width => 150, :page_filter => :all
131
+ end
132
+ end
133
+ end
134
+ end
135
+
@@ -17,7 +17,7 @@ module Risu
17
17
  #
18
18
  #
19
19
  def render(output)
20
- output.text Report.classification, :align => :center
20
+ output.text Report.classification.upcase, :align => :center
21
21
  output.text "\n"
22
22
 
23
23
  output.font_size(22) { output.text Report.title, :align => :center }
@@ -40,11 +40,13 @@ module Risu
40
40
 
41
41
  unique_risks.each do |h|
42
42
  if h[:values].length > 1
43
- output.font_size(20) do
43
+ output.font_size(18) do
44
44
  output.fill_color h[:color]
45
45
  output.text h[:title], :style => :bold
46
46
  output.fill_color "000000"
47
47
  end
48
+
49
+ output.font_size(10)
48
50
 
49
51
  output.text "\n"
50
52
 
@@ -2,7 +2,7 @@ module Risu
2
2
  module Modules
3
3
  class Template < Risu::Base::TemplateBase
4
4
 
5
- #
5
+ # Initializes the template loading metadata
6
6
  #
7
7
  def initialize ()
8
8
  @template_info =
@@ -14,9 +14,10 @@ module Risu
14
14
  }
15
15
  end
16
16
 
17
- #
17
+ # Called during the rendering process
18
18
  #
19
19
  def render(output)
20
+ output.text "Template"
20
21
  end
21
22
  end
22
23
  end
data/lib/risu.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Risu
2
2
  APP_NAME = "risu"
3
- VERSION = "1.4.8"
3
+ VERSION = "1.4.9"
4
4
  GRAPH_WIDTH = 750
5
5
  EMAIL = "jacob.hammack@hammackj.com"
6
6
  CONFIG_FILE = "./risu.cfg"