ronin-recon 0.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +4 -0
- data/.github/workflows/ruby.yml +46 -0
- data/.gitignore +20 -0
- data/.rspec +1 -0
- data/.rubocop.yml +44 -0
- data/.ruby-version +1 -0
- data/.yardopts +1 -0
- data/COPYING.txt +165 -0
- data/ChangeLog.md +36 -0
- data/Gemfile +62 -0
- data/README.md +391 -0
- data/Rakefile +74 -0
- data/bin/ronin-recon +16 -0
- data/data/completions/ronin-recon +95 -0
- data/data/templates/worker.rb.erb +67 -0
- data/data/wordlists/raft-small-directories.txt.gz +0 -0
- data/data/wordlists/subdomains-1000.txt.gz +0 -0
- data/examples/recon.rb +24 -0
- data/gemspec.yml +57 -0
- data/lib/ronin/recon/builtin/dns/lookup.rb +65 -0
- data/lib/ronin/recon/builtin/dns/mailservers.rb +64 -0
- data/lib/ronin/recon/builtin/dns/nameservers.rb +61 -0
- data/lib/ronin/recon/builtin/dns/reverse_lookup.rb +63 -0
- data/lib/ronin/recon/builtin/dns/srv_enum.rb +178 -0
- data/lib/ronin/recon/builtin/dns/subdomain_enum.rb +105 -0
- data/lib/ronin/recon/builtin/dns/suffix_enum.rb +168 -0
- data/lib/ronin/recon/builtin/net/ip_range_enum.rb +65 -0
- data/lib/ronin/recon/builtin/net/port_scan.rb +84 -0
- data/lib/ronin/recon/builtin/net/service_id.rb +75 -0
- data/lib/ronin/recon/builtin/ssl/cert_enum.rb +109 -0
- data/lib/ronin/recon/builtin/ssl/cert_grab.rb +76 -0
- data/lib/ronin/recon/builtin/ssl/cert_sh.rb +77 -0
- data/lib/ronin/recon/builtin/web/dir_enum.rb +121 -0
- data/lib/ronin/recon/builtin/web/email_addresses.rb +70 -0
- data/lib/ronin/recon/builtin/web/spider.rb +93 -0
- data/lib/ronin/recon/builtin.rb +34 -0
- data/lib/ronin/recon/cli/command.rb +40 -0
- data/lib/ronin/recon/cli/commands/completion.rb +61 -0
- data/lib/ronin/recon/cli/commands/irb.rb +57 -0
- data/lib/ronin/recon/cli/commands/new.rb +203 -0
- data/lib/ronin/recon/cli/commands/run.rb +420 -0
- data/lib/ronin/recon/cli/commands/test.rb +99 -0
- data/lib/ronin/recon/cli/commands/worker.rb +114 -0
- data/lib/ronin/recon/cli/commands/workers.rb +80 -0
- data/lib/ronin/recon/cli/debug_option.rb +45 -0
- data/lib/ronin/recon/cli/printing.rb +122 -0
- data/lib/ronin/recon/cli/ruby_shell.rb +51 -0
- data/lib/ronin/recon/cli/worker_command.rb +105 -0
- data/lib/ronin/recon/cli.rb +50 -0
- data/lib/ronin/recon/config.rb +371 -0
- data/lib/ronin/recon/dns_worker.rb +41 -0
- data/lib/ronin/recon/engine.rb +639 -0
- data/lib/ronin/recon/exceptions.rb +45 -0
- data/lib/ronin/recon/graph.rb +127 -0
- data/lib/ronin/recon/importer.rb +224 -0
- data/lib/ronin/recon/input_file.rb +81 -0
- data/lib/ronin/recon/message/job_completed.rb +60 -0
- data/lib/ronin/recon/message/job_failed.rb +69 -0
- data/lib/ronin/recon/message/job_started.rb +60 -0
- data/lib/ronin/recon/message/shutdown.rb +38 -0
- data/lib/ronin/recon/message/value.rb +76 -0
- data/lib/ronin/recon/message/worker_started.rb +51 -0
- data/lib/ronin/recon/message/worker_stopped.rb +51 -0
- data/lib/ronin/recon/mixins/dns.rb +639 -0
- data/lib/ronin/recon/mixins/http.rb +58 -0
- data/lib/ronin/recon/mixins.rb +21 -0
- data/lib/ronin/recon/output_formats/dir.rb +94 -0
- data/lib/ronin/recon/output_formats/dot.rb +155 -0
- data/lib/ronin/recon/output_formats/graph_format.rb +48 -0
- data/lib/ronin/recon/output_formats/graphviz_format.rb +115 -0
- data/lib/ronin/recon/output_formats/pdf.rb +43 -0
- data/lib/ronin/recon/output_formats/png.rb +43 -0
- data/lib/ronin/recon/output_formats/svg.rb +43 -0
- data/lib/ronin/recon/output_formats.rb +48 -0
- data/lib/ronin/recon/registry.rb +35 -0
- data/lib/ronin/recon/root.rb +33 -0
- data/lib/ronin/recon/scope.rb +112 -0
- data/lib/ronin/recon/value/parser.rb +113 -0
- data/lib/ronin/recon/value.rb +110 -0
- data/lib/ronin/recon/value_status.rb +87 -0
- data/lib/ronin/recon/values/cert.rb +168 -0
- data/lib/ronin/recon/values/domain.rb +88 -0
- data/lib/ronin/recon/values/email_address.rb +114 -0
- data/lib/ronin/recon/values/host.rb +137 -0
- data/lib/ronin/recon/values/ip.rb +123 -0
- data/lib/ronin/recon/values/ip_range.rb +155 -0
- data/lib/ronin/recon/values/mailserver.rb +61 -0
- data/lib/ronin/recon/values/nameserver.rb +61 -0
- data/lib/ronin/recon/values/open_port.rb +190 -0
- data/lib/ronin/recon/values/url.rb +218 -0
- data/lib/ronin/recon/values/website.rb +200 -0
- data/lib/ronin/recon/values/wildcard.rb +140 -0
- data/lib/ronin/recon/values.rb +32 -0
- data/lib/ronin/recon/version.rb +26 -0
- data/lib/ronin/recon/web_worker.rb +35 -0
- data/lib/ronin/recon/worker.rb +433 -0
- data/lib/ronin/recon/worker_pool.rb +203 -0
- data/lib/ronin/recon/workers.rb +260 -0
- data/lib/ronin/recon.rb +22 -0
- data/man/ronin-recon-completion.1 +76 -0
- data/man/ronin-recon-completion.1.md +78 -0
- data/man/ronin-recon-irb.1 +27 -0
- data/man/ronin-recon-irb.1.md +26 -0
- data/man/ronin-recon-new.1 +58 -0
- data/man/ronin-recon-new.1.md +59 -0
- data/man/ronin-recon-run.1 +137 -0
- data/man/ronin-recon-run.1.md +115 -0
- data/man/ronin-recon-test.1 +53 -0
- data/man/ronin-recon-test.1.md +55 -0
- data/man/ronin-recon-worker.1 +32 -0
- data/man/ronin-recon-worker.1.md +34 -0
- data/man/ronin-recon-workers.1 +29 -0
- data/man/ronin-recon-workers.1.md +31 -0
- data/man/ronin-recon.1 +57 -0
- data/man/ronin-recon.1.md +57 -0
- data/ronin-recon.gemspec +62 -0
- data/scripts/setup +58 -0
- metadata +364 -0
@@ -0,0 +1,114 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# ronin-recon - A micro-framework and tool for performing reconnaissance.
|
4
|
+
#
|
5
|
+
# Copyright (c) 2023-2024 Hal Brodigan (postmodern.mod3@gmail.com)
|
6
|
+
#
|
7
|
+
# ronin-recon 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-recon 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-recon. If not, see <https://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
|
21
|
+
require 'ronin/recon/value'
|
22
|
+
|
23
|
+
module Ronin
|
24
|
+
module Recon
|
25
|
+
module Values
|
26
|
+
#
|
27
|
+
# Represents an email address.
|
28
|
+
#
|
29
|
+
# @api public
|
30
|
+
#
|
31
|
+
class EmailAddress < Value
|
32
|
+
|
33
|
+
# The email address.
|
34
|
+
#
|
35
|
+
# @return [String]
|
36
|
+
attr_reader :address
|
37
|
+
|
38
|
+
#
|
39
|
+
# Initializes the email address object.
|
40
|
+
#
|
41
|
+
# @param [String] address
|
42
|
+
# The email address.
|
43
|
+
#
|
44
|
+
def initialize(address)
|
45
|
+
@address = address
|
46
|
+
end
|
47
|
+
|
48
|
+
#
|
49
|
+
# Compares the value to another value.
|
50
|
+
#
|
51
|
+
# @param [Values::Value] other
|
52
|
+
# The other value to compare.
|
53
|
+
#
|
54
|
+
# @return [Boolean]
|
55
|
+
# Indicates whether the other value is a kind of {EmailAddress} and
|
56
|
+
# has the same address.
|
57
|
+
#
|
58
|
+
def eql?(other)
|
59
|
+
other.kind_of?(self.class) && @address == other.address
|
60
|
+
end
|
61
|
+
|
62
|
+
alias === eql?
|
63
|
+
|
64
|
+
#
|
65
|
+
# The "hash" value for the email address.
|
66
|
+
#
|
67
|
+
# @return [Integer]
|
68
|
+
# The hash of the {#address}.
|
69
|
+
#
|
70
|
+
def hash
|
71
|
+
[self.class, @address].hash
|
72
|
+
end
|
73
|
+
|
74
|
+
#
|
75
|
+
# Converts the email address object to a String.
|
76
|
+
#
|
77
|
+
# @return [String]
|
78
|
+
# The email address.
|
79
|
+
#
|
80
|
+
def to_s
|
81
|
+
@address.to_s
|
82
|
+
end
|
83
|
+
|
84
|
+
alias to_str to_s
|
85
|
+
|
86
|
+
#
|
87
|
+
# Coerces the email address value into JSON.
|
88
|
+
#
|
89
|
+
# @return [Hash{Symbol => Object}]
|
90
|
+
# The Ruby Hash that will be converted into JSON.
|
91
|
+
#
|
92
|
+
def as_json
|
93
|
+
{type: :email_address, address: @address}
|
94
|
+
end
|
95
|
+
|
96
|
+
#
|
97
|
+
# Returns the type or kind of recon value.
|
98
|
+
#
|
99
|
+
# @return [:email_address]
|
100
|
+
#
|
101
|
+
# @note
|
102
|
+
# This is used internally to map a recon value class to a printable
|
103
|
+
# type.
|
104
|
+
#
|
105
|
+
# @api private
|
106
|
+
#
|
107
|
+
def self.value_type
|
108
|
+
:email_address
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# ronin-recon - A micro-framework and tool for performing reconnaissance.
|
4
|
+
#
|
5
|
+
# Copyright (c) 2023-2024 Hal Brodigan (postmodern.mod3@gmail.com)
|
6
|
+
#
|
7
|
+
# ronin-recon 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-recon 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-recon. If not, see <https://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
|
21
|
+
require 'ronin/recon/value'
|
22
|
+
require 'ronin/recon/values/ip'
|
23
|
+
require 'ronin/recon/values/website'
|
24
|
+
require 'ronin/recon/values/url'
|
25
|
+
|
26
|
+
module Ronin
|
27
|
+
module Recon
|
28
|
+
module Values
|
29
|
+
#
|
30
|
+
# Represents a host-name (ex: `www.example.com`).
|
31
|
+
#
|
32
|
+
# @api public
|
33
|
+
#
|
34
|
+
class Host < Value
|
35
|
+
|
36
|
+
# The host name.
|
37
|
+
#
|
38
|
+
# @return [String]
|
39
|
+
attr_reader :name
|
40
|
+
|
41
|
+
#
|
42
|
+
# Initializes the host object.
|
43
|
+
#
|
44
|
+
# @param [String] name
|
45
|
+
# The host name.
|
46
|
+
#
|
47
|
+
def initialize(name)
|
48
|
+
@name = name
|
49
|
+
end
|
50
|
+
|
51
|
+
#
|
52
|
+
# Compares the value to another value.
|
53
|
+
#
|
54
|
+
# @param [Values::Value] other
|
55
|
+
# The other value to compare.
|
56
|
+
#
|
57
|
+
# @return [Boolean]
|
58
|
+
# Indicates whether the other value is a kind of {Host} and has the
|
59
|
+
# same host name.
|
60
|
+
#
|
61
|
+
def eql?(other)
|
62
|
+
self.class == other.class && @name == other.name
|
63
|
+
end
|
64
|
+
|
65
|
+
#
|
66
|
+
# Case equality method used for fuzzy matching.
|
67
|
+
#
|
68
|
+
# @param [Value] other
|
69
|
+
# The other value to compare.
|
70
|
+
#
|
71
|
+
# @return [Boolean]
|
72
|
+
# Imdicates whether the other value is either a {Host} and has the
|
73
|
+
# same host name, or an {IP}, {Website}, {URL} with the same host
|
74
|
+
# name.
|
75
|
+
#
|
76
|
+
def ===(other)
|
77
|
+
case other
|
78
|
+
when Host
|
79
|
+
@name == other.name
|
80
|
+
when IP, Website, URL
|
81
|
+
@name == other.host
|
82
|
+
else
|
83
|
+
false
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
#
|
88
|
+
# The "hash" value of the host name.
|
89
|
+
#
|
90
|
+
# @return [Integer]
|
91
|
+
# The hash of the {#name}.
|
92
|
+
#
|
93
|
+
def hash
|
94
|
+
[self.class, @name].hash
|
95
|
+
end
|
96
|
+
|
97
|
+
#
|
98
|
+
# Converts the IP object to a String.
|
99
|
+
#
|
100
|
+
# @return [String]
|
101
|
+
# The host name.
|
102
|
+
#
|
103
|
+
def to_s
|
104
|
+
@name.to_s
|
105
|
+
end
|
106
|
+
|
107
|
+
alias to_str to_s
|
108
|
+
|
109
|
+
#
|
110
|
+
# Coerces the host value into JSON.
|
111
|
+
#
|
112
|
+
# @return [Hash{Symbol => Object}]
|
113
|
+
# The Ruby Hash that will be converted into JSON.
|
114
|
+
#
|
115
|
+
def as_json
|
116
|
+
{type: :host, name: @name}
|
117
|
+
end
|
118
|
+
|
119
|
+
#
|
120
|
+
# Returns the type or kind of recon value.
|
121
|
+
#
|
122
|
+
# @return [:host]
|
123
|
+
#
|
124
|
+
# @note
|
125
|
+
# This is used internally to map a recon value class to a printable
|
126
|
+
# type.
|
127
|
+
#
|
128
|
+
# @api private
|
129
|
+
#
|
130
|
+
def self.value_type
|
131
|
+
:host
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# ronin-recon - A micro-framework and tool for performing reconnaissance.
|
4
|
+
#
|
5
|
+
# Copyright (c) 2023-2024 Hal Brodigan (postmodern.mod3@gmail.com)
|
6
|
+
#
|
7
|
+
# ronin-recon 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-recon 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-recon. If not, see <https://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
|
21
|
+
require 'ronin/recon/value'
|
22
|
+
|
23
|
+
module Ronin
|
24
|
+
module Recon
|
25
|
+
module Values
|
26
|
+
#
|
27
|
+
# Represents an IP address.
|
28
|
+
#
|
29
|
+
# @api public
|
30
|
+
#
|
31
|
+
class IP < Value
|
32
|
+
|
33
|
+
# The IP address.
|
34
|
+
#
|
35
|
+
# @return [String]
|
36
|
+
attr_reader :address
|
37
|
+
|
38
|
+
# The optional parent host name.
|
39
|
+
#
|
40
|
+
# @return [String, nil]
|
41
|
+
attr_reader :host
|
42
|
+
|
43
|
+
#
|
44
|
+
# Initializes the IP object.
|
45
|
+
#
|
46
|
+
# @param [String] address
|
47
|
+
# The IP address.
|
48
|
+
#
|
49
|
+
# @param [String, nil] host
|
50
|
+
# The host name for the IP address.
|
51
|
+
#
|
52
|
+
def initialize(address, host: nil)
|
53
|
+
@address = address
|
54
|
+
@host = host
|
55
|
+
end
|
56
|
+
|
57
|
+
#
|
58
|
+
# Compares the value to another value.
|
59
|
+
#
|
60
|
+
# @param [Values::Value] other
|
61
|
+
# The other value to compare.
|
62
|
+
#
|
63
|
+
# @return [Boolean]
|
64
|
+
# Indicates whether the other value is a kind of {IP} and has the
|
65
|
+
# same address.
|
66
|
+
#
|
67
|
+
def eql?(other)
|
68
|
+
other.kind_of?(self.class) && @address == other.address
|
69
|
+
end
|
70
|
+
|
71
|
+
alias === eql?
|
72
|
+
|
73
|
+
#
|
74
|
+
# The "hash" value for the IP address.
|
75
|
+
#
|
76
|
+
# @return [Integer]
|
77
|
+
# The hash of the {#address}.
|
78
|
+
#
|
79
|
+
def hash
|
80
|
+
[self.class, @address].hash
|
81
|
+
end
|
82
|
+
|
83
|
+
#
|
84
|
+
# Converts the IP object to a String.
|
85
|
+
#
|
86
|
+
# @return [String]
|
87
|
+
# The IP address.
|
88
|
+
#
|
89
|
+
def to_s
|
90
|
+
@address.to_s
|
91
|
+
end
|
92
|
+
|
93
|
+
alias to_str to_s
|
94
|
+
|
95
|
+
#
|
96
|
+
# Coerces the IP value into JSON.
|
97
|
+
#
|
98
|
+
# @return [Hash{Symbol => Object}]
|
99
|
+
# The Ruby Hash that will be converted into JSON.
|
100
|
+
#
|
101
|
+
def as_json
|
102
|
+
{type: :ip, address: @address}
|
103
|
+
end
|
104
|
+
|
105
|
+
#
|
106
|
+
# Returns the type or kind of recon value.
|
107
|
+
#
|
108
|
+
# @return [:ip]
|
109
|
+
#
|
110
|
+
# @note
|
111
|
+
# This is used internally to map a recon value class to a printable
|
112
|
+
# type.
|
113
|
+
#
|
114
|
+
# @api private
|
115
|
+
#
|
116
|
+
def self.value_type
|
117
|
+
:ip
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# ronin-recon - A micro-framework and tool for performing reconnaissance.
|
4
|
+
#
|
5
|
+
# Copyright (c) 2023-2024 Hal Brodigan (postmodern.mod3@gmail.com)
|
6
|
+
#
|
7
|
+
# ronin-recon 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-recon 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-recon. If not, see <https://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
|
21
|
+
require 'ronin/recon/value'
|
22
|
+
require 'ronin/recon/values/ip'
|
23
|
+
|
24
|
+
require 'ronin/support/network/ip_range'
|
25
|
+
|
26
|
+
module Ronin
|
27
|
+
module Recon
|
28
|
+
module Values
|
29
|
+
#
|
30
|
+
# Represents a IP CIDR or glob range.
|
31
|
+
#
|
32
|
+
# @api public
|
33
|
+
#
|
34
|
+
class IPRange < Value
|
35
|
+
|
36
|
+
# The IP range.
|
37
|
+
#
|
38
|
+
# @return [Ronin::Support::Network::IPRange]
|
39
|
+
attr_reader :range
|
40
|
+
|
41
|
+
#
|
42
|
+
# Initializes the IP range object.
|
43
|
+
#
|
44
|
+
# @param [Ronin::Support::Network::IPRange, String] range
|
45
|
+
# The IP range string.
|
46
|
+
#
|
47
|
+
# @raise [ArgumentError]
|
48
|
+
# The given range was not an `Ronin::Support::Network::IPRange` or
|
49
|
+
# `String` object.
|
50
|
+
#
|
51
|
+
def initialize(range)
|
52
|
+
@range = case range
|
53
|
+
when Support::Network::IPRange
|
54
|
+
range
|
55
|
+
when String
|
56
|
+
Support::Network::IPRange.new(range)
|
57
|
+
else
|
58
|
+
raise(ArgumentError,"IP range must be either an IPAddr or String: #{range.inspect}")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
#
|
63
|
+
# Determines if an IP address exists within the IP range.
|
64
|
+
#
|
65
|
+
# @param [Ronin::Support::Network::IPRange, IPAddr, String] ip
|
66
|
+
# The IP address to test.
|
67
|
+
#
|
68
|
+
# @return [Boolean]
|
69
|
+
# Indicates whether the IP address exists within the IP range.
|
70
|
+
#
|
71
|
+
def include?(ip)
|
72
|
+
@range.include?(ip)
|
73
|
+
end
|
74
|
+
|
75
|
+
#
|
76
|
+
# Case equality method used for fuzzy matching.
|
77
|
+
#
|
78
|
+
# @param [Value] other
|
79
|
+
# The other value to compare.
|
80
|
+
#
|
81
|
+
# @return [Boolean]
|
82
|
+
# Imdicates whether the other value is either another {IPRange} that
|
83
|
+
# intersects with the IP range, or an {IP} and exists within the IP
|
84
|
+
# range.
|
85
|
+
#
|
86
|
+
def ===(other)
|
87
|
+
case other
|
88
|
+
when IPRange then @range === other.range
|
89
|
+
when IP then include?(other.address)
|
90
|
+
else false
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
#
|
95
|
+
# Compares the value to another value.
|
96
|
+
#
|
97
|
+
# @param [Values::Value] other
|
98
|
+
#
|
99
|
+
# @return [Boolean]
|
100
|
+
#
|
101
|
+
def eql?(other)
|
102
|
+
other.kind_of?(self.class) && @range == other.range
|
103
|
+
end
|
104
|
+
|
105
|
+
#
|
106
|
+
# The "hash" value of the IP range.
|
107
|
+
#
|
108
|
+
# @return [Integer]
|
109
|
+
# The hash value of {#range}.
|
110
|
+
#
|
111
|
+
def hash
|
112
|
+
[self.class, @range].hash
|
113
|
+
end
|
114
|
+
|
115
|
+
#
|
116
|
+
# Converts the IP range object to a String.
|
117
|
+
#
|
118
|
+
# @return [String]
|
119
|
+
# The IP range.
|
120
|
+
#
|
121
|
+
def to_s
|
122
|
+
@range.to_s
|
123
|
+
end
|
124
|
+
|
125
|
+
alias to_str to_s
|
126
|
+
|
127
|
+
#
|
128
|
+
# Coerces the IP range value into JSON.
|
129
|
+
#
|
130
|
+
# @return [Hash{Symbol => Object}]
|
131
|
+
# The Ruby Hash that will be converted into JSON.
|
132
|
+
#
|
133
|
+
def as_json
|
134
|
+
{type: :ip_range, range: @range.to_s}
|
135
|
+
end
|
136
|
+
|
137
|
+
#
|
138
|
+
# Returns the type or kind of recon value.
|
139
|
+
#
|
140
|
+
# @return [:ip_range]
|
141
|
+
#
|
142
|
+
# @note
|
143
|
+
# This is used internally to map a recon value class to a printable
|
144
|
+
# type.
|
145
|
+
#
|
146
|
+
# @api private
|
147
|
+
#
|
148
|
+
def self.value_type
|
149
|
+
:ip_range
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# ronin-recon - A micro-framework and tool for performing reconnaissance.
|
4
|
+
#
|
5
|
+
# Copyright (c) 2023-2024 Hal Brodigan (postmodern.mod3@gmail.com)
|
6
|
+
#
|
7
|
+
# ronin-recon 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-recon 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-recon. If not, see <https://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
|
21
|
+
require 'ronin/recon/values/host'
|
22
|
+
|
23
|
+
module Ronin
|
24
|
+
module Recon
|
25
|
+
module Values
|
26
|
+
#
|
27
|
+
# Represents a discovered mailserver.
|
28
|
+
#
|
29
|
+
# @api public
|
30
|
+
#
|
31
|
+
class Mailserver < Host
|
32
|
+
|
33
|
+
#
|
34
|
+
# Coerces the mailserver value into JSON.
|
35
|
+
#
|
36
|
+
# @return [Hash{Symbol => Object}]
|
37
|
+
# The Ruby Hash that will be converted into JSON.
|
38
|
+
#
|
39
|
+
def as_json
|
40
|
+
{type: :mailserver, name: @name}
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# Returns the type or kind of recon value.
|
45
|
+
#
|
46
|
+
# @return [:mailserver]
|
47
|
+
#
|
48
|
+
# @note
|
49
|
+
# This is used internally to map a recon value class to a printable
|
50
|
+
# type.
|
51
|
+
#
|
52
|
+
# @api private
|
53
|
+
#
|
54
|
+
def self.value_type
|
55
|
+
:mailserver
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# ronin-recon - A micro-framework and tool for performing reconnaissance.
|
4
|
+
#
|
5
|
+
# Copyright (c) 2023-2024 Hal Brodigan (postmodern.mod3@gmail.com)
|
6
|
+
#
|
7
|
+
# ronin-recon 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-recon 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-recon. If not, see <https://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
|
21
|
+
require 'ronin/recon/values/host'
|
22
|
+
|
23
|
+
module Ronin
|
24
|
+
module Recon
|
25
|
+
module Values
|
26
|
+
#
|
27
|
+
# Represents a discovered DNS nameserver.
|
28
|
+
#
|
29
|
+
# @api public
|
30
|
+
#
|
31
|
+
class Nameserver < Host
|
32
|
+
|
33
|
+
#
|
34
|
+
# Coerces the nameserver value into JSON.
|
35
|
+
#
|
36
|
+
# @return [Hash{Symbol => Object}]
|
37
|
+
# The Ruby Hash that will be converted into JSON.
|
38
|
+
#
|
39
|
+
def as_json
|
40
|
+
{type: :nameserver, name: @name}
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# Returns the type or kind of recon value.
|
45
|
+
#
|
46
|
+
# @return [:nameserver]
|
47
|
+
#
|
48
|
+
# @note
|
49
|
+
# This is used internally to map a recon value class to a printable
|
50
|
+
# type.
|
51
|
+
#
|
52
|
+
# @api private
|
53
|
+
#
|
54
|
+
def self.value_type
|
55
|
+
:nameserver
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|