Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ GEM
metasm
rex-core
rex-text
rex-socket (0.1.56)
rex-socket (0.1.57)
rex-core
rex-sslscan (0.1.10)
rex-core
Expand Down
2 changes: 1 addition & 1 deletion LICENSE_GEMS
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ rex-powershell, 0.1.99, "New BSD"
rex-random_identifier, 0.1.11, "New BSD"
rex-registry, 0.1.5, "New BSD"
rex-rop_builder, 0.1.5, "New BSD"
rex-socket, 0.1.56, "New BSD"
rex-socket, 0.1.57, "New BSD"
rex-sslscan, 0.1.10, "New BSD"
rex-struct2, 0.1.4, "New BSD"
rex-text, 0.2.56, "New BSD"
Expand Down
9 changes: 8 additions & 1 deletion lib/rex/proto/dns/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,15 @@ def initialize(config = {})
raise ResolverArgumentError, "Option #{key} not valid"
end
end

self.static_hostnames = StaticHostnames.new(hostnames: static_hosts)
self.static_hostnames.parse_hosts_file
begin
self.static_hostnames.parse_hosts_file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to ignore the individual entries that break? 👀

i.e. If an invalid entry is the first line of the /etc/hosts file, we could ignore that individual host and continue to parse the rest of the file with 127.0.0.1 localhost etc

rescue StandardError => e
@logger.error 'Failed to parse the hosts file, ignoring it'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the default @logger is /dev/null:

[11] pry(#<Rex::Proto::DNS::CachedResolver>)> @config[:log_file]
=> "/dev/null"

Which in this scenario might not be useful if folk want to debug issues/report framework issues; Is it possible to wire it up to the framework logging

# if the hosts file is corrupted, just use a default instance with any specified hostnames
self.static_hostnames = StaticHostnames.new(hostnames: static_hosts)
end
end
#
# Provides current proxy setting if configured
Expand Down