rapid7/metasploit-framework

View on GitHub

Showing 21,757 of 21,757 total issues

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

  def decrypt_user_keys(hbootkey, users)
    users.each_key do |rid|
      user = users[rid]

      hashlm_enc = ''
Severity: Minor
Found in modules/post/windows/gather/smart_hashdump.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 version.build_number.between?(Msf::WindowsVersion::Server2008_SP0, Msf::WindowsVersion::Server2012_R2) && version.windows_server?
              move_to_sys
              file_local_write(pwdfile, inject_hashdump)
            else
              print_error('Could not get NTDS hashes!')
Severity: Major
Found in modules/post/windows/gather/smart_hashdump.rb - About 45 mins to fix

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

      def enum_users
        users = []
        userinfo = {}
        session.sys.config.getuid
        userpath = nil
    Severity: Minor
    Found in modules/post/windows/gather/dumplinks.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 enum_users has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def enum_users
        users = []
    
        system_drive = get_env('SystemDrive').to_s.strip
    
    
    Severity: Minor
    Found in modules/post/windows/gather/enum_powershell_env.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 (loc['flags'] & 0x02) > 0
    
                    @data_out += "\tFile is on a network share.\n"
    
                    lnk_file.sysseek(offset + loc['network_ofs'], ::IO::SEEK_SET)
    Severity: Major
    Found in modules/post/windows/gather/dumplinks.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

              if migrate_system
                print_status('Trying to get SYSTEM privilege')
                results = session.priv.getsystem
                if results[0]
                  print_good('Got SYSTEM privilege')
      Severity: Major
      Found in modules/post/windows/gather/smart_hashdump.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

              elsif migrate_system
                print_status('Trying to get SYSTEM privilege')
                results = session.priv.getsystem
                if results[0]
                  print_good('Got SYSTEM privilege')
        Severity: Major
        Found in modules/post/windows/gather/smart_hashdump.rb - About 45 mins to fix

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

            def get_onedrive_accounts(reg, accounts, syncdata)
              all_oda = {}
              synctargets_used = []
              ret = {}
              reg.each do |ses|
          Severity: Minor
          Found in modules/post/windows/gather/enum_onedrive.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
              pw_tbl = Rex::Text::Table.new(
                'Header' => 'MobaXterm Password',
                'Columns' => [
                  'Protocol',
          Severity: Minor
          Found in modules/post/windows/gather/credentials/moba_xterm.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_odbc_dsn has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def parse_odbc_dsn(dsn_reg_key)
              return nil unless registry_key_exist?(dsn_reg_key)
          
              res = {}
              wug_server = registry_getvaldata(dsn_reg_key, 'Server').to_s.delete("\000")
          Severity: Minor
          Found in modules/post/windows/gather/credentials/whatsupgold_credential_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
              creds = Rex::Text::Table.new(
                'Header' => 'IMVU Credentials',
                'Indent' => 1,
                'Columns' => [
          Severity: Minor
          Found in modules/post/windows/gather/credentials/imvu.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 !imap_use_spa.nil? # Account for SPA (NTLM auth)
                      print_status('     Secure Password Authentication (SPA): Enabled')
                    end
          Severity: Major
          Found in modules/post/windows/gather/credentials/outlook.rb - About 45 mins to fix

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

              def mobaxterm_decrypt(ciphertext, key)
                ct = ''.bytes
                ciphertext.each_byte do |c|
                  ct << c if key.include?(c)
                end
            Severity: Minor
            Found in modules/post/windows/gather/credentials/moba_xterm.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 init_wug_encryption has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def init_wug_encryption
                print_status('Init WhatsUp Gold crypto ...')
            
                # Static RC2-40 key "salted" with 11 bytes of 0x00 - looking at you, wincrypt.h
                @wug_rc2_key = ['112cc5a60c0000000000000000000000'].pack('H*')
            Severity: Minor
            Found in modules/post/windows/gather/credentials/whatsupgold_credential_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

            Avoid deeply nested control flow statements.
            Open

                        if http_server_url.include? "h\x00t\x00t\x00p\x00s"
                          portnum = 443
                        else
                          portnum = 80
                        end
            Severity: Major
            Found in modules/post/windows/gather/credentials/outlook.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        if smtp_use_ssl.nil?
                          print_status('     SMTP Use SSL: No')
                        else
                          print_status('     SMTP Use SSL: Yes')
                        end
              Severity: Major
              Found in modules/post/windows/gather/credentials/outlook.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                          if imap_password.nil?
                            print_status('     User Password: <not stored>')
                          else
                            imap_password.slice!(0, 1)
                            pass = decrypt_password(imap_password)
                Severity: Major
                Found in modules/post/windows/gather/credentials/outlook.rb - About 45 mins to fix

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

                    def run
                      if session.type != 'meterpreter'
                        print_error 'Only meterpreter sessions are supported by this post module'
                        return
                      end
                  Severity: Minor
                  Found in modules/post/windows/gather/credentials/filezilla_server.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 imap_use_ssl.nil?
                              print_status('     IMAP Use SSL: No')
                            else
                              print_status('     IMAP Use SSL: Yes')
                            end
                  Severity: Major
                  Found in modules/post/windows/gather/credentials/outlook.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                              if smtp_use_auth.nil? # Account for SMTP servers requiring authentication
                                print_status("     Outgoing Mail Server (SMTP): #{smtp_server}")
                              else
                                print_status("     Outgoing Mail Server (SMTP): #{smtp_server}   [Authentication Required]")
                                # Check if smtp_auth_method is null.  If so, the inbound credentials are utilized
                    Severity: Major
                    Found in modules/post/windows/gather/credentials/outlook.rb - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language