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
@@ -1,71 +0,0 @@
1
- # frozen_string_literal: true
2
- #
3
- # ronin-db - A common database library for managing and querying security data.
4
- #
5
- # Copyright (c) 2006-2023 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/command'
22
- require 'ronin/db/cli/uri_methods'
23
- require 'ronin/db'
24
-
25
- module Ronin
26
- module DB
27
- class CLI
28
- #
29
- # Base class for all commands that access the database.
30
- #
31
- class DatabaseCommand < Command
32
-
33
- include URIMethods
34
-
35
- option :db, value: {
36
- type: DB.config.keys,
37
- default: :default,
38
- usage: 'NAME'
39
- },
40
- desc: 'The database to connect to'
41
-
42
- option :db_uri, value: {
43
- type: String,
44
- usage: 'URI'
45
- },
46
- desc: 'The database URI to connect to'
47
-
48
- #
49
- # The database connection configuration.
50
- #
51
- # @return [Hash{Symbol => String,Integer}]
52
- #
53
- def config
54
- if options[:db_uri]
55
- parse_uri(options[:db_uri])
56
- else
57
- DB.config[options[:db]]
58
- end
59
- end
60
-
61
- #
62
- # Connects to the database.
63
- #
64
- def connect
65
- DB.connect(config)
66
- end
67
-
68
- end
69
- end
70
- end
71
- end
@@ -1,118 +0,0 @@
1
- # frozen_string_literal: true
2
- #
3
- # ronin-db - A common database library for managing and querying security data.
4
- #
5
- # Copyright (c) 2006-2023 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/ui/cli/model_command'
22
- require 'ronin/db/model/importable'
23
-
24
- require 'dm-serializer'
25
-
26
- module Ronin
27
- module DB
28
- module CLI
29
- #
30
- # A base-command class for listing Database Resources.
31
- #
32
- class ResourcesCommand < ModelCommand
33
-
34
- option :csv, type: true,
35
- description: 'CSV output'
36
-
37
- option :xml, type: true,
38
- description: 'XML output'
39
-
40
- option :yaml, type: true,
41
- description: 'YAML output'
42
-
43
- option :json, type: true,
44
- description: 'JSON output'
45
-
46
- #
47
- # Default method performs the query and prints the found resources.
48
- #
49
- # @since 1.1.0
50
- #
51
- # @api semipublic
52
- #
53
- def execute
54
- if @import
55
- self.class.model.import(@import) do |resource|
56
- print_info "Imported #{resource}"
57
- end
58
- else
59
- print_resources(query)
60
- end
61
- end
62
-
63
- #
64
- # Sets the model used by the command.
65
- #
66
- # @see ModelCommand.model
67
- #
68
- # @since 1.3.0
69
- #
70
- def self.model(model=nil)
71
- if (model && model < Model::Importable)
72
- option :import, type: String,
73
- flag: '-i',
74
- usage: 'FILE',
75
- description: 'The file to import'
76
- end
77
-
78
- return super(model)
79
- end
80
-
81
- #
82
- # Default method which will print every queried resource.
83
- #
84
- # @param [DataMapper::Resource] resource
85
- # A queried resource from the Database.
86
- #
87
- # @since 1.1.0
88
- #
89
- # @api semipublic
90
- #
91
- def print_resource(resource)
92
- puts resource
93
- end
94
-
95
- #
96
- # Prints multiple resources.
97
- #
98
- # @param [DataMapper::Collection] resources
99
- # The query to print.
100
- #
101
- # @since 1.1.0
102
- #
103
- # @api semipublic
104
- #
105
- def print_resources(resources)
106
- if csv? then puts resources.to_csv
107
- elsif xml? then puts resources.to_xml
108
- elsif yaml? then puts resources.to_yaml
109
- elsif json? then puts resources.to_json
110
- else
111
- resources.each { |resource| print_resource(resource) }
112
- end
113
- end
114
-
115
- end
116
- end
117
- end
118
- end