ronin-db 0.1.3 → 0.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -0
  3. data/.gitignore +1 -0
  4. data/ChangeLog.md +28 -0
  5. data/Gemfile +6 -4
  6. data/README.md +17 -5
  7. data/Rakefile +13 -35
  8. data/data/completions/ronin-db +271 -0
  9. data/gemspec.yml +17 -2
  10. data/lib/ronin/db/cli/command.rb +1 -1
  11. data/lib/ronin/db/cli/commands/add.rb +1 -1
  12. data/lib/ronin/db/cli/commands/asn.rb +12 -2
  13. data/lib/ronin/db/cli/commands/certs.rb +322 -0
  14. data/lib/ronin/db/cli/commands/completion.rb +63 -0
  15. data/lib/ronin/db/cli/commands/creds.rb +2 -1
  16. data/lib/ronin/db/cli/commands/edit.rb +1 -1
  17. data/lib/ronin/db/cli/commands/emails.rb +22 -1
  18. data/lib/ronin/db/cli/commands/hosts.rb +2 -1
  19. data/lib/ronin/db/cli/commands/ips.rb +2 -1
  20. data/lib/ronin/db/cli/commands/irb.rb +8 -4
  21. data/lib/ronin/db/cli/commands/list.rb +1 -1
  22. data/lib/ronin/db/cli/commands/migrate.rb +12 -8
  23. data/lib/ronin/db/cli/commands/open_ports.rb +102 -0
  24. data/lib/ronin/db/cli/commands/oses.rb +95 -0
  25. data/lib/ronin/db/cli/commands/passwords.rb +83 -0
  26. data/lib/ronin/db/cli/commands/people.rb +185 -0
  27. data/lib/ronin/db/cli/commands/phone_numbers.rb +136 -0
  28. data/lib/ronin/db/cli/commands/ports.rb +103 -0
  29. data/lib/ronin/db/cli/commands/remove.rb +1 -1
  30. data/lib/ronin/db/cli/commands/services.rb +102 -0
  31. data/lib/ronin/db/cli/commands/software.rb +95 -0
  32. data/lib/ronin/db/cli/commands/street_addresses.rb +129 -0
  33. data/lib/ronin/db/cli/commands/urls.rb +2 -1
  34. data/lib/ronin/db/cli/commands/web_vulns.rb +235 -0
  35. data/lib/ronin/db/cli/database_options.rb +87 -0
  36. data/lib/ronin/db/cli/deletable.rb +85 -0
  37. data/lib/ronin/db/cli/importable.rb +108 -0
  38. data/lib/ronin/db/cli/model_command.rb +8 -6
  39. data/lib/ronin/db/cli/modifiable.rb +12 -104
  40. data/lib/ronin/db/cli/printing.rb +58 -0
  41. data/lib/ronin/db/cli/ruby_shell.rb +1 -1
  42. data/lib/ronin/db/cli/uri_methods.rb +1 -1
  43. data/lib/ronin/db/cli.rb +3 -1
  44. data/lib/ronin/db/config_file.rb +1 -1
  45. data/lib/ronin/db/exceptions.rb +1 -1
  46. data/lib/ronin/db/home.rb +1 -1
  47. data/lib/ronin/db/root.rb +1 -1
  48. data/lib/ronin/db/tasks.rb +87 -0
  49. data/lib/ronin/db/version.rb +2 -2
  50. data/lib/ronin/db.rb +15 -7
  51. data/man/ronin-db-add.1 +47 -69
  52. data/man/ronin-db-add.1.md +26 -22
  53. data/man/ronin-db-asn.1 +36 -54
  54. data/man/ronin-db-asn.1.md +29 -19
  55. data/man/ronin-db-certs.1 +108 -0
  56. data/man/ronin-db-certs.1.md +106 -0
  57. data/man/ronin-db-completion.1 +76 -0
  58. data/man/ronin-db-completion.1.md +78 -0
  59. data/man/ronin-db-creds.1 +28 -46
  60. data/man/ronin-db-creds.1.md +23 -16
  61. data/man/ronin-db-edit.1 +15 -26
  62. data/man/ronin-db-edit.1.md +11 -7
  63. data/man/ronin-db-emails.1 +36 -49
  64. data/man/ronin-db-emails.1.md +30 -17
  65. data/man/ronin-db-hosts.1 +31 -51
  66. data/man/ronin-db-hosts.1.md +25 -18
  67. data/man/ronin-db-ips.1 +31 -52
  68. data/man/ronin-db-ips.1.md +26 -19
  69. data/man/ronin-db-irb.1 +22 -35
  70. data/man/ronin-db-irb.1.md +17 -10
  71. data/man/ronin-db-list.1 +16 -30
  72. data/man/ronin-db-list.1.md +13 -9
  73. data/man/ronin-db-migrate.1 +22 -35
  74. data/man/ronin-db-migrate.1.md +17 -10
  75. data/man/ronin-db-open-ports.1 +72 -0
  76. data/man/ronin-db-open-ports.1.md +70 -0
  77. data/man/ronin-db-oses.1 +72 -0
  78. data/man/ronin-db-oses.1.md +70 -0
  79. data/man/ronin-db-passwords.1 +75 -0
  80. data/man/ronin-db-passwords.1.md +73 -0
  81. data/man/ronin-db-people.1 +96 -0
  82. data/man/ronin-db-people.1.md +94 -0
  83. data/man/ronin-db-phone-numbers.1 +93 -0
  84. data/man/ronin-db-phone-numbers.1.md +91 -0
  85. data/man/ronin-db-ports.1 +87 -0
  86. data/man/ronin-db-ports.1.md +85 -0
  87. data/man/ronin-db-remove.1 +15 -28
  88. data/man/ronin-db-remove.1.md +12 -8
  89. data/man/ronin-db-services.1 +84 -0
  90. data/man/ronin-db-services.1.md +82 -0
  91. data/man/ronin-db-software.1 +72 -0
  92. data/man/ronin-db-software.1.md +70 -0
  93. data/man/ronin-db-street-addresses.1 +81 -0
  94. data/man/ronin-db-street-addresses.1.md +79 -0
  95. data/man/ronin-db-urls.1 +37 -60
  96. data/man/ronin-db-urls.1.md +28 -21
  97. data/man/ronin-db-web-vulns.1 +87 -0
  98. data/man/ronin-db-web-vulns.1.md +85 -0
  99. data/man/ronin-db.1 +118 -0
  100. data/man/ronin-db.1.md +99 -0
  101. data/scripts/setup +58 -0
  102. metadata +52 -9
  103. data/lib/ronin/db/cli/database_command.rb +0 -71
  104. data/lib/ronin/db/cli/resources_command.rb +0 -118
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db - A common database library for managing and querying security data.
4
+ #
5
+ # Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # ronin-db is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU Lesser General Public License as published
9
+ # by the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # ronin-db is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public License
18
+ # along with ronin-db. If not, see <https://www.gnu.org/licenses/>.
19
+ #
20
+
21
+ require 'ronin/db/cli/model_command'
22
+ require 'ronin/db/cli/modifiable'
23
+
24
+ module Ronin
25
+ module DB
26
+ class CLI
27
+ module Commands
28
+ #
29
+ # Manages all Ports in the database.
30
+ #
31
+ # ## Usage
32
+ #
33
+ # ronin-db ports [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
+ # --db-file PATH The sqlite3 database file to use
40
+ # -v, --verbose Enables verbose output
41
+ # --add VALUE Adds a value to the database
42
+ # --import FILE Imports the values from the FILE into the database
43
+ # --delete VALUE Deletes a value from the database
44
+ # --delete-all Deletes all values from the database
45
+ # -p, --with-port PORT Searches for all Ports associated with the PORT number
46
+ # -P, --with-protocol tcp|udp Searches for all Ports associated with the protocol
47
+ # -S, --with-service SERVICE Searches for all Ports associated with the SERVICE
48
+ # -I, --with-ip IP Searches for all Ports associated with the IP
49
+ # -h, --help Print help information
50
+ #
51
+ # @since 0.2.0
52
+ #
53
+ class Ports < ModelCommand
54
+
55
+ include Modifiable
56
+
57
+ model_file 'ronin/db/port'
58
+ model_name 'Port'
59
+
60
+ option :number, short: '-N',
61
+ value: {
62
+ type: Integer,
63
+ usage: 'PORT'
64
+ },
65
+ desc: 'Searches for all Ports with the PORT number' do |port|
66
+ @query_method_calls << [:with_number, [port]]
67
+ end
68
+
69
+ option :with_protocol, short: '-P',
70
+ value: {
71
+ type: [:tcp, :udp]
72
+ },
73
+ desc: 'Searches for all Ports associated with the protocol' do |protocol|
74
+ @query_method_calls << [:with_protocol, [protocol]]
75
+ end
76
+
77
+ option :with_service, short: '-S',
78
+ value: {
79
+ type: String,
80
+ usage: 'SERVICE'
81
+ },
82
+ desc: 'Searches for all Ports associated with the SERVICE' do |service|
83
+ @query_method_calls << [:with_service_name, [service]]
84
+ end
85
+
86
+ option :with_ip, short: '-I',
87
+ value: {
88
+ type: String,
89
+ usage: 'IP'
90
+ },
91
+ desc: 'Searches for all Ports associated with the IP' do |ip|
92
+ @query_method_calls << [:with_ip_address, [ip]]
93
+ end
94
+
95
+ description 'Manages Ports'
96
+
97
+ man_page 'ronin-db-ports.1'
98
+
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ronin-db - A common database library for managing and querying security data.
4
4
  #
5
- # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-db is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db - A common database library for managing and querying security data.
4
+ #
5
+ # Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # ronin-db is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU Lesser General Public License as published
9
+ # by the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # ronin-db is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public License
18
+ # along with ronin-db. If not, see <https://www.gnu.org/licenses/>.
19
+ #
20
+
21
+ require 'ronin/db/cli/model_command'
22
+ require 'ronin/db/cli/modifiable'
23
+
24
+ module Ronin
25
+ module DB
26
+ class CLI
27
+ module Commands
28
+ #
29
+ # Manages all Services in the database.
30
+ #
31
+ # ## Usage
32
+ #
33
+ # ronin-db services [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
+ # --db-file PATH The sqlite3 database file to use
40
+ # -v, --verbose Enables verbose output
41
+ # --add VALUE Adds a value to the database
42
+ # --import FILE Imports the values from the FILE into the database
43
+ # --delete VALUE Deletes a value from the database
44
+ # --delete-all Deletes all values from the database
45
+ # --named NAME Searches for all Services containing the NAME
46
+ # -p, --with-port PORT Searches for all Services associated with the PORT
47
+ # -P, --with-protocol tcp|udp Searches for all Services associated with the protocol
48
+ # -I, --with-ip IP Searches for all Services associated with the IP
49
+ # -h, --help Print help information
50
+ #
51
+ # @since 0.2.0
52
+ #
53
+ class Services < ModelCommand
54
+
55
+ include Modifiable
56
+
57
+ model_file 'ronin/db/service'
58
+ model_name 'Service'
59
+
60
+ option :named, value: {
61
+ type: String,
62
+ usage: 'NAME'
63
+ },
64
+ desc: 'Searches for all Services containing the NAME' do |name|
65
+ @query_method_calls << [:named, [name]]
66
+ end
67
+
68
+ option :with_port, short: '-p',
69
+ value: {
70
+ type: Integer,
71
+ usage: 'PORT'
72
+ },
73
+ desc: 'Searches for all Services associated with the PORT' do |port|
74
+ @query_method_calls << [:with_port_number, [port]]
75
+ end
76
+
77
+ option :with_protocol, short: '-P',
78
+ value: {
79
+ type: [:tcp, :udp]
80
+ },
81
+ desc: 'Searches for all Services associated with the protocol' do |protocol|
82
+ @query_method_calls << [:with_protocol, [protocol]]
83
+ end
84
+
85
+ option :with_ip, short: '-I',
86
+ value: {
87
+ type: String,
88
+ usage: 'IP'
89
+ },
90
+ desc: 'Searches for all Services associated with the IP' do |ip|
91
+ @query_method_calls << [:with_ip_address, [ip]]
92
+ end
93
+
94
+ description 'Manages Services'
95
+
96
+ man_page 'ronin-db-services.1'
97
+
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db - A common database library for managing and querying security data.
4
+ #
5
+ # Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # ronin-db is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU Lesser General Public License as published
9
+ # by the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # ronin-db is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public License
18
+ # along with ronin-db. If not, see <https://www.gnu.org/licenses/>.
19
+ #
20
+
21
+ require 'ronin/db/cli/model_command'
22
+
23
+ module Ronin
24
+ module DB
25
+ class CLI
26
+ module Commands
27
+ #
28
+ # Queries all Software in the database.
29
+ #
30
+ # ## Usage
31
+ #
32
+ # ronin-db software [options]
33
+ #
34
+ # ## Options
35
+ #
36
+ # --db NAME The database to connect to (Default: default)
37
+ # --db-uri URI The database URI to connect to
38
+ # --db-file PATH The sqlite3 database file to use
39
+ # -v, --verbose Enables verbose output
40
+ # -N, --name NAME Searches for all OSes records with the matching name
41
+ # --named NAME Searches for all OSes containing the NAME
42
+ # -V, --version VERSION Searches for all OSes with the VERSION
43
+ # --vendor VENDOR Searches for all Software with the vendor name
44
+ # -h, --help Print help information
45
+ #
46
+ # @since 0.2.0
47
+ #
48
+ class Software < ModelCommand
49
+
50
+ model_file 'ronin/db/software'
51
+ model_name 'Software'
52
+
53
+ option :name, short: '-N',
54
+ value: {
55
+ type: String,
56
+ usage: 'NAME'
57
+ },
58
+ desc: 'Searches for all OSes records with the matching name' do |name|
59
+ @query_method_calls << [:with_name, [name]]
60
+ end
61
+
62
+ option :named, value: {
63
+ type: String,
64
+ usage: 'NAME'
65
+ },
66
+ desc: 'Searches for all OSes containing the NAME' do |name|
67
+ @query_method_calls << [:named, [name]]
68
+ end
69
+
70
+ option :version, short: '-V',
71
+ value: {
72
+ type: String,
73
+ usage: 'VERSION'
74
+ },
75
+ desc: 'Searches for all OSes with the VERSION' do |version|
76
+ @query_method_calls << [:with_version, [version]]
77
+ end
78
+
79
+ option :vendor, value: {
80
+ type: String,
81
+ usage: 'VENDOR'
82
+ },
83
+ desc: 'Searches for all Software with the vendor name' do |vendor|
84
+ @query_method_calls << [:with_vendor_name, [vendor]]
85
+ end
86
+
87
+ description 'Queries Software'
88
+
89
+ man_page 'ronin-db-software.1'
90
+
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,129 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-db - A common database library for managing and querying security data.
4
+ #
5
+ # Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # ronin-db is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU Lesser General Public License as published
9
+ # by the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # ronin-db is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public License
18
+ # along with ronin-db. If not, see <https://www.gnu.org/licenses/>.
19
+ #
20
+
21
+ require 'ronin/db/cli/model_command'
22
+
23
+ module Ronin
24
+ module DB
25
+ class CLI
26
+ module Commands
27
+ #
28
+ # Manages all StreetAddresses in the database.
29
+ #
30
+ # ## Usage
31
+ #
32
+ # ronin-db street-addresses [options]
33
+ #
34
+ # ## Options
35
+ #
36
+ # --db NAME The database to connect to (Default: default)
37
+ # --db-uri URI The database URI to connect to
38
+ # --db-file PATH The sqlite3 database file to use
39
+ # -v, --verbose Enables verbose output
40
+ # -P, --for-person FULL_NAME Searches for street addresses associated with the person's full name
41
+ # -O, --for-organization NAME Searches for street addresses associated with the organization's name
42
+ # -a, --with-address ADDRESS Searches for street addresses with the matching address
43
+ # -c, --with-city CITY Searches for street addresses with the matching city
44
+ # -s, --with-state STATE Searches for street addresses with the matching state
45
+ # -C, --with-country COUNTRY Searches for street addresses with the matching country
46
+ # -z, --with-zipcode ZIPCODE Searches for street addresses with the matching zipcode
47
+ # -h, --help Print help information
48
+ #
49
+ # @since 0.2.0
50
+ #
51
+ class StreetAddresses < ModelCommand
52
+
53
+ command_name 'street-addresses'
54
+
55
+ model_file 'ronin/db/street_address'
56
+ model_name 'StreetAddress'
57
+
58
+ option :for_person, short: '-P',
59
+ value: {
60
+ type: String,
61
+ usage: 'FULL_NAME'
62
+ },
63
+ desc: "Searches for street addresses associated with the person's full name" do |full_name|
64
+ @query_method_calls << [:for_person, [full_name]]
65
+ end
66
+
67
+ option :for_organization, short: '-O',
68
+ value: {
69
+ type: String,
70
+ usage: 'NAME'
71
+ },
72
+ desc: "Searches for street addresses associated with the organization's name" do |name|
73
+ @query_method_calls << [:for_organization, [name]]
74
+ end
75
+
76
+ option :with_address, short: '-a',
77
+ value: {
78
+ type: String,
79
+ usage: 'ADDRESS'
80
+ },
81
+ desc: 'Searches for street addresses with the matching address' do |address|
82
+ @query_method_calls << [:with_address, [address]]
83
+ end
84
+
85
+ option :with_city, short: '-c',
86
+ value: {
87
+ type: String,
88
+ usage: 'CITY'
89
+ },
90
+ desc: 'Searches for street addresses with the matching city' do |city|
91
+ @query_method_calls << [:with_city, [city]]
92
+ end
93
+
94
+ option :with_state, short: '-s',
95
+ value: {
96
+ type: String,
97
+ usage: 'STATE'
98
+ },
99
+ desc: 'Searches for street addresses with the matching state' do |state|
100
+ @query_method_calls << [:with_state, [state]]
101
+ end
102
+
103
+ option :with_country, short: '-C',
104
+ value: {
105
+ type: String,
106
+ usage: 'COUNTRY'
107
+ },
108
+ desc: 'Searches for street addresses with the matching country' do |country|
109
+ @query_method_calls << [:with_country, [country]]
110
+ end
111
+
112
+ option :with_zipcode, short: '-z',
113
+ value: {
114
+ type: String,
115
+ usage: 'ZIPCODE'
116
+ },
117
+ desc: 'Searches for street addresses with the matching zipcode' do |zipcode|
118
+ @query_method_calls << [:with_zipcode, [zipcode]]
119
+ end
120
+
121
+ description 'Queries StreetAddresses'
122
+
123
+ man_page 'ronin-db-street-addresses.1'
124
+
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # ronin-db - A common database library for managing and querying security data.
4
4
  #
5
- # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-db is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -36,6 +36,7 @@ module Ronin
36
36
  #
37
37
  # --db NAME The database to connect to (Default: default)
38
38
  # --db-uri URI The database URI to connect to
39
+ # --db-file PATH The sqlite3 database file to use
39
40
  # -v, --verbose Enables verbose output
40
41
  # --add VALUE Adds a value to the database
41
42
  # --import FILE Imports the values from the FILE into the database