rapid7/metasploit-framework

View on GitHub
lib/msf/core/exploit/remote/http/exchange.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method exchange_get_version has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

          def exchange_get_version(exchange_builds: nil)
            # First check target is actually Exchange
            return nil unless target_running_exchange?

            # If no exchange_builds parameter, call get_exchange_builds to build the Exchange version array.
Severity: Minor
Found in lib/msf/core/exploit/remote/http/exchange.rb - About 2 hrs 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 exchange_get_version has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def exchange_get_version(exchange_builds: nil)
            # First check target is actually Exchange
            return nil unless target_running_exchange?

            # If no exchange_builds parameter, call get_exchange_builds to build the Exchange version array.
Severity: Minor
Found in lib/msf/core/exploit/remote/http/exchange.rb - About 2 hrs to fix

    Avoid too many return statements within this method.
    Open

                  return nil
    Severity: Major
    Found in lib/msf/core/exploit/remote/http/exchange.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                    return Rex::Version.new(Regexp.last_match('build'))
      Severity: Major
      Found in lib/msf/core/exploit/remote/http/exchange.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                      return Rex::Version.new(Regexp.last_match('build'))
        Severity: Major
        Found in lib/msf/core/exploit/remote/http/exchange.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return nil
          Severity: Major
          Found in lib/msf/core/exploit/remote/http/exchange.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return Rex::Version.new(version)
            Severity: Major
            Found in lib/msf/core/exploit/remote/http/exchange.rb - About 30 mins to fix

              Method target_running_exchange? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                        def target_running_exchange?
                          res = send_request_cgi(
                            'method' => 'GET',
                            'uri' => normalize_uri(target_uri.path, '/owa/auth/logon.aspx')
                          )
              Severity: Minor
              Found in lib/msf/core/exploit/remote/http/exchange.rb - About 25 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

              There are no issues that match your filters.

              Category
              Status