ronin-db 0.1.2-java → 0.2.0.rc1-java

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 +3 -2
  3. data/.gitignore +1 -0
  4. data/ChangeLog.md +33 -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 +13 -8
  45. data/lib/ronin/db/exceptions.rb +10 -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 +24 -7
  51. data/man/ronin-db-add.1 +48 -70
  52. data/man/ronin-db-add.1.md +26 -22
  53. data/man/ronin-db-asn.1 +37 -55
  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 +29 -47
  60. data/man/ronin-db-creds.1.md +23 -16
  61. data/man/ronin-db-edit.1 +16 -27
  62. data/man/ronin-db-edit.1.md +11 -7
  63. data/man/ronin-db-emails.1 +37 -50
  64. data/man/ronin-db-emails.1.md +30 -17
  65. data/man/ronin-db-hosts.1 +32 -52
  66. data/man/ronin-db-hosts.1.md +25 -18
  67. data/man/ronin-db-ips.1 +32 -53
  68. data/man/ronin-db-ips.1.md +26 -19
  69. data/man/ronin-db-irb.1 +23 -36
  70. data/man/ronin-db-irb.1.md +17 -10
  71. data/man/ronin-db-list.1 +17 -31
  72. data/man/ronin-db-list.1.md +13 -9
  73. data/man/ronin-db-migrate.1 +23 -36
  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 +16 -29
  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 +38 -61
  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 +70 -13
  103. data/lib/ronin/db/cli/database_command.rb +0 -71
  104. 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: 5e20fde641f025149b699e70299af69f99289adf64e968fee91a49f9caf33ac1
4
- data.tar.gz: b7b02264509ad9800f61320bc3a8042c34a7e9552e4c658c4d8d1c5a34dfac96
3
+ metadata.gz: 8e85a6b6a3de8992b78286596848fabaceb34ae2f4787f134cdade52b3591a50
4
+ data.tar.gz: b0431eab3c3bb2e7335ec7a8aaccc9beafdacc082efe55f362b6bd06a433e565
5
5
  SHA512:
6
- metadata.gz: c83dc934afed20756221f7b54336c30e957e6a9849a5846bec7d068a81e1cf4a68c5bb098a57096bbba912da9353d9a2d9690374f1de024e38e71c2d420856cc
7
- data.tar.gz: 1f62303657c9c113a2a4b14ce16e4f3849fb2f6f475757164e81b29cd431d9fa6ec43b6ad2e08737e14f40bf034036ff85bc06766a5a0cf126f3dea53e051232
6
+ metadata.gz: bed19615be36b63f69078f6adf6330ce357ff743566b819d37d9d2500e860412dea0413ab686dfe2ead8736e5eedb5f2daf6683cb1a182013fa00e17088d66bb
7
+ data.tar.gz: fbb146bbcc81d05d1dc3b1e890adce347b7313d1059505af9f42f379adb6bda8137eaa358d8229747e72d423ea81f22a7abaa992cdbb6fe550abe68cc9f1e21e
@@ -12,11 +12,12 @@ 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 }}
18
19
  steps:
19
- - uses: actions/checkout@v2
20
+ - uses: actions/checkout@v4
20
21
  - name: Set up Ruby
21
22
  uses: ruby/setup-ruby@v1
22
23
  with:
@@ -35,7 +36,7 @@ jobs:
35
36
  rubocop:
36
37
  runs-on: ubuntu-latest
37
38
  steps:
38
- - uses: actions/checkout@v2
39
+ - uses: actions/checkout@v4
39
40
  - name: Set up Ruby
40
41
  uses: ruby/setup-ruby@v1
41
42
  with:
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/ChangeLog.md CHANGED
@@ -1,3 +1,36 @@
1
+ ### 0.2.0 / 2024-XX-XX
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
+
29
+ ### 0.1.3 / 2023-12-13
30
+
31
+ * Fixed a bug in {Ronin::DB::ConfigFile.edit} when `YAML::Store` would attempt
32
+ to create the config file but the parent directory did not exist yet.
33
+
1
34
  ### 0.1.2 / 2023-09-19
2
35
 
3
36
  * Fixed a typo in an exception message in {Ronin::DB.connect}.
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
+ 'passwords'*'--for-user')
40
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A user -- "$cur" )
41
+ ;;
42
+
43
+ 'web-vulns'*'--for-host')
44
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
45
+ ;;
46
+
47
+ 'certs'*'--common-name')
48
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
49
+ ;;
50
+
51
+ 'emails'*'--with-host')
52
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
53
+ ;;
54
+
55
+ 'emails'*'--with-user')
56
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A user -- "$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
+ 'creds'*'--for-user')
68
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A user -- "$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
+ 'urls'*'--directory')
76
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
77
+ ;;
78
+
79
+ 'emails'*'--import')
80
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
81
+ ;;
82
+
83
+ 'ips'*'--with-host')
84
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
85
+ ;;
86
+
87
+ 'people'*'--import')
88
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
89
+ ;;
90
+
91
+ 'add'*'--username')
92
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A user -- "$cur" )
93
+ ;;
94
+
95
+ 'certs'*'--import')
96
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
97
+ ;;
98
+
99
+ 'creds'*'--import')
100
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
101
+ ;;
102
+
103
+ 'hosts'*'--import')
104
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
105
+ ;;
106
+
107
+ 'ports'*'--import')
108
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
109
+ ;;
110
+
111
+ 'add'*'--sqlite3')
112
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
113
+ ;;
114
+
115
+ 'phone-numbers'*)
116
+ 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" )
117
+ ;;
118
+
119
+ 'urls'*'--import')
120
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
121
+ ;;
122
+
123
+ 'ips'*'--import')
124
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
125
+ ;;
126
+
127
+ 'passwords'*'-u')
128
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A user -- "$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
+ 'add'*'--host')
140
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
141
+ ;;
142
+
143
+ 'asn'*'--file')
144
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
145
+ ;;
146
+
147
+ 'completion'*)
148
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-db_completions_filter "--print --install --uninstall")" -- "$cur" )
149
+ ;;
150
+
151
+ 'open-ports'*)
152
+ 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" )
153
+ ;;
154
+
155
+ 'emails'*'-H')
156
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
157
+ ;;
158
+
159
+ 'emails'*'-u')
160
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A user -- "$cur" )
161
+ ;;
162
+
163
+ 'passwords'*)
164
+ 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" )
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
+ 'services'*)
176
+ 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" )
177
+ ;;
178
+
179
+ 'software'*)
180
+ 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" )
181
+ ;;
182
+
183
+ 'migrate'*)
184
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file")" -- "$cur" )
185
+ ;;
186
+
187
+ 'urls'*'-H')
188
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
189
+ ;;
190
+
191
+ 'urls'*'-d')
192
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
193
+ ;;
194
+
195
+ 'add'*'-H')
196
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
197
+ ;;
198
+
199
+ 'add'*'-u')
200
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A user -- "$cur" )
201
+ ;;
202
+
203
+ 'asn'*'-f')
204
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
205
+ ;;
206
+
207
+ 'emails'*)
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 --with-host -H --with-ip -I --with-user -u --for-person -P --for-organization -O")" -- "$cur" )
209
+ ;;
210
+
211
+ 'ips'*'-H')
212
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A hostname -- "$cur" )
213
+ ;;
214
+
215
+ 'people'*)
216
+ 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" )
217
+ ;;
218
+
219
+ 'certs'*)
220
+ 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" )
221
+ ;;
222
+
223
+ 'creds'*)
224
+ 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" )
225
+ ;;
226
+
227
+ 'hosts'*)
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 --with-ip -I --with-port -p --domain -D --tld -T")" -- "$cur" )
229
+ ;;
230
+
231
+ 'ports'*)
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 --number -N --with-protocol -P --with-service -S --with-ip -I")" -- "$cur" )
233
+ ;;
234
+
235
+ 'list'*)
236
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-db_completions_filter "--verbose -v")" -- "$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
+ 'urls'*)
244
+ 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" )
245
+ ;;
246
+
247
+ 'add'*)
248
+ 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" )
249
+ ;;
250
+
251
+ 'asn'*)
252
+ 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" )
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
+ 'irb'*)
260
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-db_completions_filter "--db --db-uri --db-file --no-connect")" -- "$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.0.rc1
49
64
  ronin-support: ~> 1.0
50
- ronin-core: ~> 0.1
65
+ ronin-core: ~> 0.2.0.rc1
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