rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

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

  def check_self_class
    in_register = false
    @lines.each do |line|
      (in_register = true) if line =~ /^\s*register_(?:advanced_)?options/
      (in_register = false) if line =~ /^\s*end/
Severity: Minor
Found in tools/dev/msftidy.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(enterprise, agent_addr, generic_trap, specific_trap, timestamp, varbind_list)
Severity: Minor
Found in lib/snmp/pdu.rb - About 45 mins to fix

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

    def get_boot_key
    
        return if !@hive.root_key
        return if !@hive.root_key.name
    
    
    Severity: Minor
    Found in tools/exploit/reg.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 check_bad_super_class has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def check_bad_super_class
        # skip payloads, as they don't have a super class
        return if @module_type == 'payloads'
    
        # get the super class in an ugly way
    Severity: Minor
    Found in tools/dev/msftidy.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 check_for_required_keys has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def check_for_required_keys(notes)
              last_key = nil
              keys_present = []
              notes.each_pair do |key, _value|
                if REQUIRED_KEYS.include? key.value
    Severity: Minor
    Found in lib/rubocop/cop/lint/module_enforce_notes.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 pub_info.length <= 2
                    auth_info[:domain], auth_info[:user] = pub_info
                  else
                    auth_info[:result_code] = Net::LDAP::ResultCodeInvalidCredentials
                    auth_info[:error_msg] = "Invalid LDAP Login Attempt => DN:#{user_login.name}"
    Severity: Major
    Found in lib/rex/proto/ldap/auth.rb - About 45 mins to fix

      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 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 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 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 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

          Avoid deeply nested control flow statements.
          Open

                        if self.is_pass_ntlm_hash?(pass)
                          arglm = {
                            :ntlmv2_hash =>  Rex::Proto::NTLM::Crypt::ntlmv2_hash(
                                      user,
                                      [ pass.upcase()[33,65] ].pack('H32'),
          Severity: Major
          Found in lib/rex/proto/ntlm/utils.rb - About 45 mins to fix

            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

              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 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

                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 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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language