rapid7/metasploit-framework

View on GitHub
modules/post/windows/escalate/golden_ticket.rb

Summary

Maintainability
D
1 day
Test Coverage

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

  def run
    return unless load_kiwi

    user = datastore['USER']
    domain = datastore['DOMAIN']
Severity: Minor
Found in modules/post/windows/escalate/golden_ticket.rb - About 5 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 run has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def run
    return unless load_kiwi

    user = datastore['USER']
    domain = datastore['DOMAIN']
Severity: Major
Found in modules/post/windows/escalate/golden_ticket.rb - About 3 hrs to fix

    Method initialize has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def initialize(info = {})
        super(
          update_info(
            info,
            'Name' => 'Windows Escalate Golden Ticket',
    Severity: Minor
    Found in modules/post/windows/escalate/golden_ticket.rb - About 1 hr to fix

      Method lookup_domain_sid has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def lookup_domain_sid(domain)
          string_sid = nil
      
          cb_sid = sid_buffer = 100
          cch_referenced_domain_name = referenced_domain_name_buffer = 100
      Severity: Minor
      Found in modules/post/windows/escalate/golden_ticket.rb - About 1 hr to fix

        Method lookup_krbtgt_hash has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def lookup_krbtgt_hash(domain)
            krbtgt_hash = nil
        
            krbtgt_creds = Metasploit::Credential::Core.joins(:public, :private).where(
              metasploit_credential_publics: { username: 'krbtgt' },
        Severity: Minor
        Found in modules/post/windows/escalate/golden_ticket.rb - About 1 hr to fix

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

            def lookup_krbtgt_hash(domain)
              krbtgt_hash = nil
          
              krbtgt_creds = Metasploit::Credential::Core.joins(:public, :private).where(
                metasploit_credential_publics: { username: 'krbtgt' },
          Severity: Minor
          Found in modules/post/windows/escalate/golden_ticket.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

          There are no issues that match your filters.

          Category
          Status