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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -0
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/ChangeLog.md +28 -0
- data/Gemfile +6 -4
- data/README.md +17 -5
- data/Rakefile +13 -35
- data/data/completions/ronin-db +271 -0
- data/gemspec.yml +17 -2
- data/lib/ronin/db/cli/command.rb +1 -1
- data/lib/ronin/db/cli/commands/add.rb +1 -1
- data/lib/ronin/db/cli/commands/asn.rb +12 -2
- data/lib/ronin/db/cli/commands/certs.rb +322 -0
- data/lib/ronin/db/cli/commands/completion.rb +63 -0
- data/lib/ronin/db/cli/commands/creds.rb +2 -1
- data/lib/ronin/db/cli/commands/edit.rb +1 -1
- data/lib/ronin/db/cli/commands/emails.rb +22 -1
- data/lib/ronin/db/cli/commands/hosts.rb +2 -1
- data/lib/ronin/db/cli/commands/ips.rb +2 -1
- data/lib/ronin/db/cli/commands/irb.rb +8 -4
- data/lib/ronin/db/cli/commands/list.rb +1 -1
- data/lib/ronin/db/cli/commands/migrate.rb +12 -8
- data/lib/ronin/db/cli/commands/open_ports.rb +102 -0
- data/lib/ronin/db/cli/commands/oses.rb +95 -0
- data/lib/ronin/db/cli/commands/passwords.rb +83 -0
- data/lib/ronin/db/cli/commands/people.rb +185 -0
- data/lib/ronin/db/cli/commands/phone_numbers.rb +136 -0
- data/lib/ronin/db/cli/commands/ports.rb +103 -0
- data/lib/ronin/db/cli/commands/remove.rb +1 -1
- data/lib/ronin/db/cli/commands/services.rb +102 -0
- data/lib/ronin/db/cli/commands/software.rb +95 -0
- data/lib/ronin/db/cli/commands/street_addresses.rb +129 -0
- data/lib/ronin/db/cli/commands/urls.rb +2 -1
- data/lib/ronin/db/cli/commands/web_vulns.rb +235 -0
- data/lib/ronin/db/cli/database_options.rb +87 -0
- data/lib/ronin/db/cli/deletable.rb +85 -0
- data/lib/ronin/db/cli/importable.rb +108 -0
- data/lib/ronin/db/cli/model_command.rb +8 -6
- data/lib/ronin/db/cli/modifiable.rb +12 -104
- data/lib/ronin/db/cli/printing.rb +58 -0
- data/lib/ronin/db/cli/ruby_shell.rb +1 -1
- data/lib/ronin/db/cli/uri_methods.rb +1 -1
- data/lib/ronin/db/cli.rb +5 -1
- data/lib/ronin/db/config_file.rb +1 -1
- data/lib/ronin/db/exceptions.rb +1 -1
- data/lib/ronin/db/home.rb +1 -1
- data/lib/ronin/db/root.rb +1 -1
- data/lib/ronin/db/tasks.rb +87 -0
- data/lib/ronin/db/version.rb +2 -2
- data/lib/ronin/db.rb +15 -7
- data/man/ronin-db-add.1 +47 -69
- data/man/ronin-db-add.1.md +26 -22
- data/man/ronin-db-asn.1 +36 -54
- data/man/ronin-db-asn.1.md +29 -19
- data/man/ronin-db-certs.1 +108 -0
- data/man/ronin-db-certs.1.md +106 -0
- data/man/ronin-db-completion.1 +76 -0
- data/man/ronin-db-completion.1.md +78 -0
- data/man/ronin-db-creds.1 +28 -46
- data/man/ronin-db-creds.1.md +23 -16
- data/man/ronin-db-edit.1 +15 -26
- data/man/ronin-db-edit.1.md +11 -7
- data/man/ronin-db-emails.1 +36 -49
- data/man/ronin-db-emails.1.md +30 -17
- data/man/ronin-db-hosts.1 +31 -51
- data/man/ronin-db-hosts.1.md +25 -18
- data/man/ronin-db-ips.1 +31 -52
- data/man/ronin-db-ips.1.md +26 -19
- data/man/ronin-db-irb.1 +22 -35
- data/man/ronin-db-irb.1.md +17 -10
- data/man/ronin-db-list.1 +16 -30
- data/man/ronin-db-list.1.md +13 -9
- data/man/ronin-db-migrate.1 +22 -35
- data/man/ronin-db-migrate.1.md +17 -10
- data/man/ronin-db-open-ports.1 +72 -0
- data/man/ronin-db-open-ports.1.md +70 -0
- data/man/ronin-db-oses.1 +72 -0
- data/man/ronin-db-oses.1.md +70 -0
- data/man/ronin-db-passwords.1 +75 -0
- data/man/ronin-db-passwords.1.md +73 -0
- data/man/ronin-db-people.1 +96 -0
- data/man/ronin-db-people.1.md +94 -0
- data/man/ronin-db-phone-numbers.1 +93 -0
- data/man/ronin-db-phone-numbers.1.md +91 -0
- data/man/ronin-db-ports.1 +87 -0
- data/man/ronin-db-ports.1.md +85 -0
- data/man/ronin-db-remove.1 +15 -28
- data/man/ronin-db-remove.1.md +12 -8
- data/man/ronin-db-services.1 +84 -0
- data/man/ronin-db-services.1.md +82 -0
- data/man/ronin-db-software.1 +72 -0
- data/man/ronin-db-software.1.md +70 -0
- data/man/ronin-db-street-addresses.1 +81 -0
- data/man/ronin-db-street-addresses.1.md +79 -0
- data/man/ronin-db-urls.1 +37 -60
- data/man/ronin-db-urls.1.md +28 -21
- data/man/ronin-db-web-vulns.1 +87 -0
- data/man/ronin-db-web-vulns.1.md +85 -0
- data/man/ronin-db.1 +118 -0
- data/man/ronin-db.1.md +99 -0
- data/scripts/setup +58 -0
- metadata +52 -9
- data/lib/ronin/db/cli/database_command.rb +0 -71
- 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
|