Skip to content

Commit

Permalink
Land #18974, Consistently refer to black hole as two words
Browse files Browse the repository at this point in the history
  • Loading branch information
adfoster-r7 authored Mar 20, 2024
2 parents d03dfe8 + b363f6f commit 0399768
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions lib/msf/ui/console/command_dispatcher/dns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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 " blackhole - 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"
Expand Down
6 changes: 3 additions & 3 deletions lib/rex/proto/dns/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 0399768

Please sign in to comment.