rapid7/metasploit-framework

View on GitHub
modules/post/windows/gather/cachedump.rb

Summary

Maintainability
D
2 days
Test Coverage

Method parse_decrypted_cache has 109 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def parse_decrypted_cache(dec_data, s)
    i = 0
    hash = dec_data[i, 0x10]
    i += 72

Severity: Major
Found in modules/post/windows/gather/cachedump.rb - About 4 hrs to fix

    File cachedump.rb has 332 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'English'
    class MetasploitModule < Msf::Post
      include Msf::Post::Windows::Priv
      include Msf::Post::Windows::Registry
    
    
    Severity: Minor
    Found in modules/post/windows/gather/cachedump.rb - About 4 hrs to fix

      Method run has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def run
          @credentials = Rex::Text::Table.new(
            'Header' => 'MSCACHE Credentials',
            'Indent' => 1,
            'Columns' =>
      Severity: Major
      Found in modules/post/windows/gather/cachedump.rb - About 3 hrs to fix

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

          def run
            @credentials = Rex::Text::Table.new(
              'Header' => 'MSCACHE Credentials',
              'Indent' => 1,
              'Columns' =>
        Severity: Minor
        Found in modules/post/windows/gather/cachedump.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 parse_cache_entry has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def parse_cache_entry(cache_data)
            j = Struct.new(
              :userNameLength,
              :domainNameLength,
              :effectiveNameLength,
        Severity: Major
        Found in modules/post/windows/gather/cachedump.rb - About 2 hrs to fix

          Method parse_decrypted_cache has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            def parse_decrypted_cache(dec_data, s)
              i = 0
              hash = dec_data[i, 0x10]
              i += 72
          
          
          Severity: Minor
          Found in modules/post/windows/gather/cachedump.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 initialize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def initialize(info = {})
              super(
                update_info(
                  info,
                  'Name' => 'Windows Gather Credential Cache Dump',
          Severity: Minor
          Found in modules/post/windows/gather/cachedump.rb - About 1 hr to fix

            There are no issues that match your filters.

            Category
            Status