rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

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

      def self.run_cmd(cmd, input: nil, env: {}, debug: false)
        exitstatus = 0
        err = out = ""

        $stdout.puts "run_cmd: cmd=#{cmd}, input=#{input}, env=#{env}" if debug
Severity: Minor
Found in lib/msf/util/service_helper.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 serialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def self.serialize(client_flags, max_packet_size, charset_number, username, scrambled_password, databasename)
Severity: Minor
Found in lib/rbmysql/protocol.rb - About 45 mins to fix

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

      def pivot_keepalive_start
        return unless self.send_keepalives
        self.receiver_thread = Rex::ThreadFactory.spawn("PivotKeepalive", false) do
          while self.alive
            begin
    Severity: Minor
    Found in lib/rex/post/meterpreter/packet_dispatcher.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_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_value(key, value_name = nil)
          sd_backup = change_dacl(key, Rex::Proto::Secauthz::WellKnownSids::DOMAIN_ALIAS_SID_ADMINS) if @inline
          root_key, sub_key = key.gsub(/\//, '\\').split('\\', 2)
          root_key_handle = @winreg.open_root_key(root_key)
          subkey_handle = @winreg.open_key(root_key_handle, sub_key)
    Severity: Minor
    Found in lib/msf/util/windows_registry/remote_registry.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(client, cid, type, flags, packet, **_)
    Severity: Minor
    Found in lib/rex/post/meterpreter/channel.rb - About 45 mins to fix

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

                def cmd_cd(*args)
                  if args.include?('-h') || args.include?('--help') || args.length != 1
                    cmd_cd_help
                    return
                  end
      Severity: Minor
      Found in lib/rex/post/smb/ui/console/command_dispatcher/shares.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 cmd_download has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

                def cmd_download(*args)
                  if args.include?('-h') || args.include?('--help')
                    cmd_download_help
                    return
                  end
      Severity: Minor
      Found in lib/rex/post/smb/ui/console/command_dispatcher/shares.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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(host, port, socket, conn_timeout, read_timeout, write_timeout)
            @insert_id = 0
            @warning_count = 0
            @gc_stmt_queue = []   # stmt id list which GC destroy.
            set_state :INIT
      Severity: Minor
      Found in lib/rbmysql/protocol.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_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_value(reg_key, reg_value = nil)
            reg_key = find_key(reg_key)
            return nil unless reg_key
      
            if reg_key.data.num_values > 0
      Severity: Minor
      Found in lib/msf/util/windows_registry/registry_parser.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 cmd_upload has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

                def cmd_upload(*args)
                  if args.include?('-h') || args.include?('--help')
                    cmd_upload_help
                    return
                  end
      Severity: Minor
      Found in lib/rex/post/smb/ui/console/command_dispatcher/shares.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 generate_nops has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.generate_nops(framework, arch, len, opts = {})
          opts['BadChars'] ||= ''
          opts['SaveRegisters'] ||= [ 'esp', 'ebp', 'esi', 'edi' ]
      
          return nil unless framework.nops
      Severity: Minor
      Found in lib/msf/util/exe.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 load_plugin has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def load_plugin(args)
          path = args[0]
      
          opts  = {
            'LocalInput'    => driver.input,
      Severity: Minor
      Found in lib/msf/ui/console/command_dispatcher/core.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_opts_workspace has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.process_opts_workspace(opts, framework, required = true)
          wspace = opts[:workspace]
          if required && (wspace.nil? || (wspace.kind_of?(String) && wspace.empty?))
            raise ArgumentError.new("opts must include a valid :workspace")
          end
      Severity: Minor
      Found in lib/msf/util/db_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

      Avoid deeply nested control flow statements.
      Open

              case arch
              when ARCH_X86,nil
                to_solaris_x86_elf(framework, code, exeopts)
              end
      Severity: Major
      Found in lib/msf/util/exe.rb - About 45 mins to fix

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

          def cmd_repeat(*args)
            looper = method :loop
        
            opts = OptionParser.new do |opts|
              opts.banner = 'Usage: repeat [OPTIONS] COMMAND...'
        Severity: Minor
        Found in lib/msf/ui/console/command_dispatcher/core.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 to_exe_elf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.to_exe_elf(framework, opts, template, code, big_endian=false)
            if elf? code
              return code
            end
        
        
        Severity: Minor
        Found in lib/msf/util/exe.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 to_executable_fmt has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def self.to_executable_fmt(framework, arch, plat, code, fmt, exeopts)
        Severity: Minor
        Found in lib/msf/util/exe.rb - About 45 mins to fix

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

                    def show_favorites # :nodoc:
                      favs_file = Msf::Config.fav_modules_file
          
                      unless File.exist?(favs_file)
                        print_error("The favorite modules file does not exist")
          Severity: Minor
          Found in lib/msf/ui/console/command_dispatcher/modules.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 normalize_references has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def normalize_references(refs)
                    normalized = ''
                    cve_collection = refs.select { |r| r.ctx_id.match(/^cve$/i) }
                    if cve_collection.empty?
                      normalized << "* #{NO_CVE_MESSAGE}\n"
          Severity: Minor
          Found in lib/msf/util/document_generator/document_normalizer.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 cmd_get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def cmd_get(*args)
          
              # Figure out if these are global variables
              global = false
          
          
          Severity: Minor
          Found in lib/msf/ui/console/command_dispatcher/core.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