risu 1.7.5 → 1.7.6
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.
- checksums.yaml +4 -4
- data/Gemfile +16 -10
- data/Gemfile.lock +125 -102
- data/LICENSE +2 -1
- data/NEWS.markdown +23 -2
- data/README.markdown +35 -22
- data/Rakefile +4 -4
- data/bin/risu +1 -1
- data/lib/risu.rb +12 -7
- data/lib/risu/base.rb +1 -1
- data/lib/risu/base/post_process_base.rb +2 -3
- data/lib/risu/base/post_process_manager.rb +2 -2
- data/lib/risu/base/schema.rb +3 -3
- data/lib/risu/base/shares_template_helper.rb +37 -3
- data/lib/risu/base/template_base.rb +2 -2
- data/lib/risu/base/template_helper.rb +4 -4
- data/lib/risu/base/template_manager.rb +2 -2
- data/lib/risu/base/templater.rb +1 -1
- data/lib/risu/cli.rb +1 -1
- data/lib/risu/cli/application.rb +7 -6
- data/lib/risu/cli/banner.rb +1 -1
- data/lib/risu/exceptions.rb +1 -1
- data/lib/risu/exceptions/invaliddocument.rb +1 -1
- data/lib/risu/graphs.rb +32 -0
- data/lib/risu/graphs/top_vuln_graph.rb +59 -0
- data/lib/risu/graphs/windows_os_graph.rb +134 -0
- data/lib/risu/models.rb +1 -1
- data/lib/risu/models/attachment.rb +1 -1
- data/lib/risu/models/familyselection.rb +1 -1
- data/lib/risu/models/host.rb +100 -44
- data/lib/risu/models/hostproperty.rb +1 -1
- data/lib/risu/models/individualpluginselection.rb +1 -1
- data/lib/risu/models/item.rb +43 -15
- data/lib/risu/models/patch.rb +1 -1
- data/lib/risu/models/plugin.rb +2 -2
- data/lib/risu/models/pluginspreference.rb +1 -1
- data/lib/risu/models/policy.rb +1 -1
- data/lib/risu/models/reference.rb +4 -3
- data/lib/risu/models/report.rb +2 -2
- data/lib/risu/models/serverpreference.rb +1 -1
- data/lib/risu/models/servicedescription.rb +1 -1
- data/lib/risu/models/version.rb +1 -1
- data/lib/risu/parsers.rb +1 -1
- data/lib/risu/parsers/nessus/nessus_document.rb +7 -1
- data/lib/risu/parsers/nessus/nessus_sax_listener.rb +6 -4
- data/lib/risu/parsers/nessus/postprocess.rb +2 -2
- data/lib/risu/parsers/nessus/postprocess/adobe_acrobat.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/adobe_air.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/adobe_reader.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/apache.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/apache_tomcat.rb +53 -0
- data/lib/risu/parsers/nessus/postprocess/apple_quicktime.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/blackberry_enterprise_server.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/ca_brightstor_arcserve.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/core_ftp.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/db2.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/downgrade_plugins.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/filezilla.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/firefox.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/flash_player.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/flexnet.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/foxit_reader.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/google_chrome.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/hp_system_mgt_homepage.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/java.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/openssh.rb +3 -1
- data/lib/risu/parsers/nessus/postprocess/openssl.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/oracle_database.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/php.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/post_process.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/risk_score.rb +2 -2
- data/lib/risu/parsers/nessus/postprocess/root_cause.rb +12 -7
- data/lib/risu/parsers/nessus/postprocess/servu.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/shockwave.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/sigplus_pro.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/symantec_pcanywhere.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/vlc.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/vmware_esxi.rb +3 -1
- data/lib/risu/parsers/nessus/postprocess/vmware_player.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/vmware_vcenter.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/vmware_vsphere_client.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/windows.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/winscp.rb +1 -1
- data/lib/risu/parsers/nessus/postprocess/wireshark.rb +1 -1
- data/lib/risu/parsers/nexpose/nexpose_document.rb +1 -1
- data/lib/risu/parsers/nexpose/simple_nexpose.rb +3 -3
- data/lib/risu/renderers.rb +1 -1
- data/lib/risu/renderers/csvrenderer.rb +4 -4
- data/lib/risu/renderers/nilrenderer.rb +4 -4
- data/lib/risu/renderers/pdfrenderer.rb +5 -5
- data/lib/risu/template_helpers.rb +32 -0
- data/lib/risu/templates/assets.rb +1 -1
- data/lib/risu/templates/cover_sheet.rb +1 -1
- data/lib/risu/templates/exec_summary.rb +1 -1
- data/lib/risu/templates/executive_summary_detailed.rb +1 -1
- data/lib/risu/templates/exploitablity_summary.rb +1 -1
- data/lib/risu/templates/finding_statistics.rb +1 -1
- data/lib/risu/templates/findings_host.rb +1 -1
- data/lib/risu/templates/findings_summary.rb +1 -1
- data/lib/risu/templates/findings_summary_with_pluginid.rb +1 -1
- data/lib/risu/templates/graphs.rb +1 -1
- data/lib/risu/templates/host_findings_csv.rb +1 -1
- data/lib/risu/templates/host_summary.rb +1 -1
- data/lib/risu/templates/malicious_process_detection.rb +1 -1
- data/lib/risu/templates/missing_root_causes.rb +1 -1
- data/lib/risu/templates/ms_patch_summary.rb +1 -1
- data/lib/risu/templates/ms_update_summary.rb +1 -1
- data/lib/risu/templates/ms_wsus_findings.rb +1 -1
- data/lib/risu/templates/notable.rb +1 -1
- data/lib/risu/templates/notable_detailed.rb +1 -1
- data/lib/risu/templates/pci_compliance.rb +1 -1
- data/lib/risu/templates/stig_findings_summary.rb +2 -2
- data/lib/risu/templates/talking_points.rb +5 -5
- data/lib/risu/templates/technical_findings.rb +1 -1
- data/lib/risu/templates/template.rb +1 -1
- data/lib/risu/templates/top_25.rb +1 -1
- data/lib/risu/version.rb +33 -0
- data/risu.gemspec +21 -20
- metadata +161 -67
- data/Gemfile.ci +0 -12
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010-
|
1
|
+
# Copyright (c) 2010-2016 Arxopia LLC.
|
2
2
|
# All rights reserved.
|
3
3
|
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -38,13 +38,13 @@ task :tag_and_bag do
|
|
38
38
|
system "git tag -a v#{Risu::VERSION} -m 'version #{Risu::VERSION}'"
|
39
39
|
system "git push --tags"
|
40
40
|
system "git checkout master"
|
41
|
-
system "git merge
|
41
|
+
system "git merge dev"
|
42
42
|
system "git push"
|
43
43
|
end
|
44
44
|
|
45
45
|
task :release => [:tag_and_bag, :build] do
|
46
46
|
system "gem push #{Risu::APP_NAME}-#{Risu::VERSION}.gem"
|
47
|
-
puts "Just released #{Risu::APP_NAME} v#{Risu::VERSION}. #{Risu::APP_NAME} is an Nessus XML parser/database/report generator. More information at
|
47
|
+
puts "Just released #{Risu::APP_NAME} v#{Risu::VERSION}. #{Risu::APP_NAME} is an Nessus XML parser/database/report generator. More information at #{HOME_PAGE}"
|
48
48
|
end
|
49
49
|
|
50
50
|
task :clean do
|
@@ -67,7 +67,7 @@ end
|
|
67
67
|
|
68
68
|
Rake::TestTask.new("run_tests") do |t|
|
69
69
|
t.libs << "test"
|
70
|
-
t.pattern = 'test
|
70
|
+
t.pattern = 'test/**/*_test.rb'
|
71
71
|
t.verbose = true
|
72
72
|
end
|
73
73
|
|
data/bin/risu
CHANGED
data/lib/risu.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010-
|
1
|
+
# Copyright (c) 2010-2016 Arxopia LLC.
|
2
2
|
# All rights reserved.
|
3
3
|
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -25,18 +25,16 @@
|
|
25
25
|
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
26
26
|
|
27
27
|
module Risu
|
28
|
-
|
29
|
-
VERSION = "1.7.5"
|
28
|
+
# @TODO 1.8 - move graph variables to graphs.rb
|
30
29
|
GRAPH_WIDTH = 750
|
31
30
|
# red orange yellow green blue purple grey pink
|
32
31
|
GRAPH_COLORS = %w(#d2403f #ec9241 #fcc343 #50ad51 #397bbb #8E6B8E black #cccccc brown #e52d89)
|
33
|
-
|
34
|
-
EMAIL = "risu@arxopia.com"
|
32
|
+
|
35
33
|
CONFIG_FILE = "./risu.cfg"
|
36
34
|
USER_TEMPLATES_DIR = "~/.risu/templates/"
|
37
|
-
|
38
35
|
end
|
39
36
|
|
37
|
+
# TODO move these require to another file or move the above metadata to a config.rb
|
40
38
|
require 'rails'
|
41
39
|
require 'active_record'
|
42
40
|
require "active_support"
|
@@ -46,7 +44,7 @@ require 'ipaddr'
|
|
46
44
|
require 'yaml'
|
47
45
|
require 'gruff'
|
48
46
|
require 'prawn'
|
49
|
-
require 'prawn/
|
47
|
+
require 'prawn/table'
|
50
48
|
require 'stringio'
|
51
49
|
require 'mysql2'
|
52
50
|
require 'irb'
|
@@ -55,12 +53,19 @@ require 'nokogiri'
|
|
55
53
|
|
56
54
|
require 'optparse'
|
57
55
|
|
56
|
+
require 'risu/version'
|
58
57
|
require 'risu/base'
|
59
58
|
require 'risu/cli'
|
60
59
|
require 'risu/exceptions'
|
61
60
|
require 'risu/models'
|
61
|
+
require 'risu/graphs'
|
62
|
+
require 'risu/template_helpers'
|
62
63
|
require 'risu/parsers'
|
63
64
|
require 'risu/parsers/nessus/postprocess'
|
64
65
|
require 'risu/renderers'
|
65
66
|
|
66
67
|
include Risu::Models
|
68
|
+
|
69
|
+
# Suppress Prawn Font Warning
|
70
|
+
# @TODO update default font to a TTF font
|
71
|
+
Prawn::Font::AFM.hide_m17n_warning = true
|
data/lib/risu/base.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010-
|
1
|
+
# Copyright (c) 2010-2016 Arxopia LLC.
|
2
2
|
# All rights reserved.
|
3
3
|
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -69,7 +69,7 @@ module Risu
|
|
69
69
|
# @info = {}
|
70
70
|
#end
|
71
71
|
|
72
|
-
#NOTE:
|
72
|
+
# NOTE:
|
73
73
|
#looks like its working
|
74
74
|
def newest_reader_plugin
|
75
75
|
newest = DateTime.new(0001, 01, 01)
|
@@ -207,4 +207,3 @@ module Risu
|
|
207
207
|
end
|
208
208
|
end
|
209
209
|
end
|
210
|
-
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010-
|
1
|
+
# Copyright (c) 2010-2016 Arxopia LLC.
|
2
2
|
# All rights reserved.
|
3
3
|
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -92,7 +92,7 @@ module Risu
|
|
92
92
|
|
93
93
|
# Validates that a template is a valid template
|
94
94
|
#
|
95
|
-
# @
|
95
|
+
# @TODO look at refactoring this to valid?(template)
|
96
96
|
#
|
97
97
|
# @param template The template to validate
|
98
98
|
#
|
data/lib/risu/base/schema.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010-
|
1
|
+
# Copyright (c) 2010-2016 Arxopia LLC.
|
2
2
|
# All rights reserved.
|
3
3
|
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -197,13 +197,13 @@ module Risu
|
|
197
197
|
t.string :value
|
198
198
|
end
|
199
199
|
|
200
|
-
#Index's for speed increases, possibly have these apply after parsing @
|
200
|
+
#Index's for speed increases, possibly have these apply after parsing @TODO
|
201
201
|
add_index :items, :host_id
|
202
202
|
add_index :items, :plugin_id
|
203
203
|
add_index :references, :plugin_id
|
204
204
|
|
205
205
|
#Default data for service descriptions
|
206
|
-
#@
|
206
|
+
#@TODO Unused ATM, might be better to use a yaml file tho..
|
207
207
|
# ServiceDescription.create :name => "www", :description => ""
|
208
208
|
# ServiceDescription.create :name => "cifs", :description => ""
|
209
209
|
# ServiceDescription.create :name => "smb", :description => ""
|
@@ -141,7 +141,7 @@ module Risu
|
|
141
141
|
|
142
142
|
anonymous_access_text = "Allowing anonymous access to a file server can lead to information disclosures and other security violations. Each instance should be evaluated and removed or noted in the network's security policy.\n"
|
143
143
|
|
144
|
-
heading1 "
|
144
|
+
heading1 "Other Findings of Interest" if poor_count > 0
|
145
145
|
|
146
146
|
#Anon ftp/smb + clear text
|
147
147
|
@output.text anon_ftp_text + anon_smb_text + anonymous_access_text if anon_ftp_count > 0 || anon_smb_count > 0
|
@@ -151,8 +151,42 @@ module Risu
|
|
151
151
|
|
152
152
|
def shares_appendix_section
|
153
153
|
anon_ftp_section
|
154
|
-
anon_smb_section
|
154
|
+
anon_smb_section
|
155
|
+
end
|
156
|
+
|
157
|
+
def shares_section_has_findings?
|
158
|
+
poor_count = 0
|
159
|
+
|
160
|
+
anon_ftp_text = ""
|
161
|
+
anon_smb_text = ""
|
162
|
+
|
163
|
+
anon_smb_count = 0
|
164
|
+
anon_ftp_count = 0
|
165
|
+
|
166
|
+
begin
|
167
|
+
anon_ftp_count = Item.where(:plugin_id => Plugin.where(:plugin_name => "Anonymous FTP Enabled").first.id).count
|
168
|
+
rescue Exception => e
|
169
|
+
end
|
170
|
+
|
171
|
+
begin
|
172
|
+
anon_smb_count = Item.where(:plugin_id => Plugin.where(:plugin_name => "Microsoft Windows SMB Shares Unprivileged Access").first.id).count
|
173
|
+
rescue Exception => e
|
174
|
+
end
|
175
|
+
|
176
|
+
if anon_ftp_count >= 1
|
177
|
+
poor_count = poor_count + 1
|
178
|
+
end
|
179
|
+
|
180
|
+
if anon_smb_count >= 1
|
181
|
+
poor_count = poor_count + 1
|
182
|
+
end
|
183
|
+
|
184
|
+
if poor_count >= 1
|
185
|
+
return true
|
186
|
+
else
|
187
|
+
return false
|
188
|
+
end
|
155
189
|
end
|
156
190
|
end
|
157
191
|
end
|
158
|
-
end
|
192
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010-
|
1
|
+
# Copyright (c) 2010-2016 Arxopia LLC.
|
2
2
|
# All rights reserved.
|
3
3
|
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -31,7 +31,7 @@ module Risu
|
|
31
31
|
#
|
32
32
|
class TemplateBase
|
33
33
|
|
34
|
-
# @
|
34
|
+
# @TODO comment
|
35
35
|
attr_accessor :output
|
36
36
|
|
37
37
|
# Accessors for template meta-data
|
@@ -152,7 +152,7 @@ module Risu
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
-
# @
|
155
|
+
# @TODO comment
|
156
156
|
def default_credential_plugins
|
157
157
|
[
|
158
158
|
10862, 25927, 32315, 65950, 39364, 33852, 11454, 51369,
|
@@ -161,7 +161,7 @@ module Risu
|
|
161
161
|
].uniq
|
162
162
|
end
|
163
163
|
|
164
|
-
# @
|
164
|
+
# @TODO comment
|
165
165
|
def has_default_credentials?
|
166
166
|
plugins = default_credential_plugins
|
167
167
|
default_cred = false
|
@@ -175,7 +175,7 @@ module Risu
|
|
175
175
|
return default_cred
|
176
176
|
end
|
177
177
|
|
178
|
-
# @
|
178
|
+
# @TODO comment
|
179
179
|
def default_credentials_section
|
180
180
|
heading1 "Default Credentials"
|
181
181
|
|
@@ -183,7 +183,7 @@ module Risu
|
|
183
183
|
text "\n"
|
184
184
|
end
|
185
185
|
|
186
|
-
# @
|
186
|
+
# @TODO comment
|
187
187
|
def default_credentials_appendix_section
|
188
188
|
if !has_default_credentials?
|
189
189
|
return
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010-
|
1
|
+
# Copyright (c) 2010-2016 Arxopia LLC.
|
2
2
|
# All rights reserved.
|
3
3
|
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -76,7 +76,7 @@ module Risu
|
|
76
76
|
|
77
77
|
# Validates that a template is a valid template
|
78
78
|
#
|
79
|
-
# @
|
79
|
+
# @TODO look at refactoring this to valid?(template)
|
80
80
|
#
|
81
81
|
# @param template The template to validate
|
82
82
|
#
|
data/lib/risu/base/templater.rb
CHANGED
data/lib/risu/cli.rb
CHANGED
data/lib/risu/cli/application.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010-
|
1
|
+
# Copyright (c) 2010-2016 Arxopia LLC.
|
2
2
|
# All rights reserved.
|
3
3
|
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -49,7 +49,7 @@ module Risu
|
|
49
49
|
|
50
50
|
# Creates a blank configuration file
|
51
51
|
#
|
52
|
-
# @
|
52
|
+
# @TODO does this need exception handling
|
53
53
|
#
|
54
54
|
# @param file Path to configuration file
|
55
55
|
def create_config(file=CONFIG_FILE)
|
@@ -118,7 +118,7 @@ module Risu
|
|
118
118
|
Schema.migrate(direction)
|
119
119
|
|
120
120
|
if direction == :up
|
121
|
-
puts "[*] Creating tables"
|
121
|
+
puts "[*] Creating tables" if @options[:debug]
|
122
122
|
ver = Version.create
|
123
123
|
ver.version = Risu::VERSION
|
124
124
|
ver.save
|
@@ -126,7 +126,7 @@ module Risu
|
|
126
126
|
|
127
127
|
puts "[*] Dropping tables" if direction == :down
|
128
128
|
|
129
|
-
#@
|
129
|
+
#@TODO temp hack, fix this by checking the schema on :up or :down for exiting data
|
130
130
|
rescue SQLite3::SQLException => sqlitex
|
131
131
|
puts "#{sqlitex.message}\n #{sqlitex.backtrace}" if @options[:debug]
|
132
132
|
continue
|
@@ -145,7 +145,7 @@ module Risu
|
|
145
145
|
end
|
146
146
|
|
147
147
|
# Establishes an [ActiveRecord::Base] database connection
|
148
|
-
# @
|
148
|
+
# @TODO better comments
|
149
149
|
def db_connect
|
150
150
|
begin
|
151
151
|
if @database["adapter"] == nil
|
@@ -252,7 +252,7 @@ module Risu
|
|
252
252
|
@options[:list_postprocesses] = option
|
253
253
|
end
|
254
254
|
|
255
|
-
# @
|
255
|
+
# @TODO THIS NO WORK
|
256
256
|
#opt.on('--create-template NAME', "Creates a template file in the ~/.risu/templates directory") do |option|
|
257
257
|
# if File.exists?(option) == true
|
258
258
|
# puts "[!] Template "
|
@@ -474,6 +474,7 @@ module Risu
|
|
474
474
|
end
|
475
475
|
|
476
476
|
printf "[*] Finished parsing %s. Parse took %.02f seconds\n", file, Time.now - tstart
|
477
|
+
puts nessus_doc.new_tags.uniq.join("\n") #@TODO add a verbose check
|
477
478
|
rescue Interrupt => i
|
478
479
|
puts "[!] Parse canceled!"
|
479
480
|
exit(1)
|
data/lib/risu/cli/banner.rb
CHANGED
data/lib/risu/exceptions.rb
CHANGED
data/lib/risu/graphs.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Copyright (c) 2010-2016 Arxopia LLC.
|
2
|
+
# All rights reserved.
|
3
|
+
#
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
6
|
+
#
|
7
|
+
# * Redistributions of source code must retain the above copyright
|
8
|
+
# notice, this list of conditions and the following disclaimer.
|
9
|
+
# * Redistributions in binary form must reproduce the above copyright
|
10
|
+
# notice, this list of conditions and the following disclaimer in the
|
11
|
+
# documentation and/or other materials provided with the distribution.
|
12
|
+
# * Neither the name of the Arxopia LLC nor the names of its contributors
|
13
|
+
# may be used to endorse or promote products derived from this software
|
14
|
+
# without specific prior written permission.
|
15
|
+
#
|
16
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17
|
+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19
|
+
# DISCLAIMED. IN NO EVENT SHALL ARXOPIA LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
20
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
21
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
22
|
+
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
23
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
24
|
+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
25
|
+
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
26
|
+
|
27
|
+
module Risu
|
28
|
+
module Graphs
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
#require 'risu/graphs/'
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# Copyright (c) 2010-2016 Arxopia LLC.
|
2
|
+
# All rights reserved.
|
3
|
+
#
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
6
|
+
#
|
7
|
+
# * Redistributions of source code must retain the above copyright
|
8
|
+
# notice, this list of conditions and the following disclaimer.
|
9
|
+
# * Redistributions in binary form must reproduce the above copyright
|
10
|
+
# notice, this list of conditions and the following disclaimer in the
|
11
|
+
# documentation and/or other materials provided with the distribution.
|
12
|
+
# * Neither the name of the Arxopia LLC nor the names of its contributors
|
13
|
+
# may be used to endorse or promote products derived from this software
|
14
|
+
# without specific prior written permission.
|
15
|
+
#
|
16
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17
|
+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19
|
+
# DISCLAIMED. IN NO EVENT SHALL ARXOPIA LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
20
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
21
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
22
|
+
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
23
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
24
|
+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
25
|
+
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
26
|
+
|
27
|
+
module Risu
|
28
|
+
module Graphs
|
29
|
+
|
30
|
+
# TopVulnGraph
|
31
|
+
#
|
32
|
+
class TopVulnGraph
|
33
|
+
def graph
|
34
|
+
g = Gruff::Bar.new(GRAPH_WIDTH)
|
35
|
+
g.title = sprintf "Top 10 Hosts with Notable Findings Count"
|
36
|
+
g.sort = false
|
37
|
+
g.marker_count = 1
|
38
|
+
g.theme = {
|
39
|
+
:colors => Risu::GRAPH_COLORS,
|
40
|
+
:background_colors => %w(white white)
|
41
|
+
}
|
42
|
+
|
43
|
+
Item.risks_by_host(limit).to_a.each do |item|
|
44
|
+
ip = Host.find_by_id(item.host_id).name
|
45
|
+
count = Item.where(:host_id => item.host_id).where(:severity => 4).count
|
46
|
+
|
47
|
+
if count > 0
|
48
|
+
g.data(ip, count)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
StringIO.new(g.to_blob)
|
53
|
+
end
|
54
|
+
|
55
|
+
def graph_text
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|