rapid7/metasploit-framework

View on GitHub

Showing 21,757 of 21,757 total issues

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

  def action_enum_luids
    current_luid = get_current_luid
    luids = lsa_enumerate_logon_sessions
    fail_with(Failure::Unknown, 'Failed to enumerate logon sessions.') if luids.nil?

Severity: Minor
Found in modules/post/windows/manage/kerberos_tickets.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
    ssid = datastore['SSID']
    time = datastore['TIMEOUT']

    if ssid.length > 32
Severity: Minor
Found in modules/post/windows/wlan/wlan_probe_request.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 install_as_service has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def install_as_service(script_on_target)
    if is_system? || is_admin?
      print_status('Installing as service..')
      nam = datastore['StartupName'] || Rex::Text.rand_text_alpha(rand(8..15))
      description = datastore['ServiceDescription'] || Rex::Text.rand_text_alpha(8)
Severity: Minor
Found in modules/post/windows/manage/persistence_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 read_output has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def read_output(pipe, logfilename)
    print_status('Start reading output')

    print_status("Writing output to #{logfilename}")
    logfile = File.open(logfilename, 'wb')
Severity: Minor
Found in modules/post/windows/manage/execute_dotnet_assembly.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 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 read_output has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def read_output(process)
    print_status('Start reading output')
    old_timeout = client.response_timeout
    client.response_timeout = 5

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

  def enabletssrv(cleanup_rc)
    service_name = 'termservice'
    srv_info = service_info(service_name)
    begin
      print_status 'Setting Terminal Services service startup mode'
Severity: Minor
Found in modules/post/windows/manage/enable_rdp.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

            if pid == session.sys.process.getpid
              print_good('Success!')
            else
              print_error('Migration failed!')
            end
Severity: Major
Found in modules/post/windows/manage/archmigrate.rb - About 45 mins to fix

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

      def parse_fstab_credentials(line, file = '/etc/fstab')
        creds = {}
        # get the username option, which comes in one of four ways
        user_opt = ::Regexp.last_match(1) if (line =~ /user(?:name)?=([^, ]+)/)
        if user_opt
    Severity: Minor
    Found in modules/post/linux/gather/mount_cifs_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 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 find_apps has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def find_apps
        apps = %w[
          truecrypt bulldog ufw iptables fw-settings logrotate logwatch
          chkrootkit clamav snort tiger firestarter avast lynis
          rkhunter tcpdump webmin jailkit pwgen proxychains bastille
    Severity: Minor
    Found in modules/post/linux/gather/enum_protections.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 check_bad_super_class has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def check_bad_super_class
        # skip payloads, as they don't have a super class
        return if @module_type == 'payloads'
    
        # get the super class in an ugly way
    Severity: Minor
    Found in tools/dev/msftidy.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(enterprise, agent_addr, generic_trap, specific_trap, timestamp, varbind_list)
    Severity: Minor
    Found in lib/snmp/pdu.rb - About 45 mins to fix

      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

      Severity
      Category
      Status
      Source
      Language