File dns.rb
has 611 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Msf
module Ui
module Console
module CommandDispatcher
Method add_dns
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
def add_dns(*args)
rules = ['*']
first_rule = true
comm = nil
resolvers = []
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method cmd_dns_tabs
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def cmd_dns_tabs(str, words)
return if driver.framework.dns_resolver.nil?
subcommands = %w[ add add-static delete flush-cache flush-entries flush-static help print query remove remove-static reset-config resolve ]
if words.length == 1
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Class DNS
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class DNS
include Msf::Ui::Console::CommandDispatcher
ADD_USAGE = 'dns [add] [--index <insertion index>] [--rule <wildcard DNS entry>] [--session <session id>] <resolver> ...'.freeze
Method add_dns
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_dns(*args)
rules = ['*']
first_rule = true
comm = nil
resolvers = []
Method resolve_dns
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def resolve_dns(*args)
names = []
query_type = Dnsruby::Types::A
@@resolve_opts.parse(args) do |opt, idx, val|
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method resolve_dns
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resolve_dns(*args)
names = []
query_type = Dnsruby::Types::A
@@resolve_opts.parse(args) do |opt, idx, val|
Method cmd_dns_tabs
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cmd_dns_tabs(str, words)
return if driver.framework.dns_resolver.nil?
subcommands = %w[ add add-static delete flush-cache flush-entries flush-static help print query remove remove-static reset-config resolve ]
if words.length == 1
Method reset_config_dns
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def reset_config_dns(*args)
add_system_resolver = false
should_confirm = true
@@reset_config_opts.parse(args) do |opt, idx, val|
case opt
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method print_dns
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def print_dns
default_domain = 'N/A'
if resolver.defname? && resolver.domain.present?
default_domain = resolver.domain
end
Method cmd_dns
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cmd_dns(*args)
if driver.framework.dns_resolver.nil?
print_warning("Run the #{Msf::Ui::Tip.highlight("save")} command and restart the console for this feature configuration to take effect.")
return
end
Method cmd_dns_help
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cmd_dns_help(*args)
if args.first.present?
handler = "#{args.first.gsub('-', '_')}_dns"
if respond_to?("#{handler}_help")
# if it is a valid command with dedicated help information
Method remove_dns
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def remove_dns(*args)
remove_ids = []
@@remove_opts.parse(args) do |opt, idx, val|
case opt
when '-i', '--index'
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method reset_config_dns
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def reset_config_dns(*args)
add_system_resolver = false
should_confirm = true
@@reset_config_opts.parse(args) do |opt, idx, val|
case opt
Method cmd_dns
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def cmd_dns(*args)
if driver.framework.dns_resolver.nil?
print_warning("Run the #{Msf::Ui::Tip.highlight("save")} command and restart the console for this feature configuration to take effect.")
return
end
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method print_dns
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def print_dns
default_domain = 'N/A'
if resolver.defname? && resolver.domain.present?
default_domain = resolver.domain
end
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method prettify_comm
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def prettify_comm(comm, upstream_resolver)
if !Rex::Socket.is_ip_addr?(upstream_resolver.destination)
'N/A'
elsif comm.nil?
channel = Rex::Socket::SwitchBoard.best_comm(upstream_resolver.destination)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return session_ids.select { |id| id.start_with?(str) }
Avoid too many return
statements within this method. Open
return
Avoid too many return
statements within this method. Open
return ip_addresses.map(&:to_s).select { |ip_address| ip_address.start_with?(str) }
Avoid too many return
statements within this method. Open
return subcommands.select { |sc| sc.start_with?(str) }
Avoid too many return
statements within this method. Open
return resolver.static_hostnames.each.select { |hostname,_| hostname.downcase.start_with?(str.downcase) }.map { |hostname,_| hostname }
Avoid too many return
statements within this method. Open
return options
Avoid too many return
statements within this method. Open
return @@remove_opts.option_keys.select { |opt| opt.start_with?(str) }
Avoid too many return
statements within this method. Open
return families.select { |family| family.downcase.start_with?(str.downcase) }
Avoid too many return
statements within this method. Open
return
Avoid too many return
statements within this method. Open
return resolver.static_hostnames.each.select { |hostname,_| hostname.downcase.start_with?(str.downcase) }.map { |hostname,_| hostname }
Method remove_static_dns
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def remove_static_dns(*args)
if args.length < 1
raise ::ArgumentError.new('A hostname must be provided')
end
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"