rapid7/metasploit-framework

View on GitHub

Showing 21,960 of 21,960 total issues

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

      def search(name,type=Net::DNS::A,cls=Net::DNS::IN)

        # If the name contains at least one dot then try it as is first.
        if name.include? "."
          @logger.debug "Search(#{name},#{Net::DNS::RR::Types.new(type)},#{Net::DNS::RR::Classes.new(cls)})"
Severity: Minor
Found in lib/net/dns/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

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

  def self.lmv2_user_session_key(user, pass, domain, srv_chall, cli_chall, opt = {})
Severity: Minor
Found in lib/rex/proto/ntlm/crypt.rb - About 45 mins to fix

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

        def self.make_ntlmssp_blob_chall(win_domain, win_name, dns_domain, dns_name, chall, flags)
    Severity: Minor
    Found in lib/rex/proto/ntlm/utils.rb - About 45 mins to fix

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

              def start
                if serve_udp
                  @udp_sock = Rex::Socket::Udp.create(sock_options)
                  self.listener_thread = Rex::ThreadFactory.spawn('UDPLDAPServerListener', false) do
                    monitor_listener
      Severity: Minor
      Found in lib/rex/proto/ldap/server.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 stop has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def stop
                ensure_close = [udp_sock, tcp_sock].compact
                begin
                  listener_thread.kill if listener_thread.respond_to?(:kill)
                  self.listener_thread = nil
      Severity: Minor
      Found in lib/rex/proto/ldap/server.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 make_ntlmssp_secblob_chall has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def self.make_ntlmssp_secblob_chall(win_domain, win_name, dns_domain, dns_name, chall, flags)
      Severity: Minor
      Found in lib/rex/proto/ntlm/utils.rb - About 45 mins to fix

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

          def recv_raw(timeout: @timeout)
            remaining = timeout
            frame_size, elapsed_time = Rex::Stopwatch.elapsed_time do
              @conn.get_once(4, remaining)
            end
        Severity: Minor
        Found in lib/rex/proto/thrift/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

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

                def handshake
                  @banner = @sock.get_once(12)
                  if !@banner
                    @error = 'Unable to obtain banner from server'
                    return false
        Severity: Minor
        Found in lib/rex/proto/rfb/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

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

          def self.encrypt_ard(username, password, generator, key_length, prime_modulus, peer_public_key)
        Severity: Minor
        Found in lib/rex/proto/rfb/cipher.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                if temp_response.kind_of? Rex::Proto::Http::Response
                  res = temp_response
                end
          Severity: Major
          Found in lib/rex/proto/http/client.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                    yield("Aborting, got code:%d, type:%d, message:'%s'" % [code, type, data]) if block_given?
            Severity: Major
            Found in lib/rex/proto/tftp/client.rb - About 45 mins to fix

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

                          def initialize(name, value, description)
                            raise ArgumentError, 'Invalid Error Name' unless name.is_a?(String) && !name.empty?
                            raise ArgumentError, 'Invalid Error Code Value' unless value.is_a?(Integer)
                            raise ArgumentError, 'Invalid Error Description' unless description.is_a?(String) && !description.empty?
              
              
              Severity: Minor
              Found in lib/rex/proto/kerberos/model/error.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 request_static_ip has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def self.request_static_ip(magic, dmac, ip, mask, gw, pwd="dbps")
              Severity: Minor
              Found in lib/rex/proto/addp.rb - About 45 mins to fix

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

                  def kerberos_auth(opts={})
                    to = opts['timeout'] || 20
                    auth_result = self.kerberos_authenticator.authenticate(mechanism: Rex::Proto::Gss::Mechanism::KERBEROS)
                    gss_data = auth_result[:security_blob]
                    gss_data_b64 = Rex::Text.encode_base64(gss_data)
                Severity: Minor
                Found in lib/rex/proto/http/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

                              tr[:file][:started] = true if (tr[:file][:once])
                Severity: Major
                Found in lib/rex/proto/tftp/server.rb - About 45 mins to fix

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

                      def wsclose(opts = {})
                        return if closed? # there's nothing to do if the underlying TCP socket has already been closed
                  
                        # this implementation doesn't handle the optional close reasons at all
                        frame = Frame.new(header: { opcode: Opcode::CONNECTION_CLOSE })
                  Severity: Minor
                  Found in lib/rex/proto/http/web_socket.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

                          yield("Aborting, got error type:%d, message:'%s'" % [type, data]) if block_given?
                  Severity: Major
                  Found in lib/rex/proto/tftp/client.rb - About 45 mins to fix

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

                        def to_ssm_channel(publish_timeout: 10)
                          chan = SsmChannel.new(self)
                    
                          if publish_timeout
                            # Waiting for the channel to start publishing
                    Severity: Minor
                    Found in lib/rex/proto/http/web_socket/amazon_ssm.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 from_s has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def from_s(header)
                        reset
                    
                        # ghettoooooo!
                        # If we don't have any newlines..., put one there.
                    Severity: Minor
                    Found in lib/rex/proto/http/packet/header.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 trans has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def trans(pipe, param = '', body = '', setup_count = 0, setup_data = '', no_response = false, do_recv = true)
                    
                        # Null-terminate the pipe parameter if needed
                        if (pipe[-1,1] != "\x00")
                          pipe << "\x00"
                    Severity: Minor
                    Found in lib/rex/proto/smb/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

                    Severity
                    Category
                    Status
                    Source
                    Language