rapid7/metasploit-framework

View on GitHub
lib/rex/parser/fs/bitlocker.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method recovery_key_transformation has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def recovery_key_transformation(recoverykey)
        # recovery key stretching phase 1
        recovery_intermediate = recoverykey.split('-').map(&:to_i)
        recovery_intermediate.each do |n|
          n % 11 != 0 && (fail ArgumentError, 'Invalid recovery key')
Severity: Minor
Found in lib/rex/parser/fs/bitlocker.rb - About 1 hr to fix

    Method fve_entries has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def fve_entries(metadata_entries)
            offset_entry = 0
            entry_size = metadata_entries[0, 2].unpack('v')[0]
            result = Hash.new({})
            while entry_size != 0
    Severity: Minor
    Found in lib/rex/parser/fs/bitlocker.rb - About 1 hr to fix

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

            def vmk_from_recovery_password(recoverykey)
              recovery_keys_stretched = recovery_key_transformation(recoverykey)
              vmk_encrypted_in_recovery_password_list =  @vmk_entries_hash[
                                                         PROTECTION_RECOVERY_PASSWORD]
              vmk_recovery_password = ''
      Severity: Minor
      Found in lib/rex/parser/fs/bitlocker.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 fve_entries has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def fve_entries(metadata_entries)
              offset_entry = 0
              entry_size = metadata_entries[0, 2].unpack('v')[0]
              result = Hash.new({})
              while entry_size != 0
      Severity: Minor
      Found in lib/rex/parser/fs/bitlocker.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

      There are no issues that match your filters.

      Category
      Status