risu 1.5.0 → 1.5.1

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.
Files changed (62) hide show
  1. data/Gemfile.ci +2 -5
  2. data/KNOWNISSUES.markdown +12 -11
  3. data/LICENSE +11 -11
  4. data/NEWS.markdown +43 -8
  5. data/README.markdown +36 -32
  6. data/Rakefile +29 -9
  7. data/TODO.markdown +150 -77
  8. data/bin/risu +26 -0
  9. data/lib/risu.rb +27 -1
  10. data/lib/risu/base.rb +26 -0
  11. data/lib/risu/base/prawn_templater.rb +36 -8
  12. data/lib/risu/base/schema.rb +199 -163
  13. data/lib/risu/base/template_base.rb +34 -7
  14. data/lib/risu/base/template_manager.rb +37 -37
  15. data/lib/risu/base/templater.rb +36 -9
  16. data/lib/risu/cli.rb +26 -0
  17. data/lib/risu/cli/application.rb +72 -39
  18. data/lib/risu/cli/banner.rb +47 -21
  19. data/lib/risu/exceptions.rb +26 -0
  20. data/lib/risu/exceptions/invaliddocument.rb +30 -1
  21. data/lib/risu/models.rb +26 -0
  22. data/lib/risu/models/familyselection.rb +28 -2
  23. data/lib/risu/models/host.rb +59 -2
  24. data/lib/risu/models/individualpluginselection.rb +26 -1
  25. data/lib/risu/models/item.rb +132 -79
  26. data/lib/risu/models/patch.rb +26 -1
  27. data/lib/risu/models/plugin.rb +28 -2
  28. data/lib/risu/models/pluginspreference.rb +26 -2
  29. data/lib/risu/models/policy.rb +27 -2
  30. data/lib/risu/models/reference.rb +81 -20
  31. data/lib/risu/models/report.rb +33 -8
  32. data/lib/risu/models/serverpreference.rb +26 -1
  33. data/lib/risu/models/servicedescription.rb +26 -1
  34. data/lib/risu/models/version.rb +26 -1
  35. data/lib/risu/parsers.rb +29 -0
  36. data/lib/risu/parsers/nessus/nessus_document.rb +47 -14
  37. data/lib/risu/parsers/nessus/nessus_sax_listener.rb +45 -16
  38. data/lib/risu/parsers/nexpose/nexpose_document.rb +91 -0
  39. data/lib/risu/parsers/nexpose/simple_nexpose.rb +108 -0
  40. data/lib/risu/renderers.rb +26 -0
  41. data/lib/risu/renderers/nilrenderer.rb +30 -4
  42. data/lib/risu/templates/assets.rb +36 -10
  43. data/lib/risu/templates/cover_sheet.rb +34 -8
  44. data/lib/risu/templates/exec_summary.rb +45 -19
  45. data/lib/risu/templates/executive_summary.rb +37 -11
  46. data/lib/risu/templates/finding_statistics.rb +33 -7
  47. data/lib/risu/templates/findings_host.rb +44 -18
  48. data/lib/risu/templates/findings_summary.rb +43 -17
  49. data/lib/risu/templates/findings_summary_with_pluginid.rb +60 -18
  50. data/lib/risu/templates/graphs.rb +30 -0
  51. data/lib/risu/templates/host_summary.rb +34 -8
  52. data/lib/risu/templates/ms_patch_summary.rb +35 -9
  53. data/lib/risu/templates/ms_update_summary.rb +34 -8
  54. data/lib/risu/templates/ms_wsus_findings.rb +99 -0
  55. data/lib/risu/templates/notable.rb +39 -13
  56. data/lib/risu/templates/notable_detailed.rb +42 -16
  57. data/lib/risu/templates/pci_compliance.rb +40 -14
  58. data/lib/risu/templates/stig_findings_summary.rb +62 -36
  59. data/lib/risu/templates/technical_findings.rb +29 -3
  60. data/lib/risu/templates/template.rb +35 -9
  61. data/risu.gemspec +28 -7
  62. metadata +94 -101
data/bin/risu CHANGED
@@ -1,5 +1,31 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # Copyright (c) 2010-2012 Arxopia LLC.
4
+ # All rights reserved.
5
+
6
+ # Redistribution and use in source and binary forms, with or without
7
+ # modification, are permitted provided that the following conditions are met:
8
+
9
+ # * Redistributions of source code must retain the above copyright
10
+ # notice, this list of conditions and the following disclaimer.
11
+ # * Redistributions in binary form must reproduce the above copyright
12
+ # notice, this list of conditions and the following disclaimer in the
13
+ # documentation and/or other materials provided with the distribution.
14
+ # * Neither the name of the Arxopia LLC nor the names of its contributors
15
+ # may be used to endorse or promote products derived from this software
16
+ # without specific prior written permission.
17
+
18
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ # DISCLAIMED. IN NO EVENT SHALL ARXOPIA LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
22
+ # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24
+ # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26
+ #OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27
+ #OF THE POSSIBILITY OF SUCH DAMAGE.
28
+
3
29
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '/../lib'))
4
30
 
5
31
  $stdout.sync = true
data/lib/risu.rb CHANGED
@@ -1,6 +1,32 @@
1
+ # Copyright (c) 2010-2012 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
+
1
27
  module Risu
2
28
  APP_NAME = "risu"
3
- VERSION = "1.5.0"
29
+ VERSION = "1.5.1"
4
30
  GRAPH_WIDTH = 750
5
31
  EMAIL = "jacob.hammack@hammackj.com"
6
32
  CONFIG_FILE = "./risu.cfg"
data/lib/risu/base.rb CHANGED
@@ -1,3 +1,29 @@
1
+ # Copyright (c) 2010-2012 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
+
1
27
  module Risu
2
28
  module Base
3
29
  end
@@ -1,14 +1,41 @@
1
+ # Copyright (c) 2010-2012 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
+
1
27
  module Risu
2
28
  module Base
3
- # Templater class for generating a report from a erb template
29
+
30
+ # Templater class for generating a report from a ERB template
4
31
  #
5
- # @author Jacob Hammack
6
32
  class PrawnTemplater
7
33
  attr_accessor :template, :template_source, :findings, :output_file
8
-
9
- # Setups of the Templater class initalizing all of the variables
34
+
35
+ # Setups of the Templater class initializing all of the variables
10
36
  #
11
37
  # @return [PrawnTemplater] New Instance
38
+ #
12
39
  def initialize(template, findings, output)
13
40
  @template = template
14
41
  @findings = findings
@@ -16,12 +43,13 @@ module Risu
16
43
 
17
44
  @template_source = File.new(@template).read
18
45
  end
19
-
20
- # Generates a report based on the erb template
46
+
47
+ # Generates a report based on the ERB template
48
+ #
49
+ # @return [String] HTML output of the ERB template
21
50
  #
22
- # @return [String] html output of the erb template
23
51
  def generate
24
- begin
52
+ begin
25
53
  source = @template_source
26
54
  template = @template
27
55
  Prawn::Document.generate(@output_file, :margin => [75, 50, 75, 50]) do
@@ -1,181 +1,217 @@
1
- module Risu
1
+ # Copyright (c) 2010-2012 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:
2
6
 
3
- # Risu Schema
4
- #
5
- # @author Jacob Hammack <jacob.hammack@hammackj.com>
6
- class Schema < ActiveRecord::Migration
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.
7
15
 
8
- # Creates all of the database tables required by the parser
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 Base
29
+
30
+ # Risu database Schema
9
31
  #
10
- def self.up
11
- create_table :policies do |t|
12
- t.string :name
13
- t.string :comments
14
- end
32
+ class Schema < ActiveRecord::Migration
15
33
 
16
- create_table :server_preferences do |t|
17
- t.integer :policy_id
18
- t.string :name
19
- t.string :value
20
- end
34
+ # Creates all of the database tables required by the parser
35
+ #
36
+ def self.up
37
+ create_table :policies do |t|
38
+ t.string :name
39
+ t.string :comments
40
+ end
21
41
 
22
- create_table :plugins_preferences do |t|
23
- t.integer :policy_id
24
- t.integer :plugin_id
25
- t.string :plugin_name
26
- t.string :fullname
27
- t.string :preference_name
28
- t.string :preference_type
29
- t.string :preference_values
30
- t.string :selected_values
31
- end
42
+ create_table :server_preferences do |t|
43
+ t.integer :policy_id
44
+ t.string :name
45
+ t.string :value
46
+ end
32
47
 
33
- create_table :family_selections do |t|
34
- t.integer :policy_id
35
- t.string :family_name
36
- t.string :status
37
- end
48
+ create_table :plugins_preferences do |t|
49
+ t.integer :policy_id
50
+ t.integer :plugin_id
51
+ t.string :plugin_name
52
+ t.string :fullname
53
+ t.string :preference_name
54
+ t.string :preference_type
55
+ t.string :preference_values
56
+ t.string :selected_values
57
+ end
38
58
 
39
- create_table :reports do |t|
40
- t.integer :policy_id
41
- t.string :name
42
- end
59
+ create_table :family_selections do |t|
60
+ t.integer :policy_id
61
+ t.string :family_name
62
+ t.string :status
63
+ end
43
64
 
44
- create_table :hosts do |t|
45
- t.integer :report_id
46
- t.string :name
47
- t.string :os
48
- t.string :mac
49
- t.datetime :start
50
- t.datetime :end
51
- t.string :ip
52
- t.string :fqdn
53
- t.string :netbios
54
- t.string :local_checks_proto
55
- t.string :smb_login_used
56
- t.string :ssh_auth_meth
57
- t.string :ssh_login_used
58
- t.string :pci_dss_compliance
59
- t.string :pci_dss_compliance_
60
- t.string :pcidss_compliance_failed
61
- t.string :pcidss_compliance_passed
62
- t.string :pcidss_deprecated_ssl
63
- t.string :pcidss_expired_ssl_certificate
64
- t.string :pcidss_obsolete_operating_system
65
- t.string :pcidss_dns_zone_transfer
66
- t.string :pcidss_high_risk_flaw
67
- t.string :pcidss_medium_risk_flaw
68
- t.string :pcidss_reachable_db
69
- t.string :pcidss_www_xss
70
- t.string :pcidss_directory_browsing
71
- t.string :pcidss_known_credentials
72
- t.string :pcidss_compromised_host_worm
73
- t.string :pcidss_unprotected_mssql_db
74
- t.string :pcidss_obsolete_software
75
- t.string :pcidss_www_sql_injection
76
- t.string :system_type
77
- t.text :notes
78
- end
65
+ create_table :reports do |t|
66
+ t.integer :policy_id
67
+ t.string :name
68
+ end
79
69
 
80
- create_table :items do |t|
81
- t.integer :host_id
82
- t.integer :plugin_id
83
- t.text :plugin_output
84
- t.integer :port
85
- t.string :svc_name
86
- t.string :protocol
87
- t.integer :severity
88
- t.string :plugin_name
89
- t.boolean :verified
90
- end
70
+ create_table :hosts do |t|
71
+ t.integer :report_id
72
+ t.string :name
73
+ t.string :os
74
+ t.string :mac
75
+ t.datetime :start
76
+ t.datetime :end
77
+ t.string :ip
78
+ t.string :fqdn
79
+ t.string :netbios
80
+ t.string :local_checks_proto
81
+ t.string :smb_login_used
82
+ t.string :ssh_auth_meth
83
+ t.string :ssh_login_used
84
+ t.string :pci_dss_compliance
85
+ t.string :pci_dss_compliance_
86
+ t.string :pcidss_compliance_failed
87
+ t.string :pcidss_compliance_passed
88
+ t.string :pcidss_deprecated_ssl
89
+ t.string :pcidss_expired_ssl_certificate
90
+ t.string :pcidss_obsolete_operating_system
91
+ t.string :pcidss_dns_zone_transfer
92
+ t.string :pcidss_high_risk_flaw
93
+ t.string :pcidss_medium_risk_flaw
94
+ t.string :pcidss_reachable_db
95
+ t.string :pcidss_www_xss
96
+ t.string :pcidss_directory_browsing
97
+ t.string :pcidss_known_credentials
98
+ t.string :pcidss_compromised_host_worm
99
+ t.string :pcidss_unprotected_mssql_db
100
+ t.string :pcidss_obsolete_software
101
+ t.string :pcidss_www_sql_injection
102
+ t.string :pcidss_backup_files
103
+ t.string :system_type
104
+ t.text :notes
105
+ end
91
106
 
92
- create_table :plugins do |t|
93
- t.string :plugin_name
94
- t.string :family_name
95
- t.text :description
96
- t.string :plugin_version
97
- t.datetime :plugin_publication_date
98
- t.datetime :plugin_modification_date
99
- t.datetime :vuln_publication_date
100
- t.string :cvss_vector
101
- t.string :cvss_base_score
102
- t.string :cvss_temporal_score
103
- t.string :cvss_temporal_vector
104
- t.string :exploitability_ease
105
- t.string :exploit_framework_core
106
- t.string :exploit_framework_metasploit
107
- t.string :metasploit_name
108
- t.string :exploit_framework_canvas
109
- t.string :canvas_package
110
- t.string :exploit_available
111
- t.string :risk_factor
112
- t.text :solution
113
- t.text :synopsis
114
- t.string :plugin_type
115
- t.string :exploit_framework_exploithub
116
- t.string :exploithub_sku
117
- t.string :stig_severity
118
- t.string :fname
119
- end
107
+ create_table :items do |t|
108
+ t.integer :host_id
109
+ t.integer :plugin_id
110
+ t.text :plugin_output
111
+ t.integer :port
112
+ t.string :svc_name
113
+ t.string :protocol
114
+ t.integer :severity
115
+ t.string :plugin_name
116
+ t.boolean :verified
117
+ end
120
118
 
121
- create_table :individual_plugin_selections do |t|
122
- t.string :policy_id
123
- t.integer :plugin_id
124
- t.string :plugin_name
125
- t.string :family
126
- t.string :status
127
- end
119
+ create_table :plugins do |t|
120
+ t.string :plugin_name
121
+ t.string :family_name
122
+ t.text :description
123
+ t.string :plugin_version
124
+ t.datetime :plugin_publication_date
125
+ t.datetime :plugin_modification_date
126
+ t.datetime :vuln_publication_date
127
+ t.string :cvss_vector
128
+ t.string :cvss_base_score
129
+ t.string :cvss_temporal_score
130
+ t.string :cvss_temporal_vector
131
+ t.string :exploitability_ease
132
+ t.string :exploit_framework_core
133
+ t.string :exploit_framework_metasploit
134
+ t.string :metasploit_name
135
+ t.string :exploit_framework_canvas
136
+ t.string :canvas_package
137
+ t.string :exploit_available
138
+ t.string :risk_factor
139
+ t.text :solution
140
+ t.text :synopsis
141
+ t.string :plugin_type
142
+ t.string :exploit_framework_exploithub
143
+ t.string :exploithub_sku
144
+ t.string :stig_severity
145
+ t.string :fname
146
+ t.string :always_run
147
+ end
128
148
 
129
- create_table :references do |t|
130
- t.integer :plugin_id
131
- t.string :reference_name
132
- t.string :value
133
- end
149
+ create_table :individual_plugin_selections do |t|
150
+ t.string :policy_id
151
+ t.integer :plugin_id
152
+ t.string :plugin_name
153
+ t.string :family
154
+ t.string :status
155
+ end
134
156
 
135
- create_table :versions do |t|
136
- t.string :version
137
- end
138
-
139
- create_table :service_descriptions do |t|
140
- t.string :name
141
- t.integer :port
142
- t.string :description
143
- end
144
-
145
- create_table :patches do |t|
146
- t.integer :host_id
147
- t.string :name
148
- t.string :value
157
+ create_table :references do |t|
158
+ t.integer :plugin_id
159
+ t.string :reference_name
160
+ t.string :value
161
+ end
162
+
163
+ create_table :versions do |t|
164
+ t.string :version
165
+ end
166
+
167
+ create_table :service_descriptions do |t|
168
+ t.string :name
169
+ t.integer :port
170
+ t.string :description
171
+ end
172
+
173
+ create_table :patches do |t|
174
+ t.integer :host_id
175
+ t.string :name
176
+ t.string :value
177
+ end
178
+
179
+ #Index's for speed increases
180
+ add_index :items, :host_id
181
+ add_index :items, :plugin_id
182
+ add_index :references, :plugin_id
183
+
184
+ #Default data for service descriptions
185
+ #@todo Unused atm, might be better to use a yaml file tho..
186
+ ServiceDescription.create :name => "www", :description => ""
187
+ ServiceDescription.create :name => "cifs", :description => ""
188
+ ServiceDescription.create :name => "smb", :description => ""
189
+ ServiceDescription.create :name => "netbios-ns", :description => ""
190
+ ServiceDescription.create :name => "snmp", :description => ""
191
+ ServiceDescription.create :name => "ftp", :description => ""
192
+ ServiceDescription.create :name => "epmap", :description => ""
193
+ ServiceDescription.create :name => "ntp", :description => ""
194
+ ServiceDescription.create :name => "dce-rpc", :description => ""
195
+ ServiceDescription.create :name => "telnet", :description => ""
149
196
  end
150
-
151
- ServiceDescription.create :name => "www", :description => ""
152
- ServiceDescription.create :name => "cifs", :description => ""
153
- ServiceDescription.create :name => "smb", :description => ""
154
- ServiceDescription.create :name => "netbios-ns", :description => ""
155
- ServiceDescription.create :name => "snmp", :description => ""
156
- ServiceDescription.create :name => "ftp", :description => ""
157
- ServiceDescription.create :name => "epmap", :description => ""
158
- ServiceDescription.create :name => "ntp", :description => ""
159
- ServiceDescription.create :name => "dce-rpc", :description => ""
160
- ServiceDescription.create :name => "telnet", :description => ""
161
- end
162
197
 
163
- # Deletes all of the database tables created
164
- #
165
- def self.down
166
- drop_table :policies
167
- drop_table :server_preferences
168
- drop_table :plugins_preferences
169
- drop_table :family_selections
170
- drop_table :individual_plugin_selections
171
- drop_table :reports
172
- drop_table :hosts
173
- drop_table :items
174
- drop_table :plugins
175
- drop_table :references
176
- drop_table :versions
177
- drop_table :service_descriptions
178
- drop_table :patches
198
+ # Deletes all of the database tables created
199
+ #
200
+ def self.down
201
+ drop_table :policies
202
+ drop_table :server_preferences
203
+ drop_table :plugins_preferences
204
+ drop_table :family_selections
205
+ drop_table :individual_plugin_selections
206
+ drop_table :reports
207
+ drop_table :hosts
208
+ drop_table :items
209
+ drop_table :plugins
210
+ drop_table :references
211
+ drop_table :versions
212
+ drop_table :service_descriptions
213
+ drop_table :patches
214
+ end
179
215
  end
180
216
  end
181
217
  end