rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

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

  def wlan_get_networks(wlan_handle, guid)
    networks = []

    bss_list = @wlanapi.WlanGetNetworkBssList(wlan_handle, guid, nil, 3, true, nil, 4)
    pointer = bss_list['ppWlanBssList']
Severity: Minor
Found in modules/post/windows/wlan/wlan_bss_list.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    # Set instance name (if specified)
    instance = datastore['INSTANCE'].to_s

    # Display target
Severity: Minor
Found in modules/post/windows/manage/mssql_local_auth_bypass.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_db_enc_key has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def get_db_enc_key(install_path)
    vprint_status('Getting the database encryption key')

    manage_key_conf_path = "#{install_path}/#{MANAGE_KEY_CONF_PATH}"
    begin
Severity: Minor
Found in modules/post/linux/gather/manageengine_password_manager_creds.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 os_platform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def os_platform
    if session.type == 'meterpreter'
      sysinfo['OS']
    elsif active_db? && framework.db.workspace.hosts.where(address: session.session_host)&.first&.os_name
      host = framework.db.workspace.hosts.where(address: session.session_host).first
Severity: Minor
Found in modules/post/linux/manage/adduser.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    user_dirs = []
    # Search current user
    user = cmd_exec('whoami').chomp
    # User is root
Severity: Minor
Found in modules/post/linux/gather/gnome_commander_creds.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 test_success has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def test_success
    successful = false
    begin
      is_root?
    rescue RuntimeError => e
Severity: Minor
Found in modules/post/linux/dos/xen_420_dos.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 vmafd_dump has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def vmafd_dump
    if vcenter_infrastructure
      get_vmca_cert
      get_idp_creds
    end
Severity: Minor
Found in modules/post/linux/gather/vcenter_secrets_dump.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 vmdir_init has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def vmdir_init
    self.keystore = {}

    vsphere_machine_id = get_machine_id
    if is_uuid?(vsphere_machine_id)
Severity: Minor
Found in modules/post/linux/gather/vcenter_secrets_dump.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_crons has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def get_crons(users, user)
    if user == 'root' && users
      users = users.chomp.split
      users.each do |u|
        next unless u == 'root'
Severity: Minor
Found in modules/post/linux/gather/enum_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 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 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

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

              def on_def(node)
                return if node.source =~ /Generic Payload Handler/
      
                update_info_node = find_update_info_node(node) || find_nested_update_info_node(node)
                return if update_info_node.nil?
      Severity: Minor
      Found in lib/rubocop/cop/lint/module_disclosure_date_present.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 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 urls_linking_to has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def urls_linking_to(urls)
              unless urls.is_a?(Array)
                urls = [urls] unless urls.is_a?(Array)
                single = true
              end
        Severity: Minor
        Found in lib/anemone/page_store.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 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 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

        Severity
        Category
        Status
        Source
        Language