rapid7/metasploit-framework

View on GitHub

Showing 21,757 of 21,757 total issues

Avoid deeply nested control flow statements.
Open

            timeout = params["timeout"][0] if params.has_key? "timeout"
Severity: Major
Found in tools/hardware/elm327_relay.rb - About 45 mins to fix

    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 process_traps has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def process_traps(trap_listener)
            @handler_init.call(trap_listener) if @handler_init
            loop do
                data, source_ip, source_port = @transport.recvfrom(@max_bytes)
                begin
    Severity: Minor
    Found in lib/snmp/manager.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 parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.parse(args)
          options = {}
          parser = OptionParser.new do |opt|
            opt.banner = "Usage: #{__FILE__} [options]\nExample: #{__FILE__} -q Aa3A\n[*] Exact match at offset 9"
            opt.separator ''
    Severity: Minor
    Found in tools/exploit/pattern_offset.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 with_metadata has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def with_metadata(child, parents: [])
          child = child.clone
    
          if child[:folder]
            parent_folders = parents.map { |page| page[:folder] }
    Severity: Minor
    Found in docs/build.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 new_path_for has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def new_path_for(old_path, old_path_anchor)
          # Strip out any leading `./` or `/` before the relative path.
          # This is needed for our later code that does additional filtering for
          # potential ambiguity with absolute paths since those comparisons occur
          # against filenames without the leading ./ and / parts.
    Severity: Minor
    Found in docs/build.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 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

    Avoid deeply nested control flow statements.
    Open

                maxpkts = params["maxpkts"][0] if params.has_key? "maxpkts"
    Severity: Major
    Found in tools/hardware/elm327_relay.rb - About 45 mins to fix

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

          def trap_v1(enterprise, agent_addr, generic_trap, specific_trap, timestamp, object_list=[])
      Severity: Minor
      Found in lib/snmp/manager.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 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 on_def has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def on_def(node)
                      update_info_node = find_update_info_node(node) || find_nested_update_info_node(node)
                      return if update_info_node.nil?
            
                      unless begins_its_line?(update_info_node.source_range)
            Severity: Minor
            Found in lib/rubocop/cop/layout/module_hash_on_new_line.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 shell_command_synchronous has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def shell_command_synchronous(command, args, timeout)
                      start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
                      command_id = send_command(command, args)
                      buffer = []
                      begin
              Severity: Minor
              Found in lib/net/winrm/stdin_shell.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

              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

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

                Severity
                Category
                Status
                Source
                Language