From 2b3a723557b6878e19d723a72885f8d6e942ca8a Mon Sep 17 00:00:00 2001 From: Spencer McIntyre Date: Tue, 19 Mar 2024 20:49:28 -0400 Subject: [PATCH 1/2] Consistently refer to black hole as two words --- lib/msf/ui/console/command_dispatcher/dns.rb | 2 +- lib/rex/proto/dns/resolver.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/msf/ui/console/command_dispatcher/dns.rb b/lib/msf/ui/console/command_dispatcher/dns.rb index 05954952a8ed..d17b77a6ae6a 100755 --- a/lib/msf/ui/console/command_dispatcher/dns.rb +++ b/lib/msf/ui/console/command_dispatcher/dns.rb @@ -325,7 +325,7 @@ def add_dns_help print_line @@add_opts.usage print_line "RESOLVERS:" print_line " ipv4 / ipv6 address - The IP address of an upstream DNS server to resolve from" - print_line " blackhole - Drop all queries" + print_line " black-hole - Drop all queries" print_line " static - Reply with statically configured addresses (only for A/AAAA records)" print_line " system - Use the host operating systems DNS resolution functionality (only for A/AAAA records)" print_line diff --git a/lib/rex/proto/dns/resolver.rb b/lib/rex/proto/dns/resolver.rb index 3a3f0211cfe5..9b79712df2ad 100644 --- a/lib/rex/proto/dns/resolver.rb +++ b/lib/rex/proto/dns/resolver.rb @@ -162,7 +162,7 @@ def send(argument, type = Dnsruby::Types::A, cls = Dnsruby::Classes::IN) upstream_resolvers.each do |upstream_resolver| case upstream_resolver.type when UpstreamResolver::Type::BLACK_HOLE - ans = resolve_via_blackhole(upstream_resolver, packet, type, cls) + ans = resolve_via_black_hole(upstream_resolver, packet, type, cls) when UpstreamResolver::Type::DNS_SERVER ans = resolve_via_dns_server(upstream_resolver, packet, type, cls) when UpstreamResolver::Type::STATIC @@ -450,9 +450,9 @@ def resolve_via_dns_server(upstream_resolver, packet, type, _cls) ans end - def resolve_via_blackhole(upstream_resolver, packet, type, cls) + def resolve_via_black_hole(upstream_resolver, packet, type, cls) # do not just return nil because that will cause the next resolver to be used - @logger.info "No response from upstream resolvers: blackholed" + @logger.info "No response from upstream resolvers: black-hole" raise NoResponseError end From b363f6f87d8ec847e82cbe14fe6de9227d6dd67d Mon Sep 17 00:00:00 2001 From: Spencer McIntyre Date: Wed, 20 Mar 2024 10:57:04 -0400 Subject: [PATCH 2/2] Alias blackhole to black-hole in the UI --- lib/msf/ui/console/command_dispatcher/dns.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/msf/ui/console/command_dispatcher/dns.rb b/lib/msf/ui/console/command_dispatcher/dns.rb index d17b77a6ae6a..c208f462be3b 100755 --- a/lib/msf/ui/console/command_dispatcher/dns.rb +++ b/lib/msf/ui/console/command_dispatcher/dns.rb @@ -270,6 +270,7 @@ def add_dns(*args) comm = val when nil + val = 'black-hole' if val.casecmp?('blackhole') resolvers << val else raise ::ArgumentError.new("Unknown flag: #{opt}") @@ -325,9 +326,9 @@ def add_dns_help print_line @@add_opts.usage print_line "RESOLVERS:" print_line " ipv4 / ipv6 address - The IP address of an upstream DNS server to resolve from" - print_line " black-hole - Drop all queries" - print_line " static - Reply with statically configured addresses (only for A/AAAA records)" - print_line " system - Use the host operating systems DNS resolution functionality (only for A/AAAA records)" + print_line " #{Rex::Proto::DNS::UpstreamResolver::Type::BLACK_HOLE.to_s.ljust(19)} - Drop all queries" + print_line " #{Rex::Proto::DNS::UpstreamResolver::Type::STATIC.to_s.ljust(19) } - Reply with statically configured addresses (only for A/AAAA records)" + print_line " #{Rex::Proto::DNS::UpstreamResolver::Type::SYSTEM.to_s.ljust(19) } - Use the host operating systems DNS resolution functionality (only for A/AAAA records)" print_line print_line "EXAMPLES:" print_line " Set the DNS server(s) to be used for *.metasploit.com to 192.168.1.10"