rapid7/metasploit-framework

View on GitHub
lib/msf/util/windows_registry/security.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method cached_infos has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def cached_infos(nlkm_key)
      values = enum_values('\\Cache')
      unless values
        elog('[Msf::Util::WindowsRegistry::Sam::cached_hashes] No cashed entries')
        return
Severity: Minor
Found in lib/msf/util/windows_registry/security.rb - About 2 hrs 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 cached_infos has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def cached_infos(nlkm_key)
      values = enum_values('\\Cache')
      unless values
        elog('[Msf::Util::WindowsRegistry::Sam::cached_hashes] No cashed entries')
        return
Severity: Minor
Found in lib/msf/util/windows_registry/security.rb - About 1 hr to fix

    Method lsa_secrets has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def lsa_secrets(lsa_key)
          keys = enum_key('\\Policy\\Secrets')
          return unless keys
    
          keys.delete('NL$Control')
    Severity: Minor
    Found in lib/msf/util/windows_registry/security.rb - About 55 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 lsa_secret_key has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def lsa_secret_key(boot_key)
          # vprint_status('Getting PolEKList...')
          _value_type, value_data = get_value('\\Policy\\PolEKList')
          if value_data
            # Vista or above system
    Severity: Minor
    Found in lib/msf/util/windows_registry/security.rb - About 35 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