rapid7/metasploit-framework

View on GitHub

Showing 15,831 of 21,886 total issues

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

  def delete_current_data_service
    @data_services.each do |id, ds|
      if ds == @current_data_service
        if id == 1
          raise "Unable to delete the local data service. Please use db_disconnect."
Severity: Minor
Found in lib/metasploit/framework/data_service/proxy/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 kernel_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def kernel_config
   return unless cmd_exec('test -r /boot/config-`uname -r` && echo true').include? 'true'
    output = cmd_exec("cat /boot/config-`uname -r`").to_s.strip
    return if output.empty?
    config = output.split("\n").map(&:strip).reject(&:empty?).reject {|i| i.start_with? '#'}
Severity: Minor
Found in lib/msf/core/post/linux/kernel.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 creds has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def creds(opts = {})
    path = get_path_select(opts, CREDENTIAL_API_PATH)
    data = self.get_data(path, nil, opts)
    rv = json_to_mdm_object(data, CREDENTIAL_MDM_CLASS)
    parsed_body = JSON.parse(data.response.body, symbolize_names: true)

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

  def kernel_arch
    arch = kernel_hardware
    return ARCH_X64 if arch == 'x86_64' || arch == 'amd64'
    return ARCH_AARCH64 if arch == 'aarch64' || arch == 'arm64'
    return ARCH_ARMLE if arch.start_with?'arm'
Severity: Minor
Found in lib/msf/core/post/linux/kernel.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 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 find_or_create_loot has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def find_or_create_loot(opts)
    begin
      # create separate opts for find operation since the report operation uses slightly different keys
      # TODO: standardize option keys used for the find and report operations
      find_opts = opts.clone
Severity: Minor
Found in lib/metasploit/framework/data_service/proxy/loot_data_proxy.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 connect_login has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def connect_login(user,pass,global = true)
          ftpsock = connect(global)

          if !(user and pass)
            return false
Severity: Minor
Found in lib/metasploit/framework/ftp/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 update_session has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update_session(opts)
    begin
      self.data_service_operation do |data_service|
        is_msf_session = false
        if !opts.nil? && opts.kind_of?(Msf::Session)
Severity: Minor
Found in lib/metasploit/framework/data_service/proxy/session_data_proxy.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 parse_auth_methods has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def parse_auth_methods(resp)
          return [] unless resp and resp.code == 401
          methods = []
          methods << "Negotiate" if resp.headers['WWW-Authenticate'].include? "Negotiate"
          methods << "Kerberos" if resp.headers['WWW-Authenticate'].include? "Kerberos"
Severity: Minor
Found in lib/metasploit/framework/login_scanner/winrm.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 john_nolog_format has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def john_nolog_format
          if /(\d{4}-\d{2}-\d{2})/ =~ cracker_version
            # we lucked out and theres a date, we'll check its older than the commit that changed the nolog
            if Date.parse(Regexp.last_match(1)) < Date.parse('2020-11-27')
              return '--nolog'
Severity: Minor
Found in lib/metasploit/framework/password_crackers/cracker.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 check_setup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def check_setup
          begin
            res = send_request({
              'uri' => normalize_uri('/')
            })
Severity: Minor
Found in lib/metasploit/framework/login_scanner/zabbix.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_opts = {
              credential: credential,
              host: host,
              port: port,
Severity: Minor
Found in lib/metasploit/framework/login_scanner/axis2.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_opts = {
            credential: credential,
            host: host,
            port: port,
Severity: Minor
Found in lib/metasploit/framework/login_scanner/octopusdeploy.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 try_glassfish_3 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def try_glassfish_3(credential)
          res = try_login(credential)
          if res && res.code == 302
            opts = {
              'uri'     => '/common/applications/uploadFrame.jsf',
Severity: Minor
Found in lib/metasploit/framework/login_scanner/glassfish.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