rapid7/metasploit-framework

View on GitHub
modules/auxiliary/admin/kerberos/forge_ticket.rb

Summary

Maintainability
C
1 day
Test Coverage

File forge_ticket.rb has 277 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class MetasploitModule < Msf::Auxiliary
  include Msf::Auxiliary::Report
  include Msf::Exploit::Remote::Kerberos::Client
  include Msf::Exploit::Remote::Kerberos::Ticket

Severity: Minor
Found in modules/auxiliary/admin/kerberos/forge_ticket.rb - About 2 hrs to fix

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

      def initialize(info = {})
        super(
          update_info(
            info,
            'Name' => 'Kerberos Silver/Golden/Diamond/Sapphire Ticket Forging',
    Severity: Major
    Found in modules/auxiliary/admin/kerberos/forge_ticket.rb - About 2 hrs to fix

      Method forge_diamond has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def forge_diamond
          validate_remote
          validate_aes256_key!
      
          begin
      Severity: Minor
      Found in modules/auxiliary/admin/kerberos/forge_ticket.rb - About 1 hr to fix

        Method forge_sapphire has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def forge_sapphire
            validate_remote
            validate_key!
            options = {}
            enc_key, enc_type = get_enc_key_and_type
        Severity: Minor
        Found in modules/auxiliary/admin/kerberos/forge_ticket.rb - About 1 hr to fix

          Method get_enc_key_and_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def get_enc_key_and_type
              enc_type = nil
              key = nil
              if datastore['NTHASH']
                enc_type = Rex::Proto::Kerberos::Crypto::Encryption::RC4_HMAC
          Severity: Minor
          Found in modules/auxiliary/admin/kerberos/forge_ticket.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

          Method validate_key! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def validate_key!
              if datastore['NTHASH'].blank? && datastore['AES_KEY'].blank?
                fail_with(Msf::Exploit::Failure::BadConfig, 'NTHASH or AES_KEY must be set for forging a ticket')
              elsif datastore['NTHASH'].present? && datastore['AES_KEY'].present?
                fail_with(Msf::Exploit::Failure::BadConfig, 'NTHASH and AES_KEY may not both be set for forging a ticket')
          Severity: Minor
          Found in modules/auxiliary/admin/kerberos/forge_ticket.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