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,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
+
23
+ module Ronin
24
+ module DB
25
+ class CLI
26
+ module Commands
27
+ #
28
+ # Manages all OpenPorts in the database.
29
+ #
30
+ # ## Usage
31
+ #
32
+ # ronin-db open-ports [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
+ # --add VALUE Adds a value to the database
41
+ # --import FILE Imports the values from the FILE into the database
42
+ # --delete VALUE Deletes a value from the database
43
+ # --delete-all Deletes all values from the database
44
+ # -p, --with-port PORT Searches for all OpenPorts associated with the PORT number
45
+ # -P, --with-protocol tcp|udp Searches for all OpenPorts associated with the protocol
46
+ # -S, --with-service SERVICE Searches for all OpenPorts associated with the SERVICE
47
+ # -I, --with-ip IP Searches for all OpenPorts associated with the IP
48
+ # -h, --help Print help information
49
+ #
50
+ # @since 0.2.0
51
+ #
52
+ class OpenPorts < ModelCommand
53
+
54
+ command_name 'open-ports'
55
+
56
+ model_file 'ronin/db/open_port'
57
+ model_name 'OpenPort'
58
+
59
+ option :with_port, short: '-p',
60
+ value: {
61
+ type: Integer,
62
+ usage: 'PORT'
63
+ },
64
+ desc: 'Searches for all OpenPorts with the PORT number' do |port|
65
+ @query_method_calls << [:with_port_number, [port]]
66
+ end
67
+
68
+ option :with_protocol, short: '-P',
69
+ value: {
70
+ type: [:tcp, :udp]
71
+ },
72
+ desc: 'Searches for all OpenPorts associated with the protocol' do |protocol|
73
+ @query_method_calls << [:with_protocol, [protocol]]
74
+ end
75
+
76
+ option :with_service, short: '-S',
77
+ value: {
78
+ type: String,
79
+ usage: 'SERVICE'
80
+ },
81
+ desc: 'Searches for all OpenPorts associated with the SERVICE' do |service|
82
+ @query_method_calls << [:with_service_name, [service]]
83
+ end
84
+
85
+ option :with_ip, short: '-I',
86
+ value: {
87
+ type: String,
88
+ usage: 'IP'
89
+ },
90
+ desc: 'Searches for all OpenPorts associated with the IP' do |ip|
91
+ @query_method_calls << [:with_ip_address, [ip]]
92
+ end
93
+
94
+ description 'Queries OpenPorts'
95
+
96
+ man_page 'ronin-db-open-ports.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 OSes in the database.
29
+ #
30
+ # ## Usage
31
+ #
32
+ # ronin-db oses [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
+ # -F, --flavor linux|bsd Searches for all OSes with the flavor
43
+ # -V, --version VERSION Searches for all OSes with the VERSION
44
+ # -h, --help Print help information
45
+ #
46
+ # @since 0.2.0
47
+ #
48
+ class Oses < ModelCommand
49
+
50
+ model_file 'ronin/db/os'
51
+ model_name 'OS'
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 :flavor, short: '-F',
71
+ value: {
72
+ type: [:linux, :bsd]
73
+ },
74
+ desc: 'Searches for all OSes with the flavor' do |flavor|
75
+ @query_method_calls << [:with_flavor, [flavor]]
76
+ end
77
+
78
+ option :version, short: '-V',
79
+ value: {
80
+ type: String,
81
+ usage: 'VERSION'
82
+ },
83
+ desc: 'Searches for all OSes with the VERSION' do |version|
84
+ @query_method_calls << [:with_version, [version]]
85
+ end
86
+
87
+ description 'Queries OSes'
88
+
89
+ man_page 'ronin-db-oses.1'
90
+
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,83 @@
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 Passwords in the database.
30
+ #
31
+ # ## Usage
32
+ #
33
+ # ronin-db passwords [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
+ # -u, --for-user USER Searches for all Passwords associated with the USER name
46
+ # -e, --with-email EMAIL Searches for all Passwords associated with the EMAIL address
47
+ #
48
+ # @since 0.2.0
49
+ #
50
+ class Passwords < ModelCommand
51
+
52
+ include Modifiable
53
+
54
+ model_file 'ronin/db/password'
55
+ model_name 'Password'
56
+
57
+ option :for_user, short: '-u',
58
+ value: {
59
+ type: String,
60
+ usage: 'USER'
61
+ },
62
+ desc: 'Searches for all Passwords associated with the USER name' do |user|
63
+ @query_method_calls << [:for_user, [user]]
64
+ end
65
+
66
+ option :with_email, short: '-e',
67
+ value: {
68
+ type: String,
69
+ usage: 'EMAIL'
70
+ },
71
+ desc: 'Searches for all Passwords associated with the EMAIL address' do |email|
72
+ @query_method_calls << [:with_email_address, [email]]
73
+ end
74
+
75
+ description 'Manages all Passwords in the database'
76
+
77
+ man_page 'ronin-db-passwords.1'
78
+
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,185 @@
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 People in the database.
30
+ #
31
+ # ## Usage
32
+ #
33
+ # ronin-db people [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
+ # -a, --for-address ADDRESS Searches for all People associated with the street address
46
+ # -c, --for-city CITY Searches for all People associated with the city
47
+ # -s, --for-state STATE Searches for all People associated with the state
48
+ # -s, --for-province PROVINCE Searches for all People associated with the province
49
+ # -z, --for-zipcode ZIPCODE Searches for all People associated with the zipcode
50
+ # -C, --for-country COUNTRY Searches for all People associated with the Country
51
+ # -P, --with-prefix PREFIX Searches for all People with the prefix
52
+ # -f, --with-first-name NAME Searches for all People with the first name
53
+ # -m, --with-middle-name NAME Searches for all People with the middle name
54
+ # -M INITIAL, Searches for all People with the middle name
55
+ # --with-middle-initial
56
+ # -l, --with-last-name NAME Searches for all People with the last name
57
+ # -S, --with-suffix SUFFIX Searches for all People with the suffix
58
+ # -h, --help Print help information
59
+ #
60
+ # @since 0.2.0
61
+ #
62
+ class People < ModelCommand
63
+
64
+ include Modifiable
65
+
66
+ model_file 'ronin/db/person'
67
+ model_name 'Person'
68
+
69
+ option :for_address, short: '-a',
70
+ value: {
71
+ type: String,
72
+ usage: 'ADDRESS'
73
+ },
74
+ desc: 'Searches for all People associated with the street address' do |address|
75
+ @query_method_calls << [:for_address, [address]]
76
+ end
77
+
78
+ option :for_city, short: '-c',
79
+ value: {
80
+ type: String,
81
+ usage: 'CITY'
82
+ },
83
+ desc: 'Searches for all People associated with the city' do |city|
84
+ @query_method_calls << [:for_city, [city]]
85
+ end
86
+
87
+ option :for_state, short: '-s',
88
+ value: {
89
+ type: String,
90
+ usage: 'STATE'
91
+ },
92
+ desc: 'Searches for all People associated with the state' do |state|
93
+ @query_method_calls << [:for_state, [state]]
94
+ end
95
+
96
+ option :for_province, short: '-p',
97
+ value: {
98
+ type: String,
99
+ usage: 'PROVINCE'
100
+ },
101
+ desc: 'Searches for all People associated with the province' do |province|
102
+ @query_method_calls << [:for_province, [province]]
103
+ end
104
+
105
+ option :for_zipcode, short: '-z',
106
+ value: {
107
+ type: String,
108
+ usage: 'ZIPCODE'
109
+ },
110
+ desc: 'Searches for all People associated with the zipcode' do |zipcode|
111
+ @query_method_calls << [:for_zipcode, [zipcode]]
112
+ end
113
+
114
+ option :for_country, short: '-C',
115
+ value: {
116
+ type: String,
117
+ usage: 'COUNTRY'
118
+ },
119
+ desc: 'Searches for all People associated with the Country' do |country|
120
+ @query_method_calls << [:for_country, [country]]
121
+ end
122
+
123
+ option :with_prefix, short: '-P',
124
+ value: {
125
+ type: String,
126
+ usage: 'PREFIX'
127
+ },
128
+ desc: 'Searches for all People with the prefix' do |prefix|
129
+ @query_method_calls << [:with_prefix, [prefix]]
130
+ end
131
+
132
+ option :with_first_name, short: '-f',
133
+ value: {
134
+ type: String,
135
+ usage: 'NAME'
136
+ },
137
+ desc: 'Searches for all People with the first name' do |name|
138
+ @query_method_calls << [:with_first_name, [name]]
139
+ end
140
+
141
+ option :with_middle_name, short: '-m',
142
+ value: {
143
+ type: String,
144
+ usage: 'NAME'
145
+ },
146
+ desc: 'Searches for all People with the middle name' do |name|
147
+ @query_method_calls << [:with_middle_name, [name]]
148
+ end
149
+
150
+ option :with_middle_initial, short: '-M',
151
+ value: {
152
+ type: String,
153
+ usage: 'INITIAL'
154
+ },
155
+ desc: 'Searches for all People with the middle name' do |initial|
156
+ @query_method_calls << [:with_middle_initial, [initial]]
157
+ end
158
+
159
+ option :with_last_name, short: '-l',
160
+ value: {
161
+ type: String,
162
+ usage: 'NAME'
163
+ },
164
+ desc: 'Searches for all People with the last name' do |name|
165
+ @query_method_calls << [:with_last_name, [name]]
166
+ end
167
+
168
+ option :with_suffix, short: '-S',
169
+ value: {
170
+ type: String,
171
+ usage: 'SUFFIX'
172
+ },
173
+ desc: 'Searches for all People with the suffix' do |suffix|
174
+ @query_method_calls << [:with_suffix, [suffix]]
175
+ end
176
+
177
+ description 'Queries People'
178
+
179
+ man_page 'ronin-db-people.1'
180
+
181
+ end
182
+ end
183
+ end
184
+ end
185
+ end
@@ -0,0 +1,136 @@
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 PhoneNumbers in the database.
30
+ #
31
+ # ## Usage
32
+ #
33
+ # ronin-db phone-numbers [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, --for-person FULL_NAME Searches for phone numbers associated with the person's full name
46
+ # -O, --for-organization NAME Searches for phone numbers associated with the organization's name
47
+ # -c, --with-country-code NUM Searches for phone numbers with the country code
48
+ # -a, --with-area-code NUM Searches for phone numbers with the area code
49
+ # -p, --with-prefix NUM Searches for phone numbers with the prefix
50
+ # -l, --with-line-number NUM Searches for phone numbers with the line number
51
+ # -S, --similar-to PHONE_NUMBER Searches for phone numbers similar to another phone number
52
+ # -h, --help Print help information
53
+ #
54
+ # @since 0.2.0
55
+ #
56
+ class PhoneNumbers < ModelCommand
57
+
58
+ include Modifiable
59
+
60
+ command_name 'phone-numbers'
61
+
62
+ model_file 'ronin/db/phone_number'
63
+ model_name 'PhoneNumber'
64
+
65
+ option :for_person, short: '-P',
66
+ value: {
67
+ type: String,
68
+ usage: 'FULL_NAME'
69
+ },
70
+ desc: "Searches for phone numbers associated with the person's full name" do |full_name|
71
+ @query_method_calls << [:for_person, [full_name]]
72
+ end
73
+
74
+ option :for_organization, short: '-O',
75
+ value: {
76
+ type: String,
77
+ usage: 'NAME'
78
+ },
79
+ desc: "Searches for phone numbers associated with the organization's name" do |name|
80
+ @query_method_calls << [:for_organization, [name]]
81
+ end
82
+
83
+ option :with_country_code, short: '-c',
84
+ value: {
85
+ type: String,
86
+ usage: 'NUM'
87
+ },
88
+ desc: 'Searches for phone numbers with the country code' do |country_code|
89
+ @query_method_calls << [:with_country_code, country_code]
90
+ end
91
+
92
+ option :with_area_code, short: '-a',
93
+ value: {
94
+ type: String,
95
+ usage: 'NUM'
96
+ },
97
+ desc: 'Searches for phone numbers with the area code' do |area_code|
98
+ @query_method_calls << [:with_area_code, area_code]
99
+ end
100
+
101
+ option :with_prefix, short: '-p',
102
+ value: {
103
+ type: String,
104
+ usage: 'NUM'
105
+ },
106
+ desc: 'Searches for phone numbers with the prefix' do |prefix|
107
+ @query_method_calls << [:with_prefix, prefix]
108
+ end
109
+
110
+ option :with_line_number, short: '-l',
111
+ value: {
112
+ type: String,
113
+ usage: 'NUM'
114
+ },
115
+ desc: 'Searches for phone numbers with the line number' do |line_number|
116
+ @query_method_calls << [:with_line_number, line_number]
117
+ end
118
+
119
+ option :similar_to, short: '-S',
120
+ value: {
121
+ type: String,
122
+ usage: 'PHONE_NUMBER'
123
+ },
124
+ desc: 'Searches for phone numbers similar to another phone number' do |number|
125
+ @query_method_calls << [:similar_to, number]
126
+ end
127
+
128
+ description 'Queries PhoneNumbers'
129
+
130
+ man_page 'ronin-db-phone-numbers.1'
131
+
132
+ end
133
+ end
134
+ end
135
+ end
136
+ end