rapid7/metasploit-framework

View on GitHub

Showing 21,886 of 21,886 total issues

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

  def get_groups
    cmd_output = cmd_exec("/usr/bin/dscacheutil -q group")
    groups = []
    groups_arry = cmd_output.split("\n\n")
    groups_arry.each do |u|
Severity: Minor
Found in lib/msf/core/post/osx/system.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_users has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def get_users
    cmd_output = cmd_exec("/usr/bin/dscacheutil -q user")
    users = []
    users_arry = cmd_output.tr("\r", "").split("\n\n")
    users_arry.each do |u|
Severity: Minor
Found in lib/msf/core/post/osx/system.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 rm_rf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def rm_rf(*remote_dirs)
    remote_dirs.each do |remote|
      if session.type == 'meterpreter'
        session.fs.dir.rmdir(remote) if exist?(remote)
      elsif session.type == 'powershell'
Severity: Minor
Found in lib/msf/core/post/file.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 send_security_token_response has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def send_security_token_response(bus, src_id, dst_id, key, response_level = 2, opt = {})
Severity: Minor
Found in lib/msf/core/post/hardware/automotive/uds.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                  if counter.zero?  # Get starting packet
                    if pkt["DATA"][0] == "10"
                      data += pkt["DATA"][start_offset, 8 - start_offset]
                      left2combine -= 1
                      counter += 1
    Severity: Major
    Found in lib/msf/core/post/hardware/automotive/uds.rb - About 45 mins to fix

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

        def normalize_key(key)
          keys = split_key(key)
          if (keys[0] =~ /HKLM|HKEY_LOCAL_MACHINE/)
            keys[0] = 'HKEY_LOCAL_MACHINE'
          elsif (keys[0] =~ /HKCU|HKEY_CURRENT_USER/)
      Severity: Minor
      Found in lib/msf/core/post/windows/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 clean_up has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def clean_up(script_file = nil, eof = '', running_pids = [], open_channels = [],
                           env_suffix = Rex::Text.rand_text_alpha(8), delete = false)
      Severity: Minor
      Found in lib/msf/core/post/windows/powershell.rb - About 45 mins to fix

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

          def write_data_by_id(bus, src_id, dst_id, id, data, opt = {})
        Severity: Minor
        Found in lib/msf/core/post/hardware/automotive/uds.rb - About 45 mins to fix

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

            def get_freeze_frame_data(bus, src_id, dst_id, pid, frame, opt = {})
          Severity: Minor
          Found in lib/msf/core/post/hardware/automotive/uds.rb - About 45 mins to fix

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

              def reset_ecu(bus, src_id, dst_id, hard, opt = {})
                unless client.automotive
                  print_error("Not an automotive hwbridge session")
                  return {}
                end
            Severity: Minor
            Found in lib/msf/core/post/hardware/automotive/uds.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 ldap_auth_opts_ntlm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def ldap_auth_opts_ntlm(opts, ssl)
                      auth_opts = {}
                      flags = RubySMB::NTLM::NEGOTIATE_FLAGS[:UNICODE] |
                            RubySMB::NTLM::NEGOTIATE_FLAGS[:REQUEST_TARGET] |
                            RubySMB::NTLM::NEGOTIATE_FLAGS[:NTLM] |
            Severity: Minor
            Found in lib/metasploit/framework/ldap/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 reg_key_value_exists? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def reg_key_value_exists?(reg_key, reg_value, opts = {})
                      remote_host = opts[:remote_system].present? || datastore['ScheduleRemoteSystem'].present?
                      result = false
                      if remote_host
                        begin
            Severity: Minor
            Found in lib/msf/core/post/windows/task_scheduler.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_versionception has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def get_versionception(dotnet_vkey)
                exact_version = nil
                begin
                  subkeys = registry_enumkeys(dotnet_vkey)
                rescue Rex::Post::Meterpreter::RequestError => e
            Severity: Minor
            Found in lib/msf/core/post/windows/dotnet.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 ldap_auth_opts_kerberos has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def ldap_auth_opts_kerberos(opts, ssl)
                      auth_opts = {}
                      raise Msf::ValidationError, 'The LDAP::Rhostname option is required when using Kerberos authentication.' if opts[:ldap_rhostname].blank?
                      raise Msf::ValidationError, 'The DOMAIN option is required when using Kerberos authentication.' if opts[:domain].blank?
            
            
            Severity: Minor
            Found in lib/metasploit/framework/ldap/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 ldap_auth_opts_schannel has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def ldap_auth_opts_schannel(opts, ssl)
                      auth_opts = {}
                      pfx_path = opts[:ldap_cert_file]
                      raise Msf::ValidationError, 'The SSL option must be enabled when using Schannel authentication.' unless ssl
                      raise Msf::ValidationError, 'The LDAP::CertFile option is required when using Schannel authentication.' if pfx_path.blank?
            Severity: Minor
            Found in lib/metasploit/framework/ldap/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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def validate(data_service)
                raise "Invalid data_service: #{data_service.class}, not of type Metasploit::Framework::DataService" unless data_service.is_a? (Metasploit::Framework::DataService)
                raise 'Cannot register null data service data_service' unless data_service
                raise 'Data Service already exists' if data_service_exist?(data_service)
                # Raising an error for local DB causes startup to fail if there is a DB configured but we are unable to connect
            Severity: Minor
            Found in lib/metasploit/framework/data_service/proxy/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 set_sane_defaults has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def set_sane_defaults
                      self.connection_timeout ||= 30
                      self.port               ||= DEFAULT_PORT
                      self.banner_timeout     ||= 25
                      self.telnet_timeout     ||= 10
            Severity: Minor
            Found in lib/metasploit/framework/login_scanner/telnet.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 attempt_login has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def attempt_login(credential)
                      result_options = {
                        credential: credential,
                        status: Metasploit::Model::Login::Status::INCORRECT,
                        host: host,
            Severity: Minor
            Found in lib/metasploit/framework/login_scanner/redis.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 attempt_login has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def attempt_login(credential)
                      result_opts = {
                        credential: credential,
                        host: host,
                        port: port,
            Severity: Minor
            Found in lib/metasploit/framework/login_scanner/jupyter.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 each_credential has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                      def each_credential
                        cred_details.each do |raw_cred|
            
                          # This could be a Credential object, or a Credential Core, or an Attempt object
                          # so make sure that whatever it is, we end up with a Credential.
            Severity: Minor
            Found in lib/metasploit/framework/login_scanner/base.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