rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

Method collect_url has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def collect_url
      return unless in_tag("References")
      return unless in_tag("UpdateData")
      return unless in_tag("Detail")
      return unless in_tag("Check")
Severity: Minor
Found in lib/rex/parser/mbsa_document.rb - About 45 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

Avoid deeply nested control flow statements.
Open

          formatted << (sysinfo.nil? ? default : sysinfo['Architecture'])
Severity: Major
Found in lib/rex/ui/text/shell.rb - About 45 mins to fix

    Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def initialize(container, jid, name, ctx, run_proc, clean_proc)
    Severity: Minor
    Found in lib/rex/job.rb - About 45 mins to fix

      Method collect_host has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def collect_host
            return unless in_tag("Scan")
            return unless @text
            return if @text.strip.empty?
            uri = URI.parse(@text) rescue nil
      Severity: Minor
      Found in lib/rex/parser/acunetix_document.rb - About 45 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_starturl_service has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def report_starturl_service(&block)
            return unless @host_object
            return unless @state[:starturl_uri]
            name = @state[:starturl_uri].scheme
            port = @state[:starturl_uri].port
      Severity: Minor
      Found in lib/rex/parser/acunetix_document.rb - About 45 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

      Avoid deeply nested control flow statements.
      Open

                formatted << (session.respond_to?(:fs) ? session.fs.dir.getwd(refresh: false) : default)
      Severity: Major
      Found in lib/rex/ui/text/shell.rb - About 45 mins to fix

        Method collect_host_vuln has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def collect_host_vuln
              return unless in_tag("vulnerability")
              return unless in_tag("device")
              return if in_tag("service")
              @report_data[:vulns] ||= []
        Severity: Minor
        Found in lib/rex/parser/nexpose_simple_document.rb - About 45 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_os_name has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def collect_os_name
              return unless @state[:check_state]["ID"] == 10101.to_s
              return unless @text
              return if @text.strip.empty?
              os_match = @text.match(/Computer is running (.*)/)
        Severity: Minor
        Found in lib/rex/parser/mbsa_document.rb - About 45 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 spawn has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.spawn(name, crit, *args, &block)
            if @@provider
              if block
                return @@provider.spawn(name, crit, *args){ |*args_copy| block.call(*args_copy) }
              else
        Severity: Minor
        Found in lib/rex/thread_factory.rb - About 45 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_service_fingerprint_description has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def collect_service_fingerprint_description
              return unless in_tag("device")
              return unless in_tag("service")
              return unless in_tag("fingerprint")
              return unless @text
        Severity: Minor
        Found in lib/rex/parser/nexpose_simple_document.rb - About 45 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

        Avoid deeply nested control flow statements.
        Open

                  formatted << (session.respond_to?(:sys) ? session.sys.config.getuid(refresh: false) : default)
        Severity: Major
        Found in lib/rex/ui/text/shell.rb - About 45 mins to fix

          Method record_variable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def record_variable(attrs)
                return unless in_tag("Inputs")
                return unless @state[:fullurl].kind_of? URI
                method = attr_hash(attrs)["Type"]
                return unless method
          Severity: Minor
          Found in lib/rex/parser/acunetix_document.rb - About 45 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_kbitem_service has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def report_kbitem_service(service,&block)
                return unless @host_object
                return unless @state[:starturl_uri]
                addr = @host_object.address
                svc = {
          Severity: Minor
          Found in lib/rex/parser/acunetix_document.rb - About 45 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 construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.construct(opts = {})
              payload = nil
          
              # Generate the recovery stub
              if opts['Recovery'] and Kernel::Recovery.respond_to?(opts['Recovery'], true)
          Severity: Minor
          Found in lib/rex/payloads/win32/kernel.rb - About 45 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 eql? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def eql?(other)
                return false unless other.is_a?(self.class)
                return false unless other.wildcard == wildcard
                return false unless other.resolvers == resolvers
                return false unless other.comm == comm
          Severity: Minor
          Found in lib/rex/proto/dns/upstream_rule.rb - About 45 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_uri_checksum has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def generate_uri_checksum(sum, len=5, prefix="")
                    # Lengths shorter than 4 bytes are unable to match all possible checksums
                    # Lengths of exactly 4 are relatively slow to find for high checksum values
                    # Lengths of 5 or more bytes find a matching checksum fairly quickly (~80ms)
                    if len < URI_CHECKSUM_MIN_LEN
          Severity: Minor
          Found in lib/rex/payloads/meterpreter/uri_checksum.rb - About 45 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 eql? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

             def eql?(other)
                return false unless other.is_a?(self.class)
                return false unless other.type == type
                return false unless other.destination == destination
                return false unless other.socket_options == socket_options
          Severity: Minor
          Found in lib/rex/proto/dns/upstream_resolver.rb - About 45 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

          Avoid deeply nested control flow statements.
          Open

                    if /^(?<p_num>\d{1,5})\/(?<p_proto>.+)\s\((?<p_name>.+)\)/ =~ @text
                      @state[:name] = p_name.gsub(/iana: /i, '')
                      @state[:port] = p_num
                      @state[:proto] = p_proto
                      record_service if p_num
          Severity: Major
          Found in lib/rex/parser/openvas_document.rb - About 45 mins to fix

            Method record_request_and_response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def record_request_and_response
                  return unless(in_issue && has_text)
                  return unless @state[:web_site].present?
                  really_original_traffic = unindent_and_crlf(@text)
                  request_headers, request_body, response_headers, response_body = really_original_traffic.split(/\r\n\r\n/)
            Severity: Minor
            Found in lib/rex/parser/appscan_document.rb - About 45 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 end_element has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def end_element(name=nil)
                  block = @block
                  case name
                  when "entity" # Wrap it up
                    if @state[:address]
            Severity: Minor
            Found in lib/rex/parser/ci_document.rb - About 45 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