rapid7/metasploit-framework

View on GitHub

Showing 16,139 of 22,252 total issues

Method parse_wmic_result has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_wmic_result(result_text)
    if result_text.blank?
      return nil
    else
      pid = nil
Severity: Minor
Found in lib/msf/core/post/windows/wmic.rb - About 25 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 create_mount_point has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def create_mount_point(path, target, print_name = '')
          return nil if target.empty? || path.empty?

          fixed_target = target.start_with?('\\') ? target : "\\??\\#{target}"
          reparse_data = build_reparse_data_buffer(fixed_target, print_name)
Severity: Minor
Found in lib/msf/core/post/windows/file_system.rb - About 25 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_vehicle_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_vehicle_info(bus, src_id, dst_id, mode, 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 25 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_current_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_current_data(bus, src_id, dst_id, pid, 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 25 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_freeze_frame_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_freeze_frame_data(bus, src_id, dst_id, pid, frame, 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 25 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 delete_user has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def delete_user(username, server_name = nil)
          unless session.commands.include?(Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_RAILGUN_API)
            return nil
          end

Severity: Minor
Found in lib/msf/core/post/windows/accounts.rb - About 25 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 service_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def service_info(name)
          if session.commands.include?(Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_QUERY_VALUE)
            begin
              return session.extapi.service.query(name)
            rescue Rex::Post::Meterpreter::RequestError => e
Severity: Minor
Found in lib/msf/core/post/windows/services.rb - About 25 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 ips has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def ips
          lines = read_file('/proc/net/fib_trie')
          result = []
          previous_line = ''
          lines.each_line do |line|
Severity: Minor
Found in lib/msf/core/post/linux/system.rb - About 25 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_connect_opts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def ldap_connect_opts(rhost, rport, connect_timeout, ssl: true, opts: {})
          connect_opts = {
            host: rhost,
            port: rport,
            connect_timeout: connect_timeout,
Severity: Minor
Found in lib/metasploit/framework/ldap/client.rb - About 25 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 mcp_send_recv has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def mcp_send_recv(messages)
          # Attach headers to each message and combine them
          message = messages.map do |m|
            [m.length, 0, 0, 0, m].pack('NNNNa*')
          end.join('')
Severity: Minor
Found in lib/msf/core/post/linux/f5_mcp.rb - About 25 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_account has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

         def each_account
           raw_batch_data = pull_batch
           until raw_batch_data.nil?
             batch = raw_batch_data.dup
             while batch.present?
Severity: Minor
Found in lib/metasploit/framework/ntds/parser.rb - About 25 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_notepad_pathname has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_notepad_pathname(bits, windir, client_arch)
    if bits == ARCH_X86 and client_arch == ARCH_X86
      cmd = "#{windir}\\System32\\notepad.exe"
    elsif bits == ARCH_X64 and client_arch == ARCH_X64
      cmd = "#{windir}\\System32\\notepad.exe"
Severity: Minor
Found in lib/msf/core/post/windows/process.rb - About 25 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_system has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def get_system
          print_status('Checking if user is SYSTEM...')

          if is_system?
            print_good('User is SYSTEM')
Severity: Minor
Found in lib/msf/core/post/windows/mssql.rb - About 25 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_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def make_request(request_type, path, data_hash = nil, query = nil)
    begin
      # simplify query by removing nil values
      query_str = (!query.nil? && !query.empty?) ? query.compact.to_query : nil
      uri = URI::HTTP::build({path: path, query: query_str})
Severity: Minor
Found in lib/metasploit/framework/data_service/remote/http/core.rb - About 25 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 is_root? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def is_root?
    if command_exists?('id')
      user_id = cmd_exec('id -u')
      clean_user_id = user_id.to_s.gsub(/[^\d]/, '')
      if clean_user_id.empty?
Severity: Minor
Found in lib/msf/core/post/linux/priv.rb - About 25 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 execute_shellcode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def execute_shellcode(shellcode, base_addr=nil, pid=nil)
    pid ||= session.sys.process.getpid
    host  = session.sys.process.open(pid.to_i, PROCESS_ALL_ACCESS)
    if base_addr.nil?
      shell_addr = host.memory.allocate(shellcode.length)
Severity: Minor
Found in lib/msf/core/post/windows/process.rb - About 25 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_auth_token has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def get_auth_token(user)
          auth_token_uri = normalize_uri("#{uri}/runtime/core/user/#{user}/authentication-token")

          # send the request to get an authentication token
          auth_res = send_request({
Severity: Minor
Found in lib/metasploit/framework/login_scanner/softing_sis.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

        def attempt_login(credential)
          result_options = {
            credential:   credential,
            host:         host,
            port:         port,
Severity: Minor
Found in lib/metasploit/framework/login_scanner/mysql.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

        def attempt_login(credential)
          result_options = {
              credential: credential,
              host: host,
              port: port,
Severity: Minor
Found in lib/metasploit/framework/login_scanner/mssql.rb - About 25 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_http_codes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def validate_http_codes
          errors.add(:http_success_codes, "HTTP codes must be an Array") unless @http_success_codes.is_a?(Array)
          @http_success_codes.each do |code|
            next if code >= 200 && code < 400
            errors.add(:http_success_codes, "Invalid HTTP code provided #{code}")
Severity: Minor
Found in lib/metasploit/framework/login_scanner/http.rb - About 25 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