rapid7/metasploit-framework

View on GitHub
lib/rex/proto/dcerpc/client.rb

Summary

Maintainability
D
1 day
Test Coverage

Method read has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def read()

    max_read = self.options['pipe_read_max_size'] || 1024*1024
    min_read = self.options['pipe_read_min_size'] || max_read

Severity: Minor
Found in lib/rex/proto/dcerpc/client.rb - About 3 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 call has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def call(function, data, do_recv = true)

    frag_size = data.length
    if options['frag_size']
      frag_size = options['frag_size']
Severity: Minor
Found in lib/rex/proto/dcerpc/client.rb - About 1 hr to fix

    Method call has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def call(function, data, do_recv = true)
    
        frag_size = data.length
        if options['frag_size']
          frag_size = options['frag_size']
    Severity: Minor
    Found in lib/rex/proto/dcerpc/client.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 bind has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def bind()
        bind = ''
        context = ''
        if self.options['fake_multi_bind']
    
    
    Severity: Minor
    Found in lib/rex/proto/dcerpc/client.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 read has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def read()
    
        max_read = self.options['pipe_read_max_size'] || 1024*1024
        min_read = self.options['pipe_read_min_size'] || max_read
    
    
    Severity: Minor
    Found in lib/rex/proto/dcerpc/client.rb - About 1 hr to fix

      Method socket_setup has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def socket_setup()
          ctx = { 'Msf' => self.options['Msf'], 'MsfExploit' => self.options['MsfExploit'] }
          self.socket = case self.handle.protocol
      
            when 'ncacn_ip_tcp'
      Severity: Minor
      Found in lib/rex/proto/dcerpc/client.rb - About 1 hr to fix

        Method bind has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def bind()
            bind = ''
            context = ''
            if self.options['fake_multi_bind']
        
        
        Severity: Minor
        Found in lib/rex/proto/dcerpc/client.rb - About 1 hr to fix

          Avoid deeply nested control flow statements.
          Open

                      break if not data.length
          Severity: Major
          Found in lib/rex/proto/dcerpc/client.rb - About 45 mins to fix

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

              def socket_check()
                if self.socket == nil
                  self.socket_setup()
                end
            
            
            Severity: Minor
            Found in lib/rex/proto/dcerpc/client.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

                        break if not data
            Severity: Major
            Found in lib/rex/proto/dcerpc/client.rb - About 45 mins to fix

              Method read_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.read_response(socket, timeout=self.options['read_timeout'])
              
                  data = socket.get_once(-1, timeout)
              
                  # We need at least 10 bytes to find the FragLen
              Severity: Minor
              Found in lib/rex/proto/dcerpc/client.rb - About 35 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 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def write(data)
              
                  max_write = self.options['pipe_write_max_size'] || data.length
                  min_write = self.options['pipe_write_min_size'] || max_write
              
              
              Severity: Minor
              Found in lib/rex/proto/dcerpc/client.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

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

                def initialize(handle, socket, useroptions = Hash.new)
                  self.handle = handle
                  self.socket = socket
                  self.options = {
                    'smb_user'   => '',
              Severity: Minor
              Found in lib/rex/proto/dcerpc/client.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