ronin-db 0.1.0-java → 0.1.3-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.document +0 -1
  3. data/.github/workflows/ruby.yml +15 -1
  4. data/.rubocop.yml +16 -0
  5. data/ChangeLog.md +19 -1
  6. data/Gemfile +7 -3
  7. data/README.md +0 -1
  8. data/Rakefile +2 -3
  9. data/bin/ronin-db +6 -7
  10. data/lib/ronin/db/cli/command.rb +3 -0
  11. data/lib/ronin/db/cli/commands/asn.rb +1 -1
  12. data/lib/ronin/db/cli/commands/creds.rb +18 -18
  13. data/lib/ronin/db/cli/commands/migrate.rb +1 -1
  14. data/lib/ronin/db/cli/commands/urls.rb +6 -6
  15. data/lib/ronin/db/cli/resources_command.rb +0 -2
  16. data/lib/ronin/db/cli/uri_methods.rb +8 -3
  17. data/lib/ronin/db/cli.rb +5 -0
  18. data/lib/ronin/db/config_file.rb +14 -8
  19. data/lib/ronin/db/exceptions.rb +9 -0
  20. data/lib/ronin/db/version.rb +1 -1
  21. data/lib/ronin/db.rb +15 -1
  22. data/man/ronin-db-add.1 +45 -14
  23. data/man/ronin-db-add.1.md +30 -10
  24. data/man/ronin-db-asn.1 +37 -5
  25. data/man/ronin-db-asn.1.md +25 -3
  26. data/man/ronin-db-creds.1 +36 -18
  27. data/man/ronin-db-creds.1.md +27 -16
  28. data/man/ronin-db-edit.1 +21 -14
  29. data/man/ronin-db-edit.1.md +15 -10
  30. data/man/ronin-db-emails.1 +38 -20
  31. data/man/ronin-db-emails.1.md +28 -17
  32. data/man/ronin-db-hosts.1 +34 -16
  33. data/man/ronin-db-hosts.1.md +25 -14
  34. data/man/ronin-db-ips.1 +37 -19
  35. data/man/ronin-db-ips.1.md +28 -17
  36. data/man/ronin-db-irb.1 +30 -14
  37. data/man/ronin-db-irb.1.md +19 -10
  38. data/man/ronin-db-list.1 +21 -14
  39. data/man/ronin-db-list.1.md +15 -10
  40. data/man/ronin-db-migrate.1 +36 -3
  41. data/man/ronin-db-migrate.1.md +24 -1
  42. data/man/ronin-db-remove.1 +21 -14
  43. data/man/ronin-db-remove.1.md +15 -10
  44. data/man/ronin-db-urls.1 +39 -21
  45. data/man/ronin-db-urls.1.md +28 -17
  46. data/ronin-db.gemspec +4 -3
  47. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a1e34813d6e31800174b9bf80798e088fcf8c0cc26f49f480d28f5ab38c31a7
4
- data.tar.gz: e977959fce2b57e7563bf037d431ba9ed2a16cf4d7c8b4da04bb606fab80b62d
3
+ metadata.gz: 4f6e27ff78808feb23e2ecc4b6c312b2e399cea35f836b96bab022af31a46a9e
4
+ data.tar.gz: 610600e31740724b9ad1f41dd38e947229dde19f0d66d5abd7f16c033b472918
5
5
  SHA512:
6
- metadata.gz: da55ca64bf9f4a57972a7f657490b808ac77de8cc5b9dc5014942dd7a6be37bed29f2f9340520f4b4cf0068ed592cae87e340ee085a3772a8418a151fa12c083
7
- data.tar.gz: 752ec88041d604d14106bd14086cf3ca995621b58cbeb94fbe1a09f3ae52a481da96a7b056c72eb652971faac361580b294552db03ddaaff881bced2924722e7
6
+ metadata.gz: 60dc49d5d5e2acf6702f26e87ac033224563e8c8e542f37f8500f80c318afbcf08fbf77c3ad4bb8f13758fcb2cebbfe77a25d17a7d6cbde7caff716fcdc5c314
7
+ data.tar.gz: d8cda3a4d0d908de6f17df9f1d2af5a79d590c64c0f4e487a887198130bc095d56186ad61b31b799153f61d1e646ec810847204901580af153eddfdf992180c4
data/.document CHANGED
@@ -2,4 +2,3 @@ lib/**/*.rb
2
2
  -
3
3
  ChangeLog.md
4
4
  COPYING.txt
5
- man/*.md
@@ -16,7 +16,7 @@ jobs:
16
16
  - truffleruby
17
17
  name: Ruby ${{ matrix.ruby }}
18
18
  steps:
19
- - uses: actions/checkout@v2
19
+ - uses: actions/checkout@v4
20
20
  - name: Set up Ruby
21
21
  uses: ruby/setup-ruby@v1
22
22
  with:
@@ -30,3 +30,17 @@ jobs:
30
30
  run: bundle install --jobs 4 --retry 3
31
31
  - name: Run tests
32
32
  run: bundle exec rake test
33
+
34
+ # rubocop linting
35
+ rubocop:
36
+ runs-on: ubuntu-latest
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+ - name: Set up Ruby
40
+ uses: ruby/setup-ruby@v1
41
+ with:
42
+ ruby-version: 3.0
43
+ - name: Install dependencies
44
+ run: bundle install --jobs 4 --retry 3
45
+ - name: Run rubocop
46
+ run: bundle exec rubocop --parallel
data/.rubocop.yml ADDED
@@ -0,0 +1,16 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ SuggestExtensions: false
4
+ TargetRubyVersion: 3.1
5
+
6
+ inherit_gem:
7
+ rubocop-ronin: rubocop.yml
8
+
9
+ #
10
+ # ronin-db specific exceptions
11
+ #
12
+
13
+ # This looks like a rubocop bug.
14
+ Lint/ShadowingOuterLocalVariable:
15
+ Exclude:
16
+ - 'lib/ronin/db/cli/commands/list.rb'
data/ChangeLog.md CHANGED
@@ -1,4 +1,22 @@
1
- ### 0.1.0 / 2023-XX-XX
1
+ ### 0.1.3 / 2023-12-13
2
+
3
+ * Fixed a bug in {Ronin::DB::ConfigFile.edit} when `YAML::Store` would attempt
4
+ to create the config file but the parent directory did not exist yet.
5
+
6
+ ### 0.1.2 / 2023-09-19
7
+
8
+ * Fixed a typo in an exception message in {Ronin::DB.connect}.
9
+ * Documentation fixes and improvements.
10
+
11
+ ### 0.1.1 / 2023-06-09
12
+
13
+ #### CLI
14
+
15
+ * Fixed typos in the `ronin-db add` man-page.
16
+ * Fixed typos in the `ronin-db creds` man-page.
17
+ * Fixed formatting of man-pages.
18
+
19
+ ### 0.1.0 / 2023-02-01
2
20
 
3
21
  * Initial release:
4
22
  * Uses a [sqlite] database by default.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
@@ -8,11 +10,11 @@ gem 'jruby-openssl', '~> 0.7', platform: :jruby
8
10
  # branch: 'main'
9
11
 
10
12
  # Library dependencies
11
- # gem 'ronin-db-activerecord', '~> 0.1', github: "ronin-rb/ronin-db-activerecord",
13
+ # gem 'ronin-db-activerecord', '~> 0.1', github: 'ronin-rb/ronin-db-activerecord',
12
14
  # branch: 'main'
13
- # gem 'ronin-support', '~> 1.0', github: "ronin-rb/ronin-support",
15
+ # gem 'ronin-support', '~> 1.0', github: 'ronin-rb/ronin-support',
14
16
  # branch: '1.0.0'
15
- # gem 'ronin-core', '~> 0.1', github: "ronin-rb/ronin-core",
17
+ # gem 'ronin-core', '~> 0.1', github: 'ronin-rb/ronin-core',
16
18
  # branch: 'main'
17
19
 
18
20
  group :development do
@@ -31,4 +33,6 @@ group :development do
31
33
  gem 'dead_end', require: false
32
34
  gem 'sord', require: false, platform: :mri
33
35
  gem 'stackprof', require: false, platform: :mri
36
+ gem 'rubocop', require: false, platform: :mri
37
+ gem 'rubocop-ronin', require: false, platform: :mri
34
38
  end
data/README.md CHANGED
@@ -9,7 +9,6 @@
9
9
  * [Issues](https://github.com/ronin-rb/ronin-db/issues)
10
10
  * [Documentation](https://ronin-rb.dev/docs/ronin-db/frames)
11
11
  * [Discord](https://discord.gg/6WAb3PsVX9) |
12
- [Twitter](https://twitter.com/ronin_rb) |
13
12
  [Mastodon](https://infosec.exchange/@ronin_rb)
14
13
 
15
14
  ## Description
data/Rakefile CHANGED
@@ -1,11 +1,11 @@
1
- require 'rubygems'
1
+ # frozen_string_literal: true
2
2
 
3
3
  begin
4
4
  require 'bundler'
5
5
  rescue LoadError => e
6
6
  warn e.message
7
7
  warn "Run `gem install bundler` to install Bundler"
8
- exit -1
8
+ exit(-1)
9
9
  end
10
10
 
11
11
  begin
@@ -35,7 +35,6 @@ task :docs => :yara
35
35
  require 'kramdown/man/task'
36
36
  Kramdown::Man::Task.new
37
37
 
38
-
39
38
  directory 'db'
40
39
  file 'db/dev.sqlite3' => %w[db db:migrate]
41
40
 
data/bin/ronin-db CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
4
5
  #
@@ -21,13 +22,11 @@
21
22
  root = File.expand_path(File.join(__dir__,'..'))
22
23
  if File.file?(File.join(root,'Gemfile.lock'))
23
24
  Dir.chdir(root) do
24
- begin
25
- require 'bundler/setup'
26
- rescue LoadError => e
27
- warn e.message
28
- warn "Run `gem install bundler` to install Bundler"
29
- exit -1
30
- end
25
+ require 'bundler/setup'
26
+ rescue LoadError => e
27
+ warn e.message
28
+ warn "Run `gem install bundler` to install Bundler"
29
+ exit(-1)
31
30
  end
32
31
  end
33
32
 
@@ -25,6 +25,9 @@ require 'ronin/core/cli/command'
25
25
  module Ronin
26
26
  module DB
27
27
  class CLI
28
+ #
29
+ # Base class for all `ronin-db` commands.
30
+ #
28
31
  class Command < Core::CLI::Command
29
32
 
30
33
  man_dir File.join(ROOT,'man')
@@ -61,7 +61,7 @@ module Ronin
61
61
 
62
62
  option :number, short: '-n',
63
63
  value: {
64
- type: Integer,
64
+ type: Integer
65
65
  },
66
66
  desc: 'Searches for all ASN records with the AS number' do |number|
67
67
  @query_method_calls << [:with_number, [number]]
@@ -26,11 +26,11 @@ module Ronin
26
26
  class CLI
27
27
  module Commands
28
28
  #
29
- # Queries all credentials in the database.
29
+ # Manages all credentials in the database.
30
30
  #
31
31
  # ## Usage
32
32
  #
33
- # ronin creds [options]
33
+ # ronin-db creds [options]
34
34
  #
35
35
  # ## Options
36
36
  #
@@ -41,8 +41,8 @@ module Ronin
41
41
  # --import FILE Imports the values from the FILE into the database
42
42
  # --delete VALUE Deletes a value from the database
43
43
  # --delete-all Deletes all values from the database
44
- # -u, --user [USER] Username to search for.
45
- # -p, --password [PASS] Password to search for.
44
+ # -u, --for-user USER Username to search for
45
+ # -p, --with-password PASSWORD Password to search for
46
46
  #
47
47
  class Creds < ModelCommand
48
48
 
@@ -51,25 +51,25 @@ module Ronin
51
51
  model_file 'ronin/db/credential'
52
52
  model_name 'Credential'
53
53
 
54
- option :user, short: '-u',
55
- value: {
56
- type: String,
57
- usage: 'USER'
58
- },
59
- desc: 'Username to search for' do |user|
60
- @query_method_calls << [:for_user, [user]]
61
- end
62
-
63
- option :password, short: '-P',
54
+ option :for_user, short: '-u',
64
55
  value: {
65
56
  type: String,
66
- usage: 'PASSWORD'
57
+ usage: 'USER'
67
58
  },
68
- desc: 'Password to search for' do |password|
69
- @query_method_calls << [:with_password, [password]]
59
+ desc: 'Username to search for' do |user|
60
+ @query_method_calls << [:for_user, [user]]
70
61
  end
71
62
 
72
- description 'Queries all credentials in the database'
63
+ option :with_password, short: '-P',
64
+ value: {
65
+ type: String,
66
+ usage: 'PASSWORD'
67
+ },
68
+ desc: 'Password to search for' do |password|
69
+ @query_method_calls << [:with_password, [password]]
70
+ end
71
+
72
+ description 'Manages all credentials in the database'
73
73
 
74
74
  man_page 'ronin-db-creds.1'
75
75
 
@@ -37,7 +37,7 @@ module Ronin
37
37
  # --db NAME The database to connect to (Default: default)
38
38
  # --db-uri URI The database URI to connect to
39
39
  # -h, --help Print help information
40
- #
40
+ #
41
41
  class Migrate < DatabaseCommand
42
42
 
43
43
  usage '[options]'
@@ -122,7 +122,7 @@ module Ronin
122
122
  option :query_string, short: '-q',
123
123
  value: {
124
124
  type: String,
125
- usage: 'STRING',
125
+ usage: 'STRING'
126
126
  },
127
127
  desc: 'Searches for all URLs with the query string' do |string|
128
128
  @query_method_calls << [:where, [], {query: string}]
@@ -136,11 +136,11 @@ module Ronin
136
136
  desc: 'Searches for the associated query-param NAME(s)' do |string|
137
137
  name, value = string.split('=',2)
138
138
 
139
- if value
140
- @query_method_calls << [:with_query_param, [name, value]]
141
- else
142
- @query_method_calls << [:with_query_param_name, [name]]
143
- end
139
+ @query_method_calls << if value
140
+ [:with_query_param, [name, value]]
141
+ else
142
+ [:with_query_param_name, [name]]
143
+ end
144
144
  end
145
145
 
146
146
  option :with_query_param_name, value: {
@@ -60,8 +60,6 @@ module Ronin
60
60
  end
61
61
  end
62
62
 
63
- protected
64
-
65
63
  #
66
64
  # Sets the model used by the command.
67
65
  #
@@ -24,6 +24,10 @@ require 'ronin/db'
24
24
  module Ronin
25
25
  module DB
26
26
  class CLI
27
+ #
28
+ # Mixin which adds methods for parsing database URIs
29
+ # (ex: `sqlite3:path/to/db.sqlite3`).
30
+ #
27
31
  module URIMethods
28
32
  # Common database adapter names and their ActiveRecord equivalents.
29
33
  ADAPTER_ALIASES = {
@@ -57,8 +61,8 @@ module Ronin
57
61
  # The expanded path or `":memory:"` if the path was `":memory:"`.
58
62
  #
59
63
  def normalize_sqlite3_path(path)
60
- if path== ':memory:' then path
61
- else File.expand_path(path)
64
+ if path == ':memory:' then path
65
+ else File.expand_path(path)
62
66
  end
63
67
  end
64
68
 
@@ -72,7 +76,7 @@ module Ronin
72
76
  # The database configuration Hash.
73
77
  #
74
78
  def parse_uri(uri)
75
- if (match = uri.match(/\Asqlite[3]?:(.+)\z/))
79
+ if (match = uri.match(/\Asqlite(?:3)?:(.+)\z/))
76
80
  {
77
81
  adapter: 'sqlite3',
78
82
  database: normalize_sqlite3_path(match[1])
@@ -82,6 +86,7 @@ module Ronin
82
86
  adapter = normalize_adapter(uri.scheme)
83
87
 
84
88
  hash = {adapter: adapter}
89
+
85
90
  hash[:host] = uri.host if uri.host
86
91
  hash[:port] = uri.port if uri.port
87
92
  hash[:username] = uri.user if uri.user
data/lib/ronin/db/cli.rb CHANGED
@@ -26,6 +26,11 @@ require 'command_kit/options/version'
26
26
 
27
27
  module Ronin
28
28
  module DB
29
+ #
30
+ # The `ronin-db` command-line interface (CLI).
31
+ #
32
+ # @api private
33
+ #
29
34
  class CLI
30
35
 
31
36
  include CommandKit::Commands
@@ -21,6 +21,7 @@
21
21
  require 'ronin/db/exceptions'
22
22
  require 'ronin/db/home'
23
23
 
24
+ require 'fileutils'
24
25
  require 'yaml'
25
26
  require 'yaml/store'
26
27
 
@@ -35,7 +36,8 @@ module Ronin
35
36
  # Path to the `~/.config/ronin-db/databases.yml` configuration file.
36
37
  PATH = File.join(DB::Home::CONFIG_DIR,'databases.yml')
37
38
 
38
- # Path to the default sqlite3 database file.
39
+ # Path to the default sqlite3 database file
40
+ # (`~/.local/share/ronin-db/default.sqlite3`).
39
41
  DEFAULT_DB_FILE = File.join(DB::Home::LOCAL_SHARE_DIR,'default.sqlite3')
40
42
 
41
43
  # Default database configuration.
@@ -64,21 +66,21 @@ module Ronin
64
66
  #
65
67
  def self.validate(path,data)
66
68
  unless data.kind_of?(Hash)
67
- raise(InvalidConfig)
69
+ raise(InvalidConfig,"config data must be a Hash: #{data.inspect}")
68
70
  end
69
71
 
70
72
  data.each do |key,value|
71
- unless (key.kind_of?(Symbol) || key.kind_of?(String))
72
- raise(InvalidConfig)
73
+ unless key.kind_of?(Symbol)
74
+ raise(InvalidConfig,"all Hash keys must be a Symbol: #{key.inspect}")
73
75
  end
74
76
 
75
77
  unless value.kind_of?(Hash)
76
- raise(InvalidConfig)
78
+ raise(InvalidConfig,"all Hash values must also be a Hash: #{value.inspect}")
77
79
  end
78
80
 
79
81
  value.each_key do |sub_key|
80
- unless (sub_key.kind_of?(Symbol) || sub_key.kind_of?(String))
81
- raise(InvalidConfig)
82
+ unless sub_key.kind_of?(Symbol)
83
+ raise(InvalidConfig,"all sub-keys must be a Symbol: #{sub_key.inspect}")
82
84
  end
83
85
  end
84
86
  end
@@ -123,8 +125,12 @@ module Ronin
123
125
  # The loaded YAML configuration data.
124
126
  #
125
127
  def self.edit(path=PATH,&block)
126
- store = YAML::Store.new(path)
128
+ unless File.file?(path)
129
+ # create the parent directory for YAML::Store
130
+ FileUtils.mkdir_p(File.dirname(path))
131
+ end
127
132
 
133
+ store = YAML::Store.new(path)
128
134
  store.transaction(&block)
129
135
  end
130
136
  end
@@ -20,7 +20,16 @@
20
20
 
21
21
  module Ronin
22
22
  module DB
23
+ #
24
+ # Indicates that the given database name is not in the config file.
25
+ #
23
26
  class UnknownDatabase < RuntimeError
24
27
  end
28
+
29
+ #
30
+ # Indicates that the config file is corrupted.
31
+ #
32
+ class InvalidConfig < RuntimeError
33
+ end
25
34
  end
26
35
  end
@@ -21,6 +21,6 @@
21
21
  module Ronin
22
22
  module DB
23
23
  # ronin-db version
24
- VERSION = '0.1.0'
24
+ VERSION = '0.1.3'
25
25
  end
26
26
  end
data/lib/ronin/db.rb CHANGED
@@ -23,6 +23,9 @@ require 'ronin/db/config_file'
23
23
  require 'ronin/db/version'
24
24
 
25
25
  module Ronin
26
+ #
27
+ # Manages the Ronin database.
28
+ #
26
29
  module DB
27
30
  #
28
31
  # Sets up the Database logger.
@@ -83,8 +86,19 @@ module Ronin
83
86
  # Specifies whether to load all models or just connect to the database.
84
87
  #
85
88
  # @raise [UnknownDatabase]
89
+ # The database name was not listed in the config file.
86
90
  #
87
91
  # @raise [ArgumentError]
92
+ # The given database was not a Symbol or a Hash.
93
+ #
94
+ # @example Connect to the default database (`~/.local/share/ronin-db/default.sqlite3`):
95
+ # DB.connect
96
+ #
97
+ # @example Connect to a specific database from the configuration file (`~/.config/ronin-db/databases.yml`):
98
+ # DB.connect(:my_database)
99
+ #
100
+ # @example Connect to an arbitrary database:
101
+ # Db.connect({adapter: 'sqlite3', database: '/path/to/database.sqlite3'})
88
102
  #
89
103
  # @api semipublic
90
104
  #
@@ -97,7 +111,7 @@ module Ronin
97
111
  raise(UnknownDatabase,"unknown database: #{database.inspect}")
98
112
  end
99
113
  else
100
- raise(ArgumentError,"#{self.class}.#{__method__} only accepts a Symbol or a Hash")
114
+ raise(ArgumentError,"#{self}.#{__method__} only accepts a Symbol or a Hash")
101
115
  end
102
116
 
103
117
  # load activerecord
data/man/ronin-db-add.1 CHANGED
@@ -1,16 +1,17 @@
1
- .\" Generated by kramdown-man 0.1.8
1
+ .\" Generated by kramdown-man 0.1.9
2
2
  .\" https://github.com/postmodern/kramdown-man#readme
3
- .TH ronin-db-add 1 "2022-01-01" Ronin DB "User Manuals"
3
+ .TH ronin-db-add 1 "2023-02-01" Ronin DB "User Manuals"
4
4
  .LP
5
5
  .SH SYNOPSIS
6
6
  .LP
7
- .HP
7
+ .PP
8
8
  \fBronin-db add\fR \[lB]\fIoptions\fP\[rB] \fINAME\fP \[lB]\fIURI\fP\[rB]
9
9
  .LP
10
10
  .SH DESCRIPTION
11
11
  .LP
12
12
  .PP
13
- Lists entries in the \fB~/.config/ronin-db/database.yml\fR configuration file\.
13
+ Adds a pre\-existing database to the \fB~/.config/ronin-db/database.yml\fR
14
+ configuration file\.
14
15
  .LP
15
16
  .SH ARGUMENTS
16
17
  .LP
@@ -69,22 +70,52 @@ may be given instead\.
69
70
  \fB-h\fR, \fB--help\fR
70
71
  Print help information\.
71
72
  .LP
72
- .SH FILES
73
+ .SH EXAMPLES
73
74
  .LP
74
- .TP
75
- \fI\[ti]\[sl]\.config\[sl]ronin\-db\[sl]database\.yml\fP
76
- The \fBronin-db\fR database(s) configuration file\.
75
+ .PP
76
+ Add a sqlite3 database file:
77
77
  .LP
78
- .SH ENVIRONMENT
78
+ .nf
79
+ \[Do] ronin\-db add other\[ru]db \-\-sqlite3 path\[sl]to\[sl]db\.sqlite3
80
+ .fi
79
81
  .LP
80
82
  .PP
81
- HOME
82
- Specifies the home directory of the user\. Ronin will search for the
83
- \fI\[ti]\[sl]\.config\[sl]ronin\-db\fP cache directory within the home directory\.
83
+ Add a PostgeSQL database:
84
+ .LP
85
+ .nf
86
+ \[Do] ronin\-db add other\[ru]db \-\-postgres \-\-host example\.com \-\-port 5432 \-\-username ronin \-\-password s3r3t \-\-database ronin\[ru]db
87
+ .fi
84
88
  .LP
85
89
  .PP
86
- XDG\[ru]CONFIG\[ru]HOME
87
- Specifies the cache directory to use\. Defaults to \fI\[Do]HOME\[sl]\.config\fP\.
90
+ Add a MySQL database:
91
+ .LP
92
+ .nf
93
+ \[Do] ronin\-db add other\[ru]db \-\-mysql2 \-\-host example\.com \-\-port 3306 \-\-username ronin \-\-password s3r3t \-\-database ronin\[ru]db
94
+ .fi
95
+ .LP
96
+ .SH ENVIRONMENT
97
+ .LP
98
+ .TP
99
+ \fIHOME\fP
100
+ Alternate location for the user\[cq]s home directory\.
101
+ .LP
102
+ .TP
103
+ \fIXDG\[ru]CONFIG\[ru]HOME\fP
104
+ Alternate location for the \fB~/.config\fR directory\.
105
+ .LP
106
+ .TP
107
+ \fIXDG\[ru]DATA\[ru]HOME\fP
108
+ Alternate location for the \fB~/.local/share\fR directory\.
109
+ .LP
110
+ .SH FILES
111
+ .LP
112
+ .TP
113
+ \fB~/.local/share/ronin-db/database.sqlite3\fR
114
+ The default sqlite3 database file\.
115
+ .LP
116
+ .TP
117
+ \fB~/.config/ronin-db/database.yml\fR
118
+ Optional database configuration\.
88
119
  .LP
89
120
  .SH AUTHOR
90
121
  .LP
@@ -1,4 +1,4 @@
1
- # ronin-db-add 1 "2022-01-01" Ronin DB "User Manuals"
1
+ # ronin-db-add 1 "2023-02-01" Ronin DB "User Manuals"
2
2
 
3
3
  ## SYNOPSIS
4
4
 
@@ -6,7 +6,8 @@
6
6
 
7
7
  ## DESCRIPTION
8
8
 
9
- Lists entries in the `~/.config/ronin-db/database.yml` configuration file.
9
+ Adds a pre-existing database to the `~/.config/ronin-db/database.yml`
10
+ configuration file.
10
11
 
11
12
  ## ARGUMENTS
12
13
 
@@ -52,19 +53,38 @@ Lists entries in the `~/.config/ronin-db/database.yml` configuration file.
52
53
  `-h`, `--help`
53
54
  Print help information.
54
55
 
55
- ## FILES
56
+ ## EXAMPLES
57
+
58
+ Add a sqlite3 database file:
59
+
60
+ $ ronin-db add other_db --sqlite3 path/to/db.sqlite3
61
+
62
+ Add a PostgeSQL database:
63
+
64
+ $ ronin-db add other_db --postgres --host example.com --port 5432 --username ronin --password s3r3t --database ronin_db
65
+
66
+ Add a MySQL database:
56
67
 
57
- *~/.config/ronin-db/database.yml*
58
- The `ronin-db` database(s) configuration file.
68
+ $ ronin-db add other_db --mysql2 --host example.com --port 3306 --username ronin --password s3r3t --database ronin_db
59
69
 
60
70
  ## ENVIRONMENT
61
71
 
62
- HOME
63
- Specifies the home directory of the user. Ronin will search for the
64
- *~/.config/ronin-db* cache directory within the home directory.
72
+ *HOME*
73
+ Alternate location for the user's home directory.
74
+
75
+ *XDG_CONFIG_HOME*
76
+ Alternate location for the `~/.config` directory.
77
+
78
+ *XDG_DATA_HOME*
79
+ Alternate location for the `~/.local/share` directory.
80
+
81
+ ## FILES
82
+
83
+ `~/.local/share/ronin-db/database.sqlite3`
84
+ The default sqlite3 database file.
65
85
 
66
- XDG_CONFIG_HOME
67
- Specifies the cache directory to use. Defaults to *$HOME/.config*.
86
+ `~/.config/ronin-db/database.yml`
87
+ Optional database configuration.
68
88
 
69
89
  ## AUTHOR
70
90