rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

Method parse_cgi_qstring has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_cgi_qstring(str)
    qstring = {}

    # Delimit on each variable
    str.split(/[;&]/).each { |vv|
Severity: Minor
Found in lib/rex/proto/http/request.rb - About 55 mins to fix

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 is_method_frame? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def is_method_frame?(resp, klass=nil)
    return false unless resp.is_a?(Version091::Frames::AmqpVersion091MethodFrame)

    if klass
      return false unless resp.class_id == klass::CLASS_ID
Severity: Minor
Found in lib/rex/proto/amqp/version_0_9_1/client.rb - About 55 mins to fix

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 generate_request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def self.generate_request(subject, type = Dnsruby::Types::A, cls = Dnsruby::Classes::IN, recurse = 1)
    case subject
    when IPAddr
      name = subject.reverse
      type = Dnsruby::Types::PTR
Severity: Minor
Found in lib/rex/proto/dns/packet.rb - About 55 mins to fix

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 search has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def search(name, type = Dnsruby::Types::A, cls = Dnsruby::Classes::IN)
      return query(name,type,cls) if name.class == IPAddr
      # If the name contains at least one dot then try it as is first.
      if name.include? "."
        @logger.debug "Search(#{name},#{Dnsruby::Types.new(type)},#{Dnsruby::Classes.new(cls)})"
Severity: Minor
Found in lib/rex/proto/dns/resolver.rb - About 55 mins to fix

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 write has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def write(buf, opts = {})
    total_sent   = 0
    total_length = buf.length
    block_size   = 32768

Severity: Minor
Found in lib/rex/proto/ssh/connection.rb - About 55 mins to fix

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 calculate_checksums! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def calculate_checksums!(service_key: nil, krbtgt_key: nil)
      server_checksum = nil
      priv_server_checksum = nil
      full_pac_checksum = nil
      pac_info_buffers.each do |info_buffer|
Severity: Minor
Found in lib/rex/proto/kerberos/pac/krb5_pac.rb - About 55 mins to fix

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 find has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def find(search, type = Dnsruby::Types::A)
      self.records.select do |record,expire|
        record.type == type and (expire < 1 or expire > ::Time.now.to_i) and
        (
          record.name == '*' or
Severity: Minor
Found in lib/rex/proto/dns/cache.rb - About 55 mins to fix

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 collect_host_vuln_id has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def collect_host_vuln_id
      return unless in_tag("device")
      return unless in_tag("vulnerability")
      return if in_tag("service")
      return unless @state[:host_vuln_id]
Severity: Minor
Found in lib/rex/parser/nexpose_simple_document.rb - About 55 mins to fix

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 create_path has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def create_path(nodes, edges)
          path = []

          # the initial choices are any node without a predecessor (dependency)
          targets = edges.map(&:target)
Severity: Minor
Found in lib/rex/payloads/shuffle.rb - About 55 mins to fix

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 collect_report_item_reference_url has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def collect_report_item_reference_url
      return unless in_tag("ReportItem")
      return unless in_tag("References")
      return unless in_tag("Reference")
      return unless @text
Severity: Minor
Found in lib/rex/parser/acunetix_document.rb - About 55 mins to fix

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 host_is_okay has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def host_is_okay
      return false unless @report_data[:host]
      return false unless valid_ip(@report_data[:host])
      return false unless @report_data[:state] == Msf::HostState::Alive
      if @args[:blacklist]
Severity: Minor
Found in lib/rex/parser/mbsa_document.rb - About 55 mins to fix

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 interact_stream has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def interact_stream(stream)
    while self.interacting && _remote_fd(stream)

      # Select input and rstream
      sd = Rex::ThreadSafe.select([ _local_fd, _remote_fd(stream) ], nil, nil, 0.25)
Severity: Minor
Found in lib/rex/ui/interactive.rb - About 55 mins to fix

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 parse_ini has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_ini(file)
      results = []
      raise RuntimeError, 'No data to parse' if file.nil? || file.empty?

      ini = Rex::Parser::Ini.from_s(file)
Severity: Minor
Found in lib/rex/parser/winscp.rb - About 55 mins to fix

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 collect_tag has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def collect_tag
      return unless in_tag("tag")
      return unless in_tag("tags")
      return unless in_tag("vulnerability")
      return unless @state[:vuln]
Severity: Minor
Found in lib/rex/parser/nexpose_raw_document.rb - About 55 mins to fix

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 collect_host_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def collect_host_data
      return unless in_tag("node")
      @report_data[:host] = @state[:address]
      @report_data[:state] = Msf::HostState::Alive
      @report_data[:name] = @state[:hostname] if @state[:hostname]
Severity: Minor
Found in lib/rex/parser/nexpose_raw_document.rb - About 55 mins to fix

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 collect_path_and_query has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def collect_path_and_query
      return unless in_item
      return unless has_text
      path,query = @text.split(/\?+/,2)
      return unless path
Severity: Minor
Found in lib/rex/parser/burp_session_document.rb - About 55 mins to fix

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 host_is_okay has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def host_is_okay
      return false unless @report_data[:host]
      return false unless valid_ip(@report_data[:host])
      return false unless @report_data[:state] == Msf::HostState::Alive
      if @args[:blacklist]
Severity: Minor
Found in lib/rex/parser/nokogiri_doc_mixin.rb - About 55 mins to fix

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 mft_record_attribute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def mft_record_attribute(mft_record, lazy=true)
        attribute_list_offset = mft_record[20, 2].unpack('C')[0]
        curs = attribute_list_offset
        attribute_identifier = mft_record[curs, 4].unpack('V')[0]
        res = {}
Severity: Minor
Found in lib/rex/parser/fs/ntfs.rb - About 55 mins to fix

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 report_web_site has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def report_web_site(&block)
      return unless @state[:uri].kind_of? URI::HTTP
      vhost = @state[:uri].host
      web_site_info = {:workspace => @args[:workspace]}
      web_site_info[:vhost] = vhost
Severity: Minor
Found in lib/rex/parser/burp_session_document.rb - About 55 mins to fix

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 decrypt has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def self.decrypt(encrypted_data)
    password = ""
    return password unless encrypted_data

    password = ""
Severity: Minor
Found in lib/rex/parser/group_policy_preferences.rb - About 55 mins to fix

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

Severity
Category
Status
Source
Language