ronin-db 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -0
  3. data/.gitignore +1 -0
  4. data/.ruby-version +1 -1
  5. data/ChangeLog.md +28 -0
  6. data/Gemfile +6 -4
  7. data/README.md +17 -5
  8. data/Rakefile +13 -35
  9. data/data/completions/ronin-db +271 -0
  10. data/gemspec.yml +17 -2
  11. data/lib/ronin/db/cli/command.rb +1 -1
  12. data/lib/ronin/db/cli/commands/add.rb +1 -1
  13. data/lib/ronin/db/cli/commands/asn.rb +12 -2
  14. data/lib/ronin/db/cli/commands/certs.rb +322 -0
  15. data/lib/ronin/db/cli/commands/completion.rb +63 -0
  16. data/lib/ronin/db/cli/commands/creds.rb +2 -1
  17. data/lib/ronin/db/cli/commands/edit.rb +1 -1
  18. data/lib/ronin/db/cli/commands/emails.rb +22 -1
  19. data/lib/ronin/db/cli/commands/hosts.rb +2 -1
  20. data/lib/ronin/db/cli/commands/ips.rb +2 -1
  21. data/lib/ronin/db/cli/commands/irb.rb +8 -4
  22. data/lib/ronin/db/cli/commands/list.rb +1 -1
  23. data/lib/ronin/db/cli/commands/migrate.rb +12 -8
  24. data/lib/ronin/db/cli/commands/open_ports.rb +102 -0
  25. data/lib/ronin/db/cli/commands/oses.rb +95 -0
  26. data/lib/ronin/db/cli/commands/passwords.rb +83 -0
  27. data/lib/ronin/db/cli/commands/people.rb +185 -0
  28. data/lib/ronin/db/cli/commands/phone_numbers.rb +136 -0
  29. data/lib/ronin/db/cli/commands/ports.rb +103 -0
  30. data/lib/ronin/db/cli/commands/remove.rb +1 -1
  31. data/lib/ronin/db/cli/commands/services.rb +102 -0
  32. data/lib/ronin/db/cli/commands/software.rb +95 -0
  33. data/lib/ronin/db/cli/commands/street_addresses.rb +129 -0
  34. data/lib/ronin/db/cli/commands/urls.rb +2 -1
  35. data/lib/ronin/db/cli/commands/web_vulns.rb +235 -0
  36. data/lib/ronin/db/cli/database_options.rb +87 -0
  37. data/lib/ronin/db/cli/deletable.rb +85 -0
  38. data/lib/ronin/db/cli/importable.rb +108 -0
  39. data/lib/ronin/db/cli/model_command.rb +8 -6
  40. data/lib/ronin/db/cli/modifiable.rb +12 -104
  41. data/lib/ronin/db/cli/printing.rb +58 -0
  42. data/lib/ronin/db/cli/ruby_shell.rb +1 -1
  43. data/lib/ronin/db/cli/uri_methods.rb +1 -1
  44. data/lib/ronin/db/cli.rb +5 -1
  45. data/lib/ronin/db/config_file.rb +1 -1
  46. data/lib/ronin/db/exceptions.rb +1 -1
  47. data/lib/ronin/db/home.rb +1 -1
  48. data/lib/ronin/db/root.rb +1 -1
  49. data/lib/ronin/db/tasks.rb +87 -0
  50. data/lib/ronin/db/version.rb +2 -2
  51. data/lib/ronin/db.rb +15 -7
  52. data/man/ronin-db-add.1 +47 -69
  53. data/man/ronin-db-add.1.md +26 -22
  54. data/man/ronin-db-asn.1 +36 -54
  55. data/man/ronin-db-asn.1.md +29 -19
  56. data/man/ronin-db-certs.1 +108 -0
  57. data/man/ronin-db-certs.1.md +106 -0
  58. data/man/ronin-db-completion.1 +76 -0
  59. data/man/ronin-db-completion.1.md +78 -0
  60. data/man/ronin-db-creds.1 +28 -46
  61. data/man/ronin-db-creds.1.md +23 -16
  62. data/man/ronin-db-edit.1 +15 -26
  63. data/man/ronin-db-edit.1.md +11 -7
  64. data/man/ronin-db-emails.1 +36 -49
  65. data/man/ronin-db-emails.1.md +30 -17
  66. data/man/ronin-db-hosts.1 +31 -51
  67. data/man/ronin-db-hosts.1.md +25 -18
  68. data/man/ronin-db-ips.1 +31 -52
  69. data/man/ronin-db-ips.1.md +26 -19
  70. data/man/ronin-db-irb.1 +22 -35
  71. data/man/ronin-db-irb.1.md +17 -10
  72. data/man/ronin-db-list.1 +16 -30
  73. data/man/ronin-db-list.1.md +13 -9
  74. data/man/ronin-db-migrate.1 +22 -35
  75. data/man/ronin-db-migrate.1.md +17 -10
  76. data/man/ronin-db-open-ports.1 +72 -0
  77. data/man/ronin-db-open-ports.1.md +70 -0
  78. data/man/ronin-db-oses.1 +72 -0
  79. data/man/ronin-db-oses.1.md +70 -0
  80. data/man/ronin-db-passwords.1 +75 -0
  81. data/man/ronin-db-passwords.1.md +73 -0
  82. data/man/ronin-db-people.1 +96 -0
  83. data/man/ronin-db-people.1.md +94 -0
  84. data/man/ronin-db-phone-numbers.1 +93 -0
  85. data/man/ronin-db-phone-numbers.1.md +91 -0
  86. data/man/ronin-db-ports.1 +87 -0
  87. data/man/ronin-db-ports.1.md +85 -0
  88. data/man/ronin-db-remove.1 +15 -28
  89. data/man/ronin-db-remove.1.md +12 -8
  90. data/man/ronin-db-services.1 +84 -0
  91. data/man/ronin-db-services.1.md +82 -0
  92. data/man/ronin-db-software.1 +72 -0
  93. data/man/ronin-db-software.1.md +70 -0
  94. data/man/ronin-db-street-addresses.1 +81 -0
  95. data/man/ronin-db-street-addresses.1.md +79 -0
  96. data/man/ronin-db-urls.1 +37 -60
  97. data/man/ronin-db-urls.1.md +28 -21
  98. data/man/ronin-db-web-vulns.1 +87 -0
  99. data/man/ronin-db-web-vulns.1.md +85 -0
  100. data/man/ronin-db.1 +118 -0
  101. data/man/ronin-db.1.md +99 -0
  102. data/scripts/setup +58 -0
  103. metadata +52 -9
  104. data/lib/ronin/db/cli/database_command.rb +0 -71
  105. data/lib/ronin/db/cli/resources_command.rb +0 -118
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e887e863b916cfbb31dcccf48adfb04ed662e5ecc8012e749d6389f1b9149a5a
4
- data.tar.gz: 698d79788a12a30cd7fd03d9295d76dfe98e12911aef13d4a830f35c1a99ac29
3
+ metadata.gz: 8e1b111bf10b19e01b6123eb96e1605bdd562b889f4535f8f103deb231f6094d
4
+ data.tar.gz: b157e16ce8d3ef566b84efa3b9e77aa025936d89f83cba1e086f2be8ecbd237e
5
5
  SHA512:
6
- metadata.gz: 655172b999161aeec34794d90fd279e8d468e280a67b07f1db03f3659facedc99ad053c508e9245e40bb6623fae792cec2f241a476ece1fe178bbcd75674c198
7
- data.tar.gz: 21e77b67c29ed5cc37aea7888d80b0547375eb7140bf1491283789750505ef35344bd53b185aef251b36a7186cb33001aa849728b2c6f13cb3a618b3ba916448
6
+ metadata.gz: a8f6c9c84ae1cba6b06a2f915e65c46582c4965beceadd2762dbface8ede9a5cb18c495c94a3646dbf28b5cede20598d7b1e936c6b4165a5fb94991526ff374e
7
+ data.tar.gz: 1b7ad99e38d10b0fc0e3b267b4120aba53b214a51a19b6de29e387ffc00da499211d14146c5281a8dfbb5e3f69f98966058efc7ab36f3fcbfa63d25dbf628bf0
@@ -12,6 +12,7 @@ jobs:
12
12
  - '3.0'
13
13
  - '3.1'
14
14
  - '3.2'
15
+ - '3.3'
15
16
  - jruby
16
17
  - truffleruby
17
18
  name: Ruby ${{ matrix.ruby }}
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  /coverage
2
+ /data/completions/ronin-db
2
3
  /doc
3
4
  /pkg
4
5
  /man/*.[1-9]
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-3.1
1
+ ruby-3.3
data/ChangeLog.md CHANGED
@@ -1,3 +1,31 @@
1
+ ### 0.2.0 / 2024-07-22
2
+
3
+ * Require [ronin-db-activerecord] ~> 0.2.
4
+ * Added {Ronin::DB::Tasks}.
5
+ * Added the `pool:` keyword argument to {Ronin::DB.connect}.
6
+ * Allow {Ronin::DB.connect} to accept a String URL.
7
+
8
+ #### CLI
9
+
10
+ * Added the `--db-file` option to all `ronin-db` commands.
11
+ * Added the `ronin-db completion` command to install shell completion files for
12
+ all `ronin-db` commands for Bash and Zsh shells.
13
+ * Added the `ronin-db ports` command.
14
+ * Added the `ronin-db open-ports` command.
15
+ * Added the `ronin-db services` command.
16
+ * Added the `ronin-db oses` command.
17
+ * Added the `ronin-db software` command.
18
+ * Added the `ronin-db certs` command.
19
+ * Added the `ronin-db passwords` command.
20
+ * Added the `ronin-db people` command.
21
+ * Added the `ronin-db street-addresses` command.
22
+ * Added the `ronin-db phone-numbers` command.
23
+ * Added the `ronin-db web-vulns` command.
24
+ * Added the `--named` option to the `ronin-db asn` command.
25
+ * Added the `--for-person` option to the `ronin-db emails` command.
26
+ * Added the `--for-organization` option to the `ronin-db emails` command.
27
+ * Alias `ronin-db console` to `ronin-db irb`.
28
+
1
29
  ### 0.1.3 / 2023-12-13
2
30
 
3
31
  * Fixed a bug in {Ronin::DB::ConfigFile.edit} when `YAML::Store` would attempt
data/Gemfile CHANGED
@@ -6,15 +6,15 @@ gemspec
6
6
 
7
7
  gem 'jruby-openssl', '~> 0.7', platform: :jruby
8
8
 
9
- # gem 'command_kit', '0.4.0', github: 'postmodern/command_kit',
9
+ # gem 'command_kit', '0.5.0', github: 'postmodern/command_kit',
10
10
  # branch: 'main'
11
11
 
12
12
  # Library dependencies
13
- # gem 'ronin-db-activerecord', '~> 0.1', github: 'ronin-rb/ronin-db-activerecord',
13
+ # gem 'ronin-db-activerecord', '~> 0.2', github: 'ronin-rb/ronin-db-activerecord',
14
14
  # branch: 'main'
15
15
  # gem 'ronin-support', '~> 1.0', github: 'ronin-rb/ronin-support',
16
16
  # branch: '1.0.0'
17
- # gem 'ronin-core', '~> 0.1', github: 'ronin-rb/ronin-core',
17
+ # gem 'ronin-core', '~> 0.2', github: 'ronin-rb/ronin-core',
18
18
  # branch: 'main'
19
19
 
20
20
  group :development do
@@ -24,7 +24,7 @@ group :development do
24
24
  gem 'simplecov', '~> 0.20'
25
25
 
26
26
  gem 'kramdown', '~> 2.0'
27
- gem 'kramdown-man', '~> 0.1'
27
+ gem 'kramdown-man', '~> 1.0'
28
28
 
29
29
  gem 'redcarpet', platform: :mri
30
30
  gem 'yard', '~> 0.9'
@@ -35,4 +35,6 @@ group :development do
35
35
  gem 'stackprof', require: false, platform: :mri
36
36
  gem 'rubocop', require: false, platform: :mri
37
37
  gem 'rubocop-ronin', require: false, platform: :mri
38
+
39
+ gem 'command_kit-completion', '~> 0.2', require: false
38
40
  end
data/README.md CHANGED
@@ -46,17 +46,29 @@ Arguments:
46
46
  Commands:
47
47
  add
48
48
  asn
49
+ certs
50
+ completion
49
51
  creds
50
52
  edit
51
53
  emails
52
54
  help
53
55
  hosts
54
56
  ips
55
- irb
57
+ irb, console
56
58
  list
57
59
  migrate
60
+ open-ports
61
+ oses
62
+ passwords
63
+ people
64
+ phone-numbers
65
+ ports
58
66
  remove
67
+ services
68
+ software
69
+ street-addresses
59
70
  urls
71
+ web-vulns
60
72
  ```
61
73
 
62
74
  List available Databases:
@@ -207,9 +219,9 @@ and [ronin-db-activerecord].
207
219
  * [libsqlite3][sqlite]
208
220
  * [sqlite3][sqlite3]
209
221
  (or [activerecord-jdbcsqlite3-adapter] ~> 70.0 on JRuby)
210
- * [ronin-db-activerecord] ~> 0.1
222
+ * [ronin-db-activerecord] ~> 0.2
211
223
  * [ronin-support] ~> 1.0
212
- * [ronin-core] ~> 0.1
224
+ * [ronin-core] ~> 0.2
213
225
 
214
226
  ## Install
215
227
 
@@ -234,7 +246,7 @@ gem.add_dependency 'ronin-db', '~> 0.1'
234
246
  1. [Fork It!](https://github.com/ronin-rb/ronin-db/fork)
235
247
  2. Clone It!
236
248
  3. `cd ronin-db`
237
- 4. `bundle install`
249
+ 4. `./scripts/setup`
238
250
  5. `git checkout -b my_feature`
239
251
  6. Code It!
240
252
  7. `bundle exec rake spec`
@@ -245,7 +257,7 @@ local database console.
245
257
 
246
258
  ## License
247
259
 
248
- Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
260
+ Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
249
261
 
250
262
  ronin-db is free software: you can redistribute it and/or modify
251
263
  it under the terms of the GNU Lesser General Public License as published
data/Rakefile CHANGED
@@ -38,38 +38,16 @@ Kramdown::Man::Task.new
38
38
  directory 'db'
39
39
  file 'db/dev.sqlite3' => %w[db db:migrate]
40
40
 
41
- namespace :db do
42
- task :connect do
43
- require 'active_record'
44
- ActiveRecord::Base.establish_connection(
45
- adapter: 'sqlite3',
46
- database: 'db/dev.sqlite3'
47
- )
48
- end
49
-
50
- desc 'Migrates the development database'
51
- task :migrate => :connect do
52
- require 'ronin/db/migrations'
53
- Ronin::DB::Migrations.up
54
- end
55
-
56
- desc 'Starts an interactive database console'
57
- task :console => 'db/dev.sqlite3' do
58
- require 'active_record'
59
- ActiveRecord::Base.logger = Logger.new($stderr,:debug)
60
-
61
- ActiveRecord::Base.establish_connection(
62
- adapter: 'sqlite3',
63
- database: 'db/dev.sqlite3'
64
- )
65
-
66
- require 'ronin/db/models'
67
- Ronin::DB::Models.connect
68
-
69
- lib_dir = File.expand_path('lib')
70
- $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
71
-
72
- require 'ronin/db/cli/ruby_shell'
73
- Ronin::DB::CLI::RubyShell.start
74
- end
75
- end
41
+ require 'ronin/db/tasks'
42
+ Ronin::DB::Tasks.new(database: {adapter: 'sqlite3', database: 'db/dev.sqlite3'})
43
+ file 'db/dev.sqlite3' => 'db:migrate'
44
+ task 'db:console' => 'db/dev.sqlite3'
45
+
46
+ require 'command_kit/completion/task'
47
+ CommandKit::Completion::Task.new(
48
+ class_file: 'ronin/db/cli',
49
+ class_name: 'Ronin::DB::CLI',
50
+ output_file: 'data/completions/ronin-db'
51
+ )
52
+
53
+ task :setup => %w[man command_kit:completion]
@@ -0,0 +1,271 @@
1
+ # ronin-db completion -*- shell-script -*-
2
+
3
+ # This bash completions script was generated by
4
+ # completely (https://github.com/dannyben/completely)
5
+ # Modifying it manually is not recommended
6
+
7
+ _ronin-db_completions_filter() {
8
+ local words="$1"
9
+ local cur=${COMP_WORDS[COMP_CWORD]}
10
+ local result=()
11
+
12
+ if [[ "${cur:0:1}" == "-" ]]; then
13
+ echo "$words"
14
+
15
+ else
16
+ for word in $words; do
17
+ [[ "${word:0:1}" != "-" ]] && result+=("$word")
18
+ done
19
+
20
+ echo "${result[*]}"
21
+
22
+ fi
23
+ }
24
+
25
+ _ronin-db_completions() {
26
+ local cur=${COMP_WORDS[COMP_CWORD]}
27
+ local compwords=("${COMP_WORDS[@]:1:$COMP_CWORD-1}")
28
+ local compline="${compwords[*]}"
29
+
30
+ case "$compline" in
31
+ 'certs'*'--subject-alt-name')
32
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A hostname -- "$cur")
33
+ ;;
34
+
35
+ 'phone-numbers'*'--import')
36
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")
37
+ ;;
38
+
39
+ 'web-vulns'*'--for-host')
40
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A hostname -- "$cur")
41
+ ;;
42
+
43
+ 'passwords'*'--for-user')
44
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A user -- "$cur")
45
+ ;;
46
+
47
+ 'certs'*'--common-name')
48
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A hostname -- "$cur")
49
+ ;;
50
+
51
+ 'emails'*'--with-user')
52
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A user -- "$cur")
53
+ ;;
54
+
55
+ 'emails'*'--with-host')
56
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A hostname -- "$cur")
57
+ ;;
58
+
59
+ 'passwords'*'--import')
60
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")
61
+ ;;
62
+
63
+ 'services'*'--import')
64
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")
65
+ ;;
66
+
67
+ 'urls'*'--directory')
68
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -- "$cur")
69
+ ;;
70
+
71
+ 'street-addresses'*)
72
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --for-person -P --for-organization -O --with-address -a --with-city -c --with-state -s --with-country -C --with-zipcode -z")" -- "$cur")
73
+ ;;
74
+
75
+ 'creds'*'--for-user')
76
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A user -- "$cur")
77
+ ;;
78
+
79
+ 'ips'*'--with-host')
80
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A hostname -- "$cur")
81
+ ;;
82
+
83
+ 'emails'*'--import')
84
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")
85
+ ;;
86
+
87
+ 'people'*'--import')
88
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")
89
+ ;;
90
+
91
+ 'creds'*'--import')
92
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")
93
+ ;;
94
+
95
+ 'hosts'*'--import')
96
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")
97
+ ;;
98
+
99
+ 'certs'*'--import')
100
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")
101
+ ;;
102
+
103
+ 'ports'*'--import')
104
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")
105
+ ;;
106
+
107
+ 'add'*'--username')
108
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A user -- "$cur")
109
+ ;;
110
+
111
+ 'phone-numbers'*)
112
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --delete --delete-all --add --import --for-person -P --for-organization -O --with-country-code -c --with-area-code -a --with-prefix -p --with-line-number -l --similar-to -S")" -- "$cur")
113
+ ;;
114
+
115
+ 'urls'*'--import')
116
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")
117
+ ;;
118
+
119
+ 'add'*'--sqlite3')
120
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")
121
+ ;;
122
+
123
+ 'passwords'*'-u')
124
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A user -- "$cur")
125
+ ;;
126
+
127
+ 'ips'*'--import')
128
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")
129
+ ;;
130
+
131
+ 'web-vulns'*'-H')
132
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A hostname -- "$cur")
133
+ ;;
134
+
135
+ 'urls'*'--host')
136
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A hostname -- "$cur")
137
+ ;;
138
+
139
+ 'asn'*'--file')
140
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")
141
+ ;;
142
+
143
+ 'completion'*)
144
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--print --install --uninstall")" -- "$cur")
145
+ ;;
146
+
147
+ 'open-ports'*)
148
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --with-port -p --with-protocol -P --with-service -S --with-ip -I")" -- "$cur")
149
+ ;;
150
+
151
+ 'add'*'--host')
152
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A hostname -- "$cur")
153
+ ;;
154
+
155
+ 'passwords'*)
156
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --delete --delete-all --add --import --for-user -u --with-email -e")" -- "$cur")
157
+ ;;
158
+
159
+ 'emails'*'-H')
160
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A hostname -- "$cur")
161
+ ;;
162
+
163
+ 'emails'*'-u')
164
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A user -- "$cur")
165
+ ;;
166
+
167
+ 'web-vulns'*)
168
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --with-type -t --for-host -H --for-domain -d --for-path -p --with-query-param -q --with-header-name --with-cookie-param -c --with-form-param -f --with-request-method -M")" -- "$cur")
169
+ ;;
170
+
171
+ 'creds'*'-u')
172
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A user -- "$cur")
173
+ ;;
174
+
175
+ 'software'*)
176
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --name -N --named --version -V --vendor")" -- "$cur")
177
+ ;;
178
+
179
+ 'services'*)
180
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --delete --delete-all --add --import --named --with-port -p --with-protocol -P --with-ip -I")" -- "$cur")
181
+ ;;
182
+
183
+ 'urls'*'-H')
184
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A hostname -- "$cur")
185
+ ;;
186
+
187
+ 'migrate'*)
188
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file")" -- "$cur")
189
+ ;;
190
+
191
+ 'urls'*'-d')
192
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -- "$cur")
193
+ ;;
194
+
195
+ 'ips'*'-H')
196
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A hostname -- "$cur")
197
+ ;;
198
+
199
+ 'emails'*)
200
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --delete --delete-all --add --import --with-host -H --with-ip -I --with-user -u --for-person -P --for-organization -O")" -- "$cur")
201
+ ;;
202
+
203
+ 'add'*'-H')
204
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A hostname -- "$cur")
205
+ ;;
206
+
207
+ 'people'*)
208
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --delete --delete-all --add --import --for-address -a --for-city -c --for-state -s --for-province -p --for-zipcode -z --for-country -C --with-prefix -P --with-first-name -f --with-middle-name -m --with-middle-initial -M --with-last-name -l --with-suffix -S")" -- "$cur")
209
+ ;;
210
+
211
+ 'add'*'-u')
212
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A user -- "$cur")
213
+ ;;
214
+
215
+ 'asn'*'-f')
216
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -- "$cur")
217
+ ;;
218
+
219
+ 'ports'*)
220
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --delete --delete-all --add --import --number -N --with-protocol -P --with-service -S --with-ip -I")" -- "$cur")
221
+ ;;
222
+
223
+ 'certs'*)
224
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --active -A --expired -E --issuer-common-name --issuer-organization --issuer-organizational-unit --issuer-locality --issuer-state --issuer-country --common-name --subject-alt-name --organization --organizational-unit --locality --state --country --import")" -- "$cur")
225
+ ;;
226
+
227
+ 'creds'*)
228
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --delete --delete-all --add --import --for-user -u --with-password -P")" -- "$cur")
229
+ ;;
230
+
231
+ 'hosts'*)
232
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --delete --delete-all --add --import --with-ip -I --with-port -p --domain -D --tld -T")" -- "$cur")
233
+ ;;
234
+
235
+ 'urls'*)
236
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --delete --delete-all --add --import --http --https --host -H --port -p --path --fragment --directory -d --with-ext -E --query-string -q --with-query-param -P --with-query-param-name --with-query-param-value")" -- "$cur")
237
+ ;;
238
+
239
+ 'oses'*)
240
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --name -N --named --flavor -F --version -V")" -- "$cur")
241
+ ;;
242
+
243
+ 'list'*)
244
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--verbose -v")" -- "$cur")
245
+ ;;
246
+
247
+ 'asn'*)
248
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --number -n --country-code -C --name -N --named --ip -I --ipv4 -4 --ipv6 -6 --update -u --url -U --file -f")" -- "$cur")
249
+ ;;
250
+
251
+ 'irb'*)
252
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --no-connect")" -- "$cur")
253
+ ;;
254
+
255
+ 'ips'*)
256
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --verbose -v --delete --delete-all --add --import --v4 -4 --v6 -6 --with-port -p --with-mac-addr -M --with-host -H")" -- "$cur")
257
+ ;;
258
+
259
+ 'add'*)
260
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--adapter -A --sqlite3 --mysql2 --postgresql --host -H --port -p --username -u --password -P --read-password --database -D")" -- "$cur")
261
+ ;;
262
+
263
+ *)
264
+ while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_ronin-db_completions_filter "--version -V help add asn certs completion creds edit emails hosts ips irb list migrate open-ports oses passwords people phone-numbers ports remove services software street-addresses urls web-vulns console")" -- "$cur")
265
+ ;;
266
+
267
+ esac
268
+ } &&
269
+ complete -F _ronin-db_completions ronin-db
270
+
271
+ # ex: filetype=sh
data/gemspec.yml CHANGED
@@ -21,8 +21,12 @@ metadata:
21
21
  rubygems_mfa_required: 'true'
22
22
 
23
23
  generated_files:
24
+ - data/completions/ronin-db
25
+ - man/ronin-db.1
24
26
  - man/ronin-db-add.1
25
27
  - man/ronin-db-asn.1
28
+ - man/ronin-db-certs.1
29
+ - man/ronin-db-completion.1
26
30
  - man/ronin-db-creds.1
27
31
  - man/ronin-db-emails.1
28
32
  - man/ronin-db-hosts.1
@@ -32,8 +36,18 @@ generated_files:
32
36
  - man/ronin-db-irb.1
33
37
  - man/ronin-db-list.1
34
38
  - man/ronin-db-migrate.1
39
+ - man/ronin-db-open-ports.1
40
+ - man/ronin-db-oses.1
41
+ - man/ronin-db-passwords.1
42
+ - man/ronin-db-people.1
43
+ - man/ronin-db-phone-numbers.1
44
+ - man/ronin-db-ports.1
35
45
  - man/ronin-db-remove.1
46
+ - man/ronin-db-services.1
47
+ - man/ronin-db-software.1
48
+ - man/ronin-db-street-addresses.1
36
49
  - man/ronin-db-urls.1
50
+ - man/ronin-db-web-vulns.1
37
51
 
38
52
  required_ruby_version: ">= 3.0.0"
39
53
 
@@ -42,12 +56,13 @@ ruby_dependencies:
42
56
 
43
57
  jruby_dependencies:
44
58
  activerecord-jdbcsqlite3-adapter: ~> 70.0
59
+ activerecord: < 7.1.0
45
60
 
46
61
  dependencies:
47
62
  # Ronin dependencies:
48
- ronin-db-activerecord: ~> 0.1
63
+ ronin-db-activerecord: ~> 0.2
49
64
  ronin-support: ~> 1.0
50
- ronin-core: ~> 0.1
65
+ ronin-core: ~> 0.2
51
66
 
52
67
  development_dependencies:
53
68
  bundler: ~> 2.0
@@ -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
@@ -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
@@ -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
@@ -39,11 +39,13 @@ module Ronin
39
39
  #
40
40
  # --db NAME The database to connect to (Default: default)
41
41
  # --db-uri URI The database URI to connect to
42
+ # --db-file PATH The sqlite3 database file to use
42
43
  # -v, --verbose Enables verbose output
43
44
  # -n, --number INT Searches for all ASN records with the AS number
44
45
  # -C XX|None|Unknown, Searches for all ASN records with the country code
45
46
  # --country-code
46
47
  # -N, --name NAME Searches for all ASN records with the matching name
48
+ # --named NAME Searches for all ASN records containing the name
47
49
  # -I, --ip IP Queries the ASN record for the IP
48
50
  # -4, --ipv4 Filter ASN records for only IPv4 ranges
49
51
  # -6, --ipv6 Filter ASN records for only IPv6 ranges
@@ -85,6 +87,14 @@ module Ronin
85
87
  @query_method_calls << [:with_name, [name]]
86
88
  end
87
89
 
90
+ option :named, value: {
91
+ type: String,
92
+ usage: 'NAME'
93
+ },
94
+ desc: 'Searches for all ASN records containing the name' do |name|
95
+ @query_method_calls << [:named, [name]]
96
+ end
97
+
88
98
  option :ip, short: '-I',
89
99
  value: {
90
100
  type: String,
@@ -131,7 +141,7 @@ module Ronin
131
141
  # Runs the `ronin-db asn` command.
132
142
  #
133
143
  def run
134
- connect
144
+ db_connect
135
145
 
136
146
  if options[:update]
137
147
  update