ronin-db-activerecord 0.1.0.beta2 → 0.1.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. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +14 -0
  3. data/.rubocop.yml +16 -0
  4. data/ChangeLog.md +11 -1
  5. data/Gemfile +4 -0
  6. data/README.md +68 -34
  7. data/Rakefile +3 -3
  8. data/db/migrate/{0014_create_ronin_ip_addresses_table.rb → 0001_create_ronin_ip_addresses_table.rb} +4 -0
  9. data/db/migrate/{0021_create_ronin_mac_addresses_table.rb → 0002_create_ronin_mac_addresses_table.rb} +4 -0
  10. data/db/migrate/{0001_create_ronin_ip_address_mac_addresses_table.rb → 0003_create_ronin_ip_address_mac_addresses_table.rb} +4 -0
  11. data/db/migrate/{0009_create_ronin_host_names_table.rb → 0004_create_ronin_host_names_table.rb} +4 -0
  12. data/db/migrate/{0025_create_ronin_ports_table.rb → 0005_create_ronin_ports_table.rb} +4 -0
  13. data/db/migrate/{0023_create_ronin_services_table.rb → 0006_create_ronin_services_table.rb} +4 -0
  14. data/db/migrate/{0018_create_ronin_open_ports_table.rb → 0007_create_ronin_open_ports_table.rb} +4 -0
  15. data/db/migrate/{0003_create_ronin_url_schemes_table.rb → 0008_create_ronin_url_schemes_table.rb} +4 -0
  16. data/db/migrate/{0019_create_ronin_urls_table.rb → 0009_create_ronin_urls_table.rb} +5 -0
  17. data/db/migrate/0010_create_ronin_advisories_table.rb +45 -0
  18. data/db/migrate/{0002_create_ronin_vulnerabilities_table.rb → 0011_create_ronin_vulnerabilities_table.rb} +14 -11
  19. data/db/migrate/{0004_create_ronin_url_query_param_names_table.rb → 0012_create_ronin_url_query_param_names_table.rb} +4 -0
  20. data/db/migrate/{0005_create_ronin_user_names_table.rb → 0013_create_ronin_user_names_table.rb} +4 -0
  21. data/db/migrate/{0006_create_ronin_software_vendors_table.rb → 0014_create_ronin_software_vendors_table.rb} +4 -0
  22. data/db/migrate/{0008_create_ronin_host_name_ip_addresses_table.rb → 0015_create_ronin_host_name_ip_addresses_table.rb} +4 -0
  23. data/db/migrate/{0010_create_ronin_arches_table.rb → 0016_create_ronin_arches_table.rb} +3 -0
  24. data/db/migrate/{0011_create_ronin_email_addresses_table.rb → 0017_create_ronin_email_addresses_table.rb} +4 -0
  25. data/db/migrate/{0012_create_ronin_oses_table.rb → 0018_create_ronin_oses_table.rb} +4 -0
  26. data/db/migrate/{0013_create_ronin_organizations_table.rb → 0019_create_ronin_organizations_table.rb} +4 -0
  27. data/db/migrate/{0015_create_ronin_os_guesses_table.rb → 0020_create_ronin_os_guesses_table.rb} +4 -0
  28. data/db/migrate/{0016_create_ronin_url_query_params_table.rb → 0021_create_ronin_url_query_params_table.rb} +4 -0
  29. data/db/migrate/{0017_create_ronin_passwords_table.rb → 0022_create_ronin_passwords_table.rb} +4 -0
  30. data/db/migrate/{0020_create_ronin_softwares_table.rb → 0023_create_ronin_softwares_table.rb} +5 -3
  31. data/db/migrate/{0022_create_ronin_countries_table.rb → 0024_create_ronin_countries_table.rb} +4 -0
  32. data/db/migrate/{0024_create_ronin_credentials_table.rb → 0025_create_ronin_credentials_table.rb} +4 -0
  33. data/db/migrate/0026_create_ronin_asns_table.rb +4 -0
  34. data/db/migrate/0027_create_ronin_http_query_param_names_table.rb +4 -0
  35. data/db/migrate/{0033_create_ronin_http_responses_table.rb → 0028_create_ronin_http_responses_table.rb} +5 -3
  36. data/db/migrate/{0032_create_ronin_http_requests_table.rb → 0029_create_ronin_http_requests_table.rb} +5 -3
  37. data/db/migrate/{0028_create_ronin_http_query_params_table.rb → 0030_create_ronin_http_query_params_table.rb} +4 -0
  38. data/db/migrate/{0029_create_ronin_http_header_names_table.rb → 0031_create_ronin_http_header_names_table.rb} +4 -0
  39. data/db/migrate/{0030_create_ronin_http_request_headers_table.rb → 0032_create_ronin_http_request_headers_table.rb} +4 -0
  40. data/db/migrate/{0031_create_ronin_http_response_headers_table.rb → 0033_create_ronin_http_response_headers_table.rb} +4 -0
  41. data/db/migrate/0034_create_ronin_service_credentials_table.rb +4 -0
  42. data/db/migrate/0035_create_ronin_web_credentials_table.rb +4 -0
  43. data/gemspec.yml +1 -1
  44. data/lib/ronin/db/advisory.rb +5 -5
  45. data/lib/ronin/db/asn.rb +3 -3
  46. data/lib/ronin/db/host_name.rb +1 -1
  47. data/lib/ronin/db/http_response.rb +1 -1
  48. data/lib/ronin/db/ip_address.rb +1 -1
  49. data/lib/ronin/db/mac_address.rb +2 -2
  50. data/lib/ronin/db/migrations.rb +11 -8
  51. data/lib/ronin/db/model/has_unique_name.rb +3 -5
  52. data/lib/ronin/db/model/importable.rb +3 -0
  53. data/lib/ronin/db/model/last_scanned_at.rb +3 -0
  54. data/lib/ronin/db/model.rb +3 -0
  55. data/lib/ronin/db/models.rb +3 -0
  56. data/lib/ronin/db/password.rb +3 -3
  57. data/lib/ronin/db/url.rb +20 -23
  58. data/lib/ronin/db/url_scheme.rb +1 -1
  59. data/lib/ronin/db/vulnerability.rb +4 -0
  60. data/ronin-db-activerecord.gemspec +3 -3
  61. metadata +34 -33
  62. data/db/migrate/0007_create_ronin_advisories_table.rb +0 -42
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_credentials` table.
25
+ #
22
26
  class CreateRoninCredentialsTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_asns` table.
25
+ #
22
26
  class CreateRoninAsnsTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_http_query_param_names` table.
25
+ #
22
26
  class CreateRoninHttpQueryParamNamesTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_http_responses` table.
25
+ #
22
26
  class CreateRoninHttpResponsesTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -26,9 +30,7 @@ class CreateRoninHttpResponsesTable < ActiveRecord::Migration[7.0]
26
30
  t.integer :status, null: false
27
31
  t.text :body
28
32
 
29
- t.references :response, foreign_key: {
30
- to_table: :ronin_http_responses
31
- }
33
+ t.references :response, foreign_key: {to_table: :ronin_http_responses}
32
34
 
33
35
  t.datetime :created_at, null: false
34
36
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_http_requests` table.
25
+ #
22
26
  class CreateRoninHttpRequestsTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -28,9 +32,7 @@ class CreateRoninHttpRequestsTable < ActiveRecord::Migration[7.0]
28
32
  t.string :path, null: false
29
33
  t.text :body
30
34
 
31
- t.references :response, foreign_key: {
32
- to_table: :ronin_http_responses
33
- }
35
+ t.references :response, foreign_key: {to_table: :ronin_http_responses}
34
36
 
35
37
  t.datetime :created_at, null: false
36
38
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_http_query_params` table.
25
+ #
22
26
  class CreateRoninHttpQueryParamsTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_http_header_names` table.
25
+ #
22
26
  class CreateRoninHttpHeaderNamesTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_http_request_headers` table.
25
+ #
22
26
  class CreateRoninHttpRequestHeadersTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_http_response_headers` table.
25
+ #
22
26
  class CreateRoninHttpResponseHeadersTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_service_credentials` table.
25
+ #
22
26
  class CreateRoninServiceCredentialsTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # ronin-db-activerecord - ActiveRecord backend for the Ronin Database.
3
4
  #
@@ -19,6 +20,9 @@
19
20
  # along with ronin-db-activerecord. If not, see <https://www.gnu.org/licenses/>.
20
21
  #
21
22
 
23
+ #
24
+ # Creates the `ronin_web_credentials` table.
25
+ #
22
26
  class CreateRoninWebCredentialsTable < ActiveRecord::Migration[7.0]
23
27
 
24
28
  def change
data/gemspec.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: ronin-db-activerecord
2
- version: 0.1.0.beta2
2
+ version: 0.1.1
3
3
  summary: ActiveRecord backend for the Ronin Database
4
4
  description:
5
5
  ronin-db-activerecord contains ActiveRecord models and migrations for the
@@ -56,9 +56,9 @@ module Ronin
56
56
  attribute :year, :integer
57
57
  validates :year, allow_nil: true,
58
58
  comparison: {
59
- greater_than: 1990,
60
- less_than_or_equal_to: Date.today.year
61
- }
59
+ greater_than: 1990,
60
+ less_than_or_equal_to: Date.today.year
61
+ }
62
62
 
63
63
  # @!attribute [rw] identifier
64
64
  # The advisory identifier
@@ -72,7 +72,7 @@ module Ronin
72
72
  #
73
73
  module ID
74
74
  #
75
- # Parses a security avdisory ID.
75
+ # Parses a security advisory ID.
76
76
  #
77
77
  # @param [String] string
78
78
  # The security advisory ID String to split.
@@ -84,7 +84,7 @@ module Ronin
84
84
  # The ID does not appear to be a valid security ID.
85
85
  #
86
86
  def self.parse(string)
87
- if (match = string.match(/\A([A-Z]+)-(\d{4})[:-]([0-9][0-9-]+)\z/))
87
+ if (match = string.match(/\A([A-Z]+)-(\d{4})[:-]([0-9][0-9-]+)\z/))
88
88
  {
89
89
  id: match[0],
90
90
  prefix: match[1],
data/lib/ronin/db/asn.rb CHANGED
@@ -142,7 +142,7 @@ module Ronin
142
142
  #
143
143
  # Searches for all ASNs with the matching name.
144
144
  #
145
- # @param [String] name
145
+ # @param [String] name
146
146
  # The name to search for.
147
147
  #
148
148
  # @return [Array<ASN>]
@@ -159,11 +159,11 @@ module Ronin
159
159
  # @return [ASN, nil]
160
160
  #
161
161
  def self.containing_ip(ip)
162
- ip = IPAddr.new(ip) unless ip.kind_of?(IPAddr)
162
+ ip = IPAddr.new(ip) unless ip.kind_of?(IPAddr)
163
163
  ip_hton = ip.hton
164
164
 
165
165
  range_start_hton = self.arel_table[:range_start_hton]
166
- range_end_hton = self.arel_table[:range_end_hton]
166
+ range_end_hton = self.arel_table[:range_end_hton]
167
167
 
168
168
  where(range_start_hton.lteq(ip_hton).and(range_end_hton.gteq(ip_hton))).first
169
169
  end
@@ -38,7 +38,7 @@ module Ronin
38
38
  include Model::LastScannedAt
39
39
 
40
40
  # @!attribute [rw] id
41
- # The primary ID of the host nmae.
41
+ # The primary ID of the host name.
42
42
  #
43
43
  # @return [Integer]
44
44
  attribute :id, :integer
@@ -32,7 +32,7 @@ module Ronin
32
32
  include Model
33
33
 
34
34
  # @!attribute [rw] id
35
- # The primary ID of the HTTP reponse.
35
+ # The primary ID of the HTTP response.
36
36
  #
37
37
  # @return [Integer]
38
38
  attribute :id, :integer
@@ -262,6 +262,7 @@ module Ronin
262
262
  begin
263
263
  IPAddr.new(self.address)
264
264
  rescue IPAddr::InvalidAddressError
265
+ nil
265
266
  end
266
267
  end
267
268
  end
@@ -345,7 +346,6 @@ require 'ronin/db/host_name_ip_address'
345
346
  require 'ronin/db/host_name'
346
347
  require 'ronin/db/open_port'
347
348
  require 'ronin/db/port'
348
- require 'ronin/db/host_name'
349
349
  require 'ronin/db/os_guess'
350
350
  require 'ronin/db/os'
351
351
  require 'ronin/db/asn'
@@ -78,8 +78,8 @@ module Ronin
78
78
  # @api public
79
79
  #
80
80
  def to_i
81
- self.address.split(':').inject(0) do |bits,char|
82
- bits = ((bits << 8) | char.hex)
81
+ self.address.split(':').reduce(0) do |bits,char|
82
+ ((bits << 8) | char.hex)
83
83
  end
84
84
  end
85
85
 
@@ -25,6 +25,9 @@ require 'active_record/migration'
25
25
 
26
26
  module Ronin
27
27
  module DB
28
+ #
29
+ # Handles migrating the database.
30
+ #
28
31
  module Migrations
29
32
  #
30
33
  # The current migration version of the database.
@@ -56,7 +59,7 @@ module Ronin
56
59
  context.migrate(target_version)
57
60
  end
58
61
 
59
- #
62
+ #
60
63
  # Explicitly migrates up the database to the target version.
61
64
  #
62
65
  # @param [Integer, nil] target_version
@@ -68,9 +71,9 @@ module Ronin
68
71
  context.up(target_version,&block)
69
72
  end
70
73
 
71
- #
74
+ #
72
75
  # Explicitly migrates down the database to the target version.
73
- #
76
+ #
74
77
  # @param [Integer, nil] target_version
75
78
  # The desired target version.
76
79
  #
@@ -80,7 +83,7 @@ module Ronin
80
83
  context.down(target_version,&block)
81
84
  end
82
85
 
83
- #
86
+ #
84
87
  # Rollbacks the last number of migrations.
85
88
  #
86
89
  # @param [Integer] steps
@@ -92,7 +95,7 @@ module Ronin
92
95
  context.rollback(steps)
93
96
  end
94
97
 
95
- #
98
+ #
96
99
  # Applies the next number of migrations.
97
100
  #
98
101
  # @param [Integer] steps
@@ -104,8 +107,6 @@ module Ronin
104
107
  context.foreward(steps)
105
108
  end
106
109
 
107
- private
108
-
109
110
  # Path to the `db/migrate/` directory in `ronin-db-activerecord`.
110
111
  DIR = File.expand_path('../../../db/migrate',__dir__)
111
112
 
@@ -129,8 +130,10 @@ module Ronin
129
130
  #
130
131
  # @return [MigrationContext]
131
132
  #
133
+ # @api private
134
+ #
132
135
  def self.context
133
- @migrations ||= MigrationContext.new
136
+ @context ||= MigrationContext.new
134
137
  end
135
138
  end
136
139
  end
@@ -29,7 +29,7 @@ module Ronin
29
29
  module HasUniqueName
30
30
  #
31
31
  # @!attribute [rw] name
32
- # The unqiue name of the model.
32
+ # The unique name of the model.
33
33
  #
34
34
  # @return [String]
35
35
  #
@@ -44,11 +44,9 @@ module Ronin
44
44
  # @api semipublic
45
45
  #
46
46
  def self.included(base)
47
- base.send :include, Model,
48
- HasName::InstanceMethods
47
+ base.send :include, Model, HasName::InstanceMethods
49
48
 
50
- base.send :extend, HasName::ClassMethods,
51
- HasUniqueName::ClassMethods
49
+ base.send :extend, HasName::ClassMethods, HasUniqueName::ClassMethods
52
50
 
53
51
  base.module_eval do
54
52
  # The name of the model
@@ -37,6 +37,9 @@ module Ronin
37
37
  model.extend ClassMethods
38
38
  end
39
39
 
40
+ #
41
+ # Class-methods which will be added to the model.
42
+ #
40
43
  module ClassMethods
41
44
  #
42
45
  # Looks up a record with the given value.
@@ -21,6 +21,9 @@
21
21
  module Ronin
22
22
  module DB
23
23
  module Model
24
+ #
25
+ # Mixin which adds a `last_scanned_at` attribute to a model.
26
+ #
24
27
  module LastScannedAt
25
28
  #
26
29
  # @!attribute [rw] last_scanned_at
@@ -20,6 +20,9 @@
20
20
 
21
21
  module Ronin
22
22
  module DB
23
+ #
24
+ # Mixin for all `ronin-db-activerecord` models.
25
+ #
23
26
  module Model
24
27
  #
25
28
  # Sets the models `table_name_prefix` to `ronin_`.
@@ -56,6 +56,9 @@ require 'ronin/db/vulnerability'
56
56
 
57
57
  module Ronin
58
58
  module DB
59
+ #
60
+ # Manages all models defined in `ronin-db-activerecord`.
61
+ #
59
62
  module Models
60
63
  ALL = [
61
64
  Address,
@@ -109,13 +109,13 @@ module Ronin
109
109
  #
110
110
  # @example
111
111
  # pass = Password.new(plain_text: 'secret')
112
- #
112
+ #
113
113
  # pass.digest(:sha1)
114
114
  # # => "e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4"
115
- #
115
+ #
116
116
  # pass.digest(:sha1, prepend_salt: "A\x90\x00")
117
117
  # # => "e2817656a48c49f24839ccf9295b389d8f985904"
118
- #
118
+ #
119
119
  # pass.digest(:sha1, append_salt: "BBBB")
120
120
  # # => "aa6ca21e446d425fc044bbb26e950a788444a5b8"
121
121
  #
data/lib/ronin/db/url.rb CHANGED
@@ -87,7 +87,7 @@ module Ronin
87
87
 
88
88
  # @!attribute [rw] fragment
89
89
  # The fragment of the URL.
90
- #
90
+ #
91
91
  # @return [String, nil]
92
92
  attribute :fragment, :string
93
93
 
@@ -362,33 +362,30 @@ module Ronin
362
362
  number: uri.port
363
363
  )
364
364
  end
365
+ path = normalized_path(uri)
366
+ query = uri.query
367
+ fragment = uri.fragment
365
368
 
366
- path = normalized_path(uri)
367
- query = uri.query
368
- fragment = uri.fragment
369
-
370
- query_params = []
371
-
372
- if uri.respond_to?(:query_params)
373
- # find or create the URL query params
374
- uri.query_params.each do |name,value|
375
- query_params << URLQueryParam.new(
376
- name: URLQueryParamName.find_or_create_by(name: name),
377
- value: value
378
- )
379
- end
380
- end
381
-
382
- # find or create the URL
369
+ # try to query a pre-existing URI then fallback to creating the URL
370
+ # with query params.
383
371
  return find_or_create_by(
384
372
  scheme: scheme,
385
373
  host_name: host_name,
386
374
  port: port,
387
375
  path: path,
388
376
  query: query,
389
- fragment: fragment,
390
- query_params: query_params
391
- )
377
+ fragment: fragment
378
+ ) do |new_url|
379
+ if uri.respond_to?(:query_params)
380
+ # find or create the URL query params
381
+ uri.query_params.each do |name,value|
382
+ new_url.query_params << URLQueryParam.new(
383
+ name: URLQueryParamName.find_or_create_by(name: name),
384
+ value: value
385
+ )
386
+ end
387
+ end
388
+ end
392
389
  end
393
390
 
394
391
  #
@@ -430,9 +427,11 @@ module Ronin
430
427
  scheme = if self.scheme
431
428
  self.scheme.name
432
429
  end
430
+
433
431
  host = if self.host_name
434
432
  self.host_name.name
435
433
  end
434
+
436
435
  port = if self.port
437
436
  self.port.number
438
437
  end
@@ -460,8 +459,6 @@ module Ronin
460
459
  self.to_uri.to_s
461
460
  end
462
461
 
463
- protected
464
-
465
462
  #
466
463
  # Normalizes the path of a URI.
467
464
  #
@@ -34,7 +34,7 @@ module Ronin
34
34
  include Model::HasUniqueName
35
35
 
36
36
  self.table_name = 'ronin_url_schemes'
37
-
37
+
38
38
  # @!attribute [rw] id
39
39
  # The primary key of the URL scheme.
40
40
  #
@@ -28,6 +28,10 @@ require 'active_record'
28
28
 
29
29
  module Ronin
30
30
  module DB
31
+ #
32
+ # Represents a discovered vulnerability associated with a URL, open port,
33
+ # host name, IP, or MAC address.
34
+ #
31
35
  class Vulnerability < ActiveRecord::Base
32
36
 
33
37
  include Model
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'yaml'
4
4
 
@@ -22,7 +22,7 @@ Gem::Specification.new do |gem|
22
22
  gem.homepage = gemspec['homepage']
23
23
  gem.metadata = gemspec['metadata'] if gemspec['metadata']
24
24
 
25
- glob = lambda { |patterns| gem.files & Dir[*patterns] }
25
+ glob = ->(patterns) { gem.files & Dir[*patterns] }
26
26
 
27
27
  gem.files = `git ls-files`.split($/)
28
28
  gem.files = glob[gemspec['files']] if gemspec['files']
@@ -46,7 +46,7 @@ Gem::Specification.new do |gem|
46
46
  gem.required_rubygems_version = gemspec['required_rubygems_version']
47
47
  gem.post_install_message = gemspec['post_install_message']
48
48
 
49
- split = lambda { |string| string.split(/,\s*/) }
49
+ split = ->(string) { string.split(/,\s*/) }
50
50
 
51
51
  if gemspec['dependencies']
52
52
  gemspec['dependencies'].each do |name,versions|