ronin-db 0.1.3 → 0.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -0
  3. data/.gitignore +1 -0
  4. data/ChangeLog.md +28 -0
  5. data/Gemfile +6 -4
  6. data/README.md +17 -5
  7. data/Rakefile +13 -35
  8. data/data/completions/ronin-db +271 -0
  9. data/gemspec.yml +17 -2
  10. data/lib/ronin/db/cli/command.rb +1 -1
  11. data/lib/ronin/db/cli/commands/add.rb +1 -1
  12. data/lib/ronin/db/cli/commands/asn.rb +12 -2
  13. data/lib/ronin/db/cli/commands/certs.rb +322 -0
  14. data/lib/ronin/db/cli/commands/completion.rb +63 -0
  15. data/lib/ronin/db/cli/commands/creds.rb +2 -1
  16. data/lib/ronin/db/cli/commands/edit.rb +1 -1
  17. data/lib/ronin/db/cli/commands/emails.rb +22 -1
  18. data/lib/ronin/db/cli/commands/hosts.rb +2 -1
  19. data/lib/ronin/db/cli/commands/ips.rb +2 -1
  20. data/lib/ronin/db/cli/commands/irb.rb +8 -4
  21. data/lib/ronin/db/cli/commands/list.rb +1 -1
  22. data/lib/ronin/db/cli/commands/migrate.rb +12 -8
  23. data/lib/ronin/db/cli/commands/open_ports.rb +102 -0
  24. data/lib/ronin/db/cli/commands/oses.rb +95 -0
  25. data/lib/ronin/db/cli/commands/passwords.rb +83 -0
  26. data/lib/ronin/db/cli/commands/people.rb +185 -0
  27. data/lib/ronin/db/cli/commands/phone_numbers.rb +136 -0
  28. data/lib/ronin/db/cli/commands/ports.rb +103 -0
  29. data/lib/ronin/db/cli/commands/remove.rb +1 -1
  30. data/lib/ronin/db/cli/commands/services.rb +102 -0
  31. data/lib/ronin/db/cli/commands/software.rb +95 -0
  32. data/lib/ronin/db/cli/commands/street_addresses.rb +129 -0
  33. data/lib/ronin/db/cli/commands/urls.rb +2 -1
  34. data/lib/ronin/db/cli/commands/web_vulns.rb +235 -0
  35. data/lib/ronin/db/cli/database_options.rb +87 -0
  36. data/lib/ronin/db/cli/deletable.rb +85 -0
  37. data/lib/ronin/db/cli/importable.rb +108 -0
  38. data/lib/ronin/db/cli/model_command.rb +8 -6
  39. data/lib/ronin/db/cli/modifiable.rb +12 -104
  40. data/lib/ronin/db/cli/printing.rb +58 -0
  41. data/lib/ronin/db/cli/ruby_shell.rb +1 -1
  42. data/lib/ronin/db/cli/uri_methods.rb +1 -1
  43. data/lib/ronin/db/cli.rb +3 -1
  44. data/lib/ronin/db/config_file.rb +1 -1
  45. data/lib/ronin/db/exceptions.rb +1 -1
  46. data/lib/ronin/db/home.rb +1 -1
  47. data/lib/ronin/db/root.rb +1 -1
  48. data/lib/ronin/db/tasks.rb +87 -0
  49. data/lib/ronin/db/version.rb +2 -2
  50. data/lib/ronin/db.rb +15 -7
  51. data/man/ronin-db-add.1 +47 -69
  52. data/man/ronin-db-add.1.md +26 -22
  53. data/man/ronin-db-asn.1 +36 -54
  54. data/man/ronin-db-asn.1.md +29 -19
  55. data/man/ronin-db-certs.1 +108 -0
  56. data/man/ronin-db-certs.1.md +106 -0
  57. data/man/ronin-db-completion.1 +76 -0
  58. data/man/ronin-db-completion.1.md +78 -0
  59. data/man/ronin-db-creds.1 +28 -46
  60. data/man/ronin-db-creds.1.md +23 -16
  61. data/man/ronin-db-edit.1 +15 -26
  62. data/man/ronin-db-edit.1.md +11 -7
  63. data/man/ronin-db-emails.1 +36 -49
  64. data/man/ronin-db-emails.1.md +30 -17
  65. data/man/ronin-db-hosts.1 +31 -51
  66. data/man/ronin-db-hosts.1.md +25 -18
  67. data/man/ronin-db-ips.1 +31 -52
  68. data/man/ronin-db-ips.1.md +26 -19
  69. data/man/ronin-db-irb.1 +22 -35
  70. data/man/ronin-db-irb.1.md +17 -10
  71. data/man/ronin-db-list.1 +16 -30
  72. data/man/ronin-db-list.1.md +13 -9
  73. data/man/ronin-db-migrate.1 +22 -35
  74. data/man/ronin-db-migrate.1.md +17 -10
  75. data/man/ronin-db-open-ports.1 +72 -0
  76. data/man/ronin-db-open-ports.1.md +70 -0
  77. data/man/ronin-db-oses.1 +72 -0
  78. data/man/ronin-db-oses.1.md +70 -0
  79. data/man/ronin-db-passwords.1 +75 -0
  80. data/man/ronin-db-passwords.1.md +73 -0
  81. data/man/ronin-db-people.1 +96 -0
  82. data/man/ronin-db-people.1.md +94 -0
  83. data/man/ronin-db-phone-numbers.1 +93 -0
  84. data/man/ronin-db-phone-numbers.1.md +91 -0
  85. data/man/ronin-db-ports.1 +87 -0
  86. data/man/ronin-db-ports.1.md +85 -0
  87. data/man/ronin-db-remove.1 +15 -28
  88. data/man/ronin-db-remove.1.md +12 -8
  89. data/man/ronin-db-services.1 +84 -0
  90. data/man/ronin-db-services.1.md +82 -0
  91. data/man/ronin-db-software.1 +72 -0
  92. data/man/ronin-db-software.1.md +70 -0
  93. data/man/ronin-db-street-addresses.1 +81 -0
  94. data/man/ronin-db-street-addresses.1.md +79 -0
  95. data/man/ronin-db-urls.1 +37 -60
  96. data/man/ronin-db-urls.1.md +28 -21
  97. data/man/ronin-db-web-vulns.1 +87 -0
  98. data/man/ronin-db-web-vulns.1.md +85 -0
  99. data/man/ronin-db.1 +118 -0
  100. data/man/ronin-db.1.md +99 -0
  101. data/scripts/setup +58 -0
  102. metadata +52 -9
  103. data/lib/ronin/db/cli/database_command.rb +0 -71
  104. data/lib/ronin/db/cli/resources_command.rb +0 -118
@@ -0,0 +1,235 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db - A common database library for managing and querying security data.
4
+ #
5
+ # Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # ronin-db is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU Lesser General Public License as published
9
+ # by the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # ronin-db is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public License
18
+ # along with ronin-db. If not, see <https://www.gnu.org/licenses/>.
19
+ #
20
+
21
+ require 'ronin/db/cli/model_command'
22
+
23
+ module Ronin
24
+ module DB
25
+ class CLI
26
+ module Commands
27
+ #
28
+ # Manages all PhoneNumbers in the database.
29
+ #
30
+ # ## Usage
31
+ #
32
+ # ronin-db phone-numbers [options]
33
+ #
34
+ # ## Options
35
+ #
36
+ # --db NAME The database to connect to (Default: default)
37
+ # --db-uri URI The database URI to connect to
38
+ # --db-file PATH The sqlite3 database file to use
39
+ # -v, --verbose Enables verbose output
40
+ # -t lfi|rfi|sqli|ssti|open-redirect|reflected-xss|command-injection,
41
+ # --with-type Searches for all web vulns of the given type
42
+ # -H, --for-host HOST Searches for web vulns effecting the host
43
+ # -d, --for-domain DOMAIN Searches for web vulns effecting the domain
44
+ # -p, --for-path PATH Searches for web vulns effecting the given path
45
+ # -q, --with-query-param NAME Searches for web vulns effecting the query param name
46
+ # --with-header-name NAME Searches for web vulns effecting the HTTP header name
47
+ # -c, --with-cookie-param NAME Searches for web vulns effecting the cookie param name
48
+ # -f, --with-form-param NAME Searches for web vulns effecting the form param name
49
+ # -M HTTP_METHOD, Searches for all web vulns with the HTTP request method
50
+ # --with-request-method
51
+ # -h, --help Print help information
52
+ #
53
+ # @since 0.2.0
54
+ #
55
+ class WebVulns < ModelCommand
56
+
57
+ command_name 'web-vulns'
58
+
59
+ model_file 'ronin/db/web_vuln'
60
+ model_name 'WebVuln'
61
+
62
+ option :with_type, short: '-t',
63
+ value: {
64
+ type: {
65
+ lfi: 'lfi',
66
+ rfi: 'rfi',
67
+ sqli: 'sqli',
68
+ ssti: 'ssti',
69
+
70
+ :"open-redirect" => 'open_redirect',
71
+ :"reflected-xss" => 'reflected_xss',
72
+ :"command-injection" => 'command_injection'
73
+ }
74
+ },
75
+ desc: 'Searches for all web vulns of the given type' do |type|
76
+ @query_method_calls << [:with_type, type]
77
+ end
78
+
79
+ option :for_host, short: '-H',
80
+ value: {
81
+ type: String,
82
+ usage: 'HOST'
83
+ },
84
+ desc: 'Searches for web vulns effecting the host' do |host|
85
+ @query_method_calls << [:for_host, host]
86
+ end
87
+
88
+ option :for_domain, short: '-d',
89
+ value: {
90
+ type: String,
91
+ usage: 'DOMAIN'
92
+ },
93
+ desc: 'Searches for web vulns effecting the domain' do |domain|
94
+ @query_method_calls << [:for_domain, domain]
95
+ end
96
+
97
+ option :for_path, short: '-p',
98
+ value: {
99
+ type: String,
100
+ usage: 'PATH'
101
+ },
102
+ desc: 'Searches for web vulns effecting the given path' do |path|
103
+ @query_method_calls << [:for_path, path]
104
+ end
105
+
106
+ option :with_query_param, short: '-q',
107
+ value: {
108
+ type: String,
109
+ usage: 'NAME'
110
+ },
111
+ desc: 'Searches for web vulns effecting the query param name' do |name|
112
+ @query_method_calls << [:with_query_param, name]
113
+ end
114
+
115
+ option :with_header_name, value: {
116
+ type: String,
117
+ usage: 'NAME'
118
+ },
119
+ desc: 'Searches for web vulns effecting the HTTP header name' do |name|
120
+ @query_method_calls << [:with_header_name, name]
121
+ end
122
+
123
+ option :with_cookie_param, short: '-c',
124
+ value: {
125
+ type: String,
126
+ usage: 'NAME'
127
+ },
128
+ desc: 'Searches for web vulns effecting the cookie param name' do |name|
129
+ @query_method_calls << [:with_cookie_param, name]
130
+ end
131
+
132
+ option :with_form_param, short: '-f',
133
+ value: {
134
+ type: String,
135
+ usage: 'NAME'
136
+ },
137
+ desc: 'Searches for web vulns effecting the form param name' do |name|
138
+ @query_method_calls << [:with_form_param, name]
139
+ end
140
+
141
+ option :with_request_method, short: '-M',
142
+ value: {
143
+ type: {
144
+ 'COPY' => :copy,
145
+ 'DELETE' => :delete,
146
+ 'GET' => :get,
147
+ 'HEAD' => :head,
148
+ 'LOCK' => :lock,
149
+ 'MKCOL' => :mkcol,
150
+ 'MOVE' => :move,
151
+ 'OPTIONS' => :options,
152
+ 'PATCH' => :patch,
153
+ 'POST' => :post,
154
+ 'PROPFIND' => :propfind,
155
+ 'PROPPATCH' => :proppatch,
156
+ 'PUT' => :put,
157
+ 'TRACE' => :trace,
158
+ 'UNLOCK' => :unlock
159
+ },
160
+ usage: 'HTTP_METHOD'
161
+ },
162
+ desc: 'Searches for all web vulns with the HTTP request method' do |http_method|
163
+ @query_method_calls << [:with_request_method, http_method]
164
+ end
165
+
166
+ description 'Queries and manages WebVulns'
167
+
168
+ man_page 'ronin-db-web-vulns.1'
169
+
170
+ # Mapping of web vulnerability types and their printable names.
171
+ TYPE_NAMES = {
172
+ 'lfi' => 'LFI',
173
+ 'rfi' => 'RFI',
174
+ 'sqli' => 'SQLi',
175
+ 'ssti' => 'SSTI',
176
+
177
+ 'open_redirect' => 'Open Redirect',
178
+ 'reflected_xss' => 'Reflected XSS',
179
+ 'command_injection' => 'Command Injection'
180
+ }
181
+
182
+ #
183
+ # Returns the printable vulnerability type for the vulnerability.
184
+ #
185
+ # @param [Ronin::DB::WebVuln] web_vuln
186
+ #
187
+ # @return [String]
188
+ #
189
+ def web_vuln_type(web_vuln)
190
+ TYPE_NAMES.fetch(web_vuln.type) do
191
+ raise(NotImplementedError,"unknown web vulnerability type: #{web_vuln.type.inspect}")
192
+ end
193
+ end
194
+
195
+ #
196
+ # Determines the location of the web vulnerability.
197
+ #
198
+ # @param [Ronin::DB::WebVuln] web_vuln
199
+ #
200
+ # @return [String, nil]
201
+ #
202
+ def web_vuln_location(web_vuln)
203
+ if web_vuln.query_param
204
+ "query param '#{web_vuln.query_param}'"
205
+ elsif web_vuln.header_name
206
+ "Header '#{web_vuln.header_name}'"
207
+ elsif web_vuln.cookie_param
208
+ "Cookie param '#{web_vuln.cookie_param}'"
209
+ elsif web_vuln.form_param
210
+ "form param '#{web_vuln.form_param}'"
211
+ end
212
+ end
213
+
214
+ #
215
+ # Prints a web vulnerability record from the database.
216
+ #
217
+ # @param [Ronin::DB::WebVuln] web_vuln
218
+ # The web vulnerability record to print.
219
+ #
220
+ def print_record(web_vuln)
221
+ type = web_vuln_type(web_vuln)
222
+ location = web_vuln_location(web_vuln)
223
+
224
+ if location
225
+ puts "#{type} on #{web_vuln.url} via #{location}"
226
+ else
227
+ puts "#{type} on #{web_vuln.url}"
228
+ end
229
+ end
230
+
231
+ end
232
+ end
233
+ end
234
+ end
235
+ end
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db - A common database library for managing and querying security data.
4
+ #
5
+ # Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # ronin-db is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU Lesser General Public License as published
9
+ # by the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # ronin-db is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public License
18
+ # along with ronin-db. If not, see <https://www.gnu.org/licenses/>.
19
+ #
20
+
21
+ require 'ronin/db/cli/uri_methods'
22
+ require 'ronin/db'
23
+
24
+ module Ronin
25
+ module DB
26
+ class CLI
27
+ #
28
+ # Base class for all commands that access the database.
29
+ #
30
+ # @since 0.2.0
31
+ #
32
+ module DatabaseOptions
33
+ include URIMethods
34
+
35
+ #
36
+ # Adds the `--db`, `--db-uri`, and `--db-file` options to the command
37
+ # class including the {DatabaseOptions} module.
38
+ #
39
+ # @param [Class<Ronin::Core::CLI::Command>] command
40
+ # The command class including {DatabaseOptions}.
41
+ #
42
+ def self.included(command)
43
+ command.option :db, value: {
44
+ type: DB.config.keys,
45
+ default: :default,
46
+ usage: 'NAME'
47
+ },
48
+ desc: 'The database to connect to'
49
+
50
+ command.option :db_uri, value: {
51
+ type: String,
52
+ usage: 'URI'
53
+ },
54
+ desc: 'The database URI to connect to'
55
+
56
+ command.option :db_file, value: {
57
+ type: String,
58
+ usage: 'PATH'
59
+ },
60
+ desc: 'The sqlite3 database file to use'
61
+ end
62
+
63
+ #
64
+ # The database connection configuration.
65
+ #
66
+ # @return [Hash{Symbol => String,Integer}]
67
+ #
68
+ def db_config
69
+ if options[:db_file]
70
+ {sqlite3: normalize_sqlite3_path(options[:db_file])}
71
+ elsif options[:db_uri]
72
+ parse_uri(options[:db_uri])
73
+ else
74
+ DB.config[options[:db]]
75
+ end
76
+ end
77
+
78
+ #
79
+ # Connects to the database.
80
+ #
81
+ def db_connect
82
+ DB.connect(db_config)
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db - A common database library for managing and querying security data.
4
+ #
5
+ # Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # ronin-db is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU Lesser General Public License as published
9
+ # by the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # ronin-db is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public License
18
+ # along with ronin-db. If not, see <https://www.gnu.org/licenses/>.
19
+ #
20
+
21
+ module Ronin
22
+ module DB
23
+ class CLI
24
+ #
25
+ # Allows a {ModelCommand} to delete a single record or all records.
26
+ #
27
+ # @since 0.2.0
28
+ #
29
+ module Deletable
30
+ #
31
+ # Adds the `--delete` and `--delete-all` options to the command.
32
+ #
33
+ # @param [Class<ModelCommand>] command
34
+ # The command class including {Deletable}.
35
+ #
36
+ def self.included(command)
37
+ command.option :delete, value: {
38
+ type: String,
39
+ usage: 'VALUE'
40
+ },
41
+ desc: 'Deletes a value from the database'
42
+
43
+ command.option :delete_all, desc: 'Deletes all values from the database'
44
+ end
45
+
46
+ #
47
+ # Runs the command.
48
+ #
49
+ def run
50
+ if options[:delete]
51
+ db_connect
52
+ delete(options[:delete])
53
+ elsif options[:delete_all]
54
+ db_connect
55
+ delete_all
56
+ else
57
+ super
58
+ end
59
+ end
60
+
61
+ #
62
+ # Deletes a value from the database.
63
+ #
64
+ # @param [String] value
65
+ # The value to lookup and delete.
66
+ #
67
+ def delete(value)
68
+ if (record = model.lookup(value))
69
+ record.destroy
70
+ else
71
+ print_error "value does not exist in the database: #{value}"
72
+ exit(-1)
73
+ end
74
+ end
75
+
76
+ #
77
+ # Deletes all values from the database.
78
+ #
79
+ def delete_all
80
+ model.destroy_all
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db - A common database library for managing and querying security data.
4
+ #
5
+ # Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # ronin-db is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU Lesser General Public License as published
9
+ # by the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # ronin-db is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public License
18
+ # along with ronin-db. If not, see <https://www.gnu.org/licenses/>.
19
+ #
20
+
21
+ module Ronin
22
+ module DB
23
+ class CLI
24
+ #
25
+ # Allows a {ModelCommand} to add or import records from a file.
26
+ #
27
+ # @since 0.2.0
28
+ #
29
+ module Importable
30
+ #
31
+ # Adds the `--add` and `--import` options to the command.
32
+ #
33
+ # @param [Class<ModelCommand>] command
34
+ # The command class including {Importable}.
35
+ #
36
+ def self.included(command)
37
+ command.option :add, value: {
38
+ type: String,
39
+ usage: 'VALUE'
40
+ },
41
+ desc: 'Adds a value to the database'
42
+
43
+ command.option :import, value: {
44
+ type: String,
45
+ usage: 'FILE'
46
+ },
47
+ desc: 'Imports the values from the FILE into the database'
48
+ end
49
+
50
+ #
51
+ # Runs the command.
52
+ #
53
+ def run
54
+ if options[:add]
55
+ db_connect
56
+ add(options[:add])
57
+ elsif options[:import]
58
+ db_connect
59
+ import_file(options[:import])
60
+ else
61
+ super
62
+ end
63
+ end
64
+
65
+ #
66
+ # Adds a value to the database.
67
+ #
68
+ # @param [String] value
69
+ # The value to add.
70
+ #
71
+ def add(value)
72
+ record = model.import(value)
73
+
74
+ unless record.valid?
75
+ print_error "failed to import #{value}!"
76
+
77
+ record.errors.full_messages.each do |message|
78
+ print_error " - #{message}"
79
+ end
80
+ end
81
+ end
82
+
83
+ #
84
+ # Imports the values from the given file.
85
+ #
86
+ # @param [String] path
87
+ # The path to the file.
88
+ #
89
+ def import_file(path)
90
+ unless File.file?(path)
91
+ print_error "no such file or directory: #{path}"
92
+ exit(-1)
93
+ end
94
+
95
+ File.open(path) do |file|
96
+ model.transaction do
97
+ file.each_line(chomp: true) do |value|
98
+ log_info "Importing #{value} ..." if verbose?
99
+
100
+ add(value)
101
+ end
102
+ end
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ronin-db - A common database library for managing and querying security data.
4
4
  #
5
- # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-db is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -18,7 +18,8 @@
18
18
  # along with ronin-db. If not, see <https://www.gnu.org/licenses/>.
19
19
  #
20
20
 
21
- require 'ronin/db/cli/database_command'
21
+ require 'ronin/db/cli/command'
22
+ require 'ronin/db/cli/database_options'
22
23
  require 'ronin/core/cli/logging'
23
24
 
24
25
  require 'command_kit/options/verbose'
@@ -29,8 +30,9 @@ module Ronin
29
30
  #
30
31
  # A base-command for database models commands.
31
32
  #
32
- class ModelCommand < DatabaseCommand
33
+ class ModelCommand < Command
33
34
 
35
+ include DatabaseOptions
34
36
  include CommandKit::Options::Verbose
35
37
  include Core::CLI::Logging
36
38
 
@@ -112,16 +114,16 @@ module Ronin
112
114
  # Runs the command.
113
115
  #
114
116
  def run
115
- connect
117
+ db_connect
116
118
  list
117
119
  end
118
120
 
119
121
  #
120
122
  # Connects to the database.
121
123
  #
122
- def connect
124
+ def db_connect
123
125
  # connect to the database but do not load other models.
124
- DB.connect(config, load_models: false)
126
+ DB.connect(db_config, load_models: false)
125
127
 
126
128
  # load and connect the model
127
129
  model.connection