ronin-db 0.1.0.beta1-java

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 (74) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.github/workflows/ruby.yml +31 -0
  4. data/.gitignore +13 -0
  5. data/.rspec +1 -0
  6. data/.ruby-version +1 -0
  7. data/.yardopts +1 -0
  8. data/COPYING.txt +165 -0
  9. data/ChangeLog.md +12 -0
  10. data/Gemfile +39 -0
  11. data/README.md +272 -0
  12. data/Rakefile +76 -0
  13. data/bin/ronin-db +35 -0
  14. data/gemspec.yml +46 -0
  15. data/lib/ronin/db/cli/command.rb +37 -0
  16. data/lib/ronin/db/cli/commands/add.rb +206 -0
  17. data/lib/ronin/db/cli/commands/asn.rb +218 -0
  18. data/lib/ronin/db/cli/commands/creds.rb +80 -0
  19. data/lib/ronin/db/cli/commands/edit.rb +58 -0
  20. data/lib/ronin/db/cli/commands/emails.rb +90 -0
  21. data/lib/ronin/db/cli/commands/hosts.rb +100 -0
  22. data/lib/ronin/db/cli/commands/ips.rb +100 -0
  23. data/lib/ronin/db/cli/commands/irb.rb +81 -0
  24. data/lib/ronin/db/cli/commands/list.rb +124 -0
  25. data/lib/ronin/db/cli/commands/migrate.rb +75 -0
  26. data/lib/ronin/db/cli/commands/remove.rb +69 -0
  27. data/lib/ronin/db/cli/commands/urls.rb +170 -0
  28. data/lib/ronin/db/cli/database_command.rb +71 -0
  29. data/lib/ronin/db/cli/model_command.rb +202 -0
  30. data/lib/ronin/db/cli/modifiable.rb +141 -0
  31. data/lib/ronin/db/cli/resources_command.rb +120 -0
  32. data/lib/ronin/db/cli/ruby_shell.rb +51 -0
  33. data/lib/ronin/db/cli/uri_methods.rb +97 -0
  34. data/lib/ronin/db/cli.rb +38 -0
  35. data/lib/ronin/db/config_file.rb +132 -0
  36. data/lib/ronin/db/exceptions.rb +26 -0
  37. data/lib/ronin/db/home.rb +36 -0
  38. data/lib/ronin/db/root.rb +28 -0
  39. data/lib/ronin/db/version.rb +26 -0
  40. data/lib/ronin/db.rb +123 -0
  41. data/man/ronin-db-add.1 +99 -0
  42. data/man/ronin-db-add.1.md +75 -0
  43. data/man/ronin-db-asn.1 +79 -0
  44. data/man/ronin-db-asn.1.md +59 -0
  45. data/man/ronin-db-creds.1 +78 -0
  46. data/man/ronin-db-creds.1.md +58 -0
  47. data/man/ronin-db-edit.1 +48 -0
  48. data/man/ronin-db-edit.1.md +36 -0
  49. data/man/ronin-db-emails.1 +82 -0
  50. data/man/ronin-db-emails.1.md +61 -0
  51. data/man/ronin-db-hosts.1 +86 -0
  52. data/man/ronin-db-hosts.1.md +64 -0
  53. data/man/ronin-db-ips.1 +90 -0
  54. data/man/ronin-db-ips.1.md +67 -0
  55. data/man/ronin-db-irb.1 +61 -0
  56. data/man/ronin-db-irb.1.md +46 -0
  57. data/man/ronin-db-list.1 +58 -0
  58. data/man/ronin-db-list.1.md +44 -0
  59. data/man/ronin-db-migrate.1 +44 -0
  60. data/man/ronin-db-migrate.1.md +32 -0
  61. data/man/ronin-db-remove.1 +55 -0
  62. data/man/ronin-db-remove.1.md +42 -0
  63. data/man/ronin-db-urls.1 +98 -0
  64. data/man/ronin-db-urls.1.md +73 -0
  65. data/ronin-db.gemspec +78 -0
  66. data/spec/cli/commands/add_spec.rb +220 -0
  67. data/spec/cli/commands/edit_spec.rb +12 -0
  68. data/spec/cli/commands/irb_spec.rb +26 -0
  69. data/spec/cli/database_command_spec.rb +53 -0
  70. data/spec/cli/model_command_spec.rb +237 -0
  71. data/spec/cli/ruby_shell_spec.rb +14 -0
  72. data/spec/cli/uri_methods_spec.rb +190 -0
  73. data/spec/spec_helper.rb +15 -0
  74. metadata +200 -0
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db - A common database library for managing and querying security data.
4
+ #
5
+ # Copyright (c) 2006-2022 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
+ require 'ronin/db/cli/modifiable'
23
+
24
+ module Ronin
25
+ module DB
26
+ class CLI
27
+ module Commands
28
+ #
29
+ # Manages email addresses in the database.
30
+ #
31
+ # ## Usage
32
+ #
33
+ # ronin-db emails [options]
34
+ #
35
+ # ## Options
36
+ #
37
+ # --db NAME The database to connect to (Default: default)
38
+ # --db-uri URI The database URI to connect to
39
+ # -v, --verbose Enables verbose output
40
+ # --add VALUE Adds a value to the database
41
+ # --import FILE Imports the values from the FILE into the database
42
+ # --delete VALUE Deletes a value from the database
43
+ # --delete-all Deletes all values from the database
44
+ # -H, --with-host [HOST [...]]
45
+ # -I, --with-ip [IP [...]]
46
+ # -u, --with-user [NAME [...]]
47
+ #
48
+ class Emails < ModelCommand
49
+
50
+ include Modifiable
51
+
52
+ model_file 'ronin/db/email_address'
53
+ model_name 'EmailAddress'
54
+
55
+ option :with_host, short: '-H',
56
+ value: {
57
+ type: String,
58
+ usage: 'HOST'
59
+ },
60
+ desc: 'Searches for the associated HOST(s)' do |host|
61
+ @query_method_calls << [:with_host_name, [host]]
62
+ end
63
+
64
+ option :with_ip, short: '-I',
65
+ value: {
66
+ type: String,
67
+ usage: 'IP'
68
+ },
69
+ desc: 'Searches for the associated IP(s)' do |ip|
70
+ @query_method_calls << [:with_ip_address, [ip]]
71
+ end
72
+
73
+ option :with_user, short: '-u',
74
+ value: {
75
+ type: String,
76
+ usage: 'USER'
77
+ },
78
+ desc: 'Searches for the associated user name' do |user|
79
+ @query_method_calls << [:with_user_name, [user]]
80
+ end
81
+
82
+ description 'Manages all email addresses in the database'
83
+
84
+ man_page 'ronin-db-emails.1'
85
+
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db - A common database library for managing and querying security data.
4
+ #
5
+ # Copyright (c) 2006-2022 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
+ require 'ronin/db/cli/modifiable'
23
+
24
+ module Ronin
25
+ module DB
26
+ class CLI
27
+ module Commands
28
+ #
29
+ # Manages all host names in the database.
30
+ #
31
+ # ## Usage
32
+ #
33
+ # ronin-db hosts [options]
34
+ #
35
+ # ## Options
36
+ #
37
+ # --db NAME The database to connect to (Default: default)
38
+ # --db-uri URI The database URI to connect to
39
+ # -v, --verbose Enables verbose output
40
+ # --add VALUE Adds a value to the database
41
+ # --import FILE Imports the values from the FILE into the database
42
+ # --delete VALUE Deletes a value from the database
43
+ # --delete-all Deletes all values from the database
44
+ # -I, --with-ip [IP [...]]
45
+ # -p, --with-port [PORT [...]]
46
+ # -D, --domain [DOMAIN]
47
+ # -T, --tld [TLD]
48
+ #
49
+ class Hosts < ModelCommand
50
+
51
+ include Modifiable
52
+
53
+ model_file 'ronin/db/host_name'
54
+ model_name 'HostName'
55
+
56
+ option :with_ip, short: '-I',
57
+ value: {
58
+ type: String,
59
+ usage: 'IP'
60
+ },
61
+ desc: 'Searches for the associated IP(s)' do |ip|
62
+ @query_method_calls << [:with_ip_address, [ip]]
63
+ end
64
+
65
+ option :with_port, short: '-p',
66
+ value: {
67
+ type: Integer,
68
+ usage: 'PORT'
69
+ },
70
+ desc: 'Searches for the associated PORT(s)' do |port|
71
+ @query_method_calls << [:with_port_number, [port]]
72
+ end
73
+
74
+ option :domain, short: '-D',
75
+ value: {
76
+ type: String,
77
+ usage: 'DOMAIN'
78
+ },
79
+ desc: 'Searches for the associated parent DOMAIN' do |domain|
80
+ @query_method_calls << [:with_domain, [domain]]
81
+ end
82
+
83
+ option :tld, short: '-T',
84
+ value: {
85
+ type: String,
86
+ usage: 'TLD'
87
+ },
88
+ desc: 'Searches for the associated TLD' do |tld|
89
+ @query_method_calls << [:with_tld, [tld]]
90
+ end
91
+
92
+ description 'Manages HostNames'
93
+
94
+ man_page 'ronin-db-hosts.1'
95
+
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db - A common database library for managing and querying security data.
4
+ #
5
+ # Copyright (c) 2006-2022 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
+ require 'ronin/db/cli/modifiable'
23
+
24
+ module Ronin
25
+ module DB
26
+ class CLI
27
+ module Commands
28
+ #
29
+ # Manages {IPAddress IPAddresses}.
30
+ #
31
+ # ## Usage
32
+ #
33
+ # ronin ips [options]
34
+ #
35
+ # ## Options
36
+ #
37
+ # --db NAME The database to connect to (Default: default)
38
+ # --db-uri URI The database URI to connect to
39
+ # -v, --verbose Enables verbose output
40
+ # --add VALUE Adds a value to the database
41
+ # --import FILE Imports the values from the FILE into the database
42
+ # --delete VALUE Deletes a value from the database
43
+ # --delete-all Deletes all values from the database
44
+ # -4, --v4
45
+ # -6, --v6
46
+ # -p, --with-port PORT
47
+ # -M, --with-mac-addr MAC
48
+ # -H, --with-host HOST
49
+ #
50
+ class Ips < ModelCommand
51
+
52
+ include Modifiable
53
+
54
+ model_file 'ronin/db/ip_address'
55
+ model_name 'IPAddress'
56
+
57
+ option :v4, short: '-4',
58
+ desc: 'Searches for IPv4 addresses' do
59
+ @query_method_calls << :v4
60
+ end
61
+
62
+ option :v6, short: '-6',
63
+ desc: 'Searches for IPv6 addresses' do
64
+ @query_method_calls << :v6
65
+ end
66
+
67
+ option :with_port, short: '-p',
68
+ value: {
69
+ type: Integer,
70
+ usage: 'PORT'
71
+ },
72
+ desc: 'Searches for the associated PORT(s)' do |port|
73
+ @query_method_calls << [:with_port_number, [port]]
74
+ end
75
+
76
+ option :with_mac_addr, short: '-M',
77
+ value: {
78
+ type: String,
79
+ usage: 'MAC'
80
+ },
81
+ desc: 'Searches for the associated MAC address(es)' do |mac|
82
+ @query_method_calls << [:with_mac_address, [mac]]
83
+ end
84
+
85
+ option :with_host, short: '-H',
86
+ value: {
87
+ type: String,
88
+ usage: 'HOST'
89
+ },
90
+ desc: 'Searches for the associated HOST(s)' do |host|
91
+ @query_method_calls << [:with_host_name, [host]]
92
+ end
93
+
94
+ description 'Manages IP addresses'
95
+
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db - A common database library for managing and querying security data.
4
+ #
5
+ # Copyright (c) 2006-2022 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/database_command'
22
+ require 'ronin/db/cli/ruby_shell'
23
+
24
+ module Ronin
25
+ module DB
26
+ class CLI
27
+ module Commands
28
+ #
29
+ # Connects to a database and start an interactive Ruby shell.
30
+ #
31
+ # ## Usage
32
+ #
33
+ # ronin-db irb [options]
34
+ #
35
+ # ## Options
36
+ #
37
+ # --db NAME The database to connect to (Default: default)
38
+ # --db-uri URI The database URI to connect to
39
+ # --no-connect Do not connect to a database on startup
40
+ # -h, --help Print help information
41
+ #
42
+ class Irb < DatabaseCommand
43
+
44
+ option :no_connect, desc: 'Do not connect to a database on startup'
45
+
46
+ description "Connects to a database and start an interactive Ruby shell"
47
+
48
+ man_page 'ronin-db-irb.1'
49
+
50
+ #
51
+ # Starts the `ronin-db irb` command.
52
+ #
53
+ def run
54
+ unless options[:no_connect]
55
+ connect
56
+ load_models
57
+ end
58
+
59
+ set_logger
60
+
61
+ CLI::RubyShell.start
62
+ end
63
+
64
+ def set_logger
65
+ require 'logger'
66
+ DB.logger = Logger.new(stderr,:debug)
67
+ end
68
+
69
+ #
70
+ # Loads all models.
71
+ #
72
+ def load_models
73
+ require 'ronin/db/models'
74
+ Ronin::DB::Models.connect
75
+ end
76
+
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,124 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db - A common database library for managing and querying security data.
4
+ #
5
+ # Copyright (c) 2006-2022 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/command'
22
+ require 'ronin/db/config_file'
23
+
24
+ require 'command_kit/options/verbose'
25
+ require 'command_kit/printing'
26
+ require 'command_kit/printing/indent'
27
+ require 'command_kit/printing/fields'
28
+
29
+ module Ronin
30
+ module DB
31
+ class CLI
32
+ module Commands
33
+ #
34
+ # Lists entries in the `~/.config/ronin-db/database.yml` configuration
35
+ # file.
36
+ #
37
+ # ## Usage
38
+ #
39
+ # ronin-db list [options] [NAME]
40
+ #
41
+ # ## Options
42
+ #
43
+ # -v, --verbose Enables verbose output
44
+ # -h, --help Print help information
45
+ #
46
+ # ## Arguments
47
+ #
48
+ # [NAME] Optional DB name to list
49
+ #
50
+ class List < Command
51
+
52
+ include CommandKit::Options::Verbose
53
+ include CommandKit::Printing
54
+ include CommandKit::Printing::Indent
55
+ include CommandKit::Printing::Fields
56
+
57
+ usage '[options] [NAME]'
58
+
59
+ argument :name, required: false,
60
+ desc: 'Optional DB name to list'
61
+
62
+ description 'List the configured database(s)'
63
+
64
+ man_page 'ronin-db-list.1'
65
+
66
+ #
67
+ # Runs the `ronin-db list` command.
68
+ #
69
+ # @param [String, nil] name
70
+ # The optional database name to list.
71
+ #
72
+ def run(name=nil)
73
+ config = ConfigFile.load
74
+
75
+ if name
76
+ unless (hash = config[name.to_sym])
77
+ print_error "unknown database #{name.inspect}"
78
+ exit(1)
79
+ end
80
+
81
+ print_database(name,hash)
82
+ else
83
+ config.each do |name,hash|
84
+ if verbose?
85
+ print_database(name,hash)
86
+ puts
87
+ else
88
+ puts name
89
+ end
90
+ end
91
+ end
92
+ end
93
+
94
+ # Default hidden password placeholder.
95
+ HIDDEN_PASSWORD = '*******'
96
+
97
+ #
98
+ # Prints a specific entry in the `database.yml` file.
99
+ #
100
+ # @param [Symbol] name
101
+ # The database name.
102
+ #
103
+ # @param [Hash{Symbol => String,Integer}] hash
104
+ # The configuration hash for the database.
105
+ #
106
+ def print_database(name,hash)
107
+ puts "[ #{name} ]"
108
+ puts
109
+
110
+ if hash[:password]
111
+ # blank out the password by default
112
+ hash = hash.merge(password: HIDDEN_PASSWORD)
113
+ end
114
+
115
+ indent(2) do
116
+ print_fields(hash)
117
+ end
118
+ end
119
+
120
+ end
121
+ end
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db - A common database library for managing and querying security data.
4
+ #
5
+ # Copyright (c) 2006-2022 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/database_command'
22
+ require 'ronin/db'
23
+
24
+ module Ronin
25
+ module DB
26
+ class CLI
27
+ module Commands
28
+ #
29
+ # Runs database migrations.
30
+ #
31
+ # ## Usage
32
+ #
33
+ # ronin-db migrate [options]
34
+ #
35
+ # ## Options
36
+ #
37
+ # --db NAME The database to connect to (Default: default)
38
+ # --db-uri URI The database URI to connect to
39
+ # -h, --help Print help information
40
+ #
41
+ class Migrate < DatabaseCommand
42
+
43
+ usage '[options]'
44
+
45
+ description 'Runs database migrations'
46
+
47
+ man_page 'ronin-db-migrate.1'
48
+
49
+ #
50
+ # Runs the `ronin-db migrate` command.
51
+ #
52
+ def run
53
+ connect
54
+ migrate
55
+ end
56
+
57
+ #
58
+ # Connects to the database.
59
+ #
60
+ def connect
61
+ DB.connect(config, load_models: false)
62
+ end
63
+
64
+ #
65
+ # Runs migrations.
66
+ #
67
+ def migrate
68
+ DB.migrate!
69
+ end
70
+
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db - A common database library for managing and querying security data.
4
+ #
5
+ # Copyright (c) 2006-2022 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/command'
22
+ require 'ronin/db/config_file'
23
+
24
+ module Ronin
25
+ module DB
26
+ class CLI
27
+ module Commands
28
+ #
29
+ # Removes an entry from the `database.yml` config file.
30
+ #
31
+ # ## Usage
32
+ #
33
+ # ronin-db remove [options] NAME
34
+ #
35
+ # ## Options
36
+ #
37
+ # -h, --help Print help information
38
+ #
39
+ # ## Arguments
40
+ #
41
+ # NAME The DB name to remove
42
+ #
43
+ class Remove < Command
44
+
45
+ usage '[options] NAME'
46
+
47
+ argument :name, desc: 'The DB name to remove'
48
+
49
+ description 'Removed a database from the configuration file'
50
+
51
+ man_page 'ronin-db-remove.1'
52
+
53
+ #
54
+ # Runs the `ronin-db remove` command.
55
+ #
56
+ # @param [String] name
57
+ # The database name to remove.
58
+ #
59
+ def run(name)
60
+ ConfigFile.edit do |config|
61
+ config.delete(name.to_sym)
62
+ end
63
+ end
64
+
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end