From 4c835545a3c618da33cb316db1a0c7b2f4b29372 Mon Sep 17 00:00:00 2001 From: Spencer McIntyre Date: Mon, 25 Mar 2024 14:44:49 -0400 Subject: [PATCH 1/2] Ignore the hosts file if it can't be loaded --- lib/rex/proto/dns/resolver.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/rex/proto/dns/resolver.rb b/lib/rex/proto/dns/resolver.rb index 9b79712df2ad..6aa1345e6ace 100644 --- a/lib/rex/proto/dns/resolver.rb +++ b/lib/rex/proto/dns/resolver.rb @@ -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 + rescue StandardError => e + @logger.error 'Failed to parse the hosts file, ignoring it' + # 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 From 6d1d20cdbe19323232554e36be1375850811d77c Mon Sep 17 00:00:00 2001 From: Spencer McIntyre Date: Mon, 25 Mar 2024 14:46:14 -0400 Subject: [PATCH 2/2] Bump rex-socket to include changes from #66 --- Gemfile.lock | 2 +- LICENSE_GEMS | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6ca56c1a5aea..aabf8b25402e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 diff --git a/LICENSE_GEMS b/LICENSE_GEMS index eeecd601d1c9..9e8eee06c8f7 100644 --- a/LICENSE_GEMS +++ b/LICENSE_GEMS @@ -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"