rapid7/metasploit-framework

View on GitHub
lib/msf/core/exploit/remote/unirpc.rb

Summary

Maintainability
D
1 day
Test Coverage

Method build_unirpc_message has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

        def build_unirpc_message(
          version_byte: 0x6c,
          other_version_byte: 0x01,
          body_length_override: nil,

Severity: Minor
Found in lib/msf/core/exploit/remote/unirpc.rb - About 5 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 recv_unirpc_message has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def recv_unirpc_message(sock, first_result_is_status: false)
          # Receive the header
          header = sock.get_once(0x18)

          # Make sure we received all of it
Severity: Major
Found in lib/msf/core/exploit/remote/unirpc.rb - About 3 hrs to fix

    Method build_unirpc_message has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def build_unirpc_message(
              version_byte: 0x6c,
              other_version_byte: 0x01,
              body_length_override: nil,
    
    
    Severity: Major
    Found in lib/msf/core/exploit/remote/unirpc.rb - About 3 hrs to fix

      Method recv_unirpc_message has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

              def recv_unirpc_message(sock, first_result_is_status: false)
                # Receive the header
                header = sock.get_once(0x18)
      
                # Make sure we received all of it
      Severity: Minor
      Found in lib/msf/core/exploit/remote/unirpc.rb - About 1 hr 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 unirpc_get_version has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def unirpc_get_version
                # These are the services we've found that return version numbers
                ['defcs', 'udserver'].each do |service|
                  vprint_status("Trying to get version number from service #{service}...")
                  connect
      Severity: Minor
      Found in lib/msf/core/exploit/remote/unirpc.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