rapid7/metasploit-framework

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

Summary

Maintainability
C
1 day
Test Coverage

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

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Kerberos TGT/TGS Ticket Requester',
Severity: Major
Found in modules/auxiliary/admin/kerberos/get_ticket.rb - About 2 hrs to fix

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

      def validate_options
        if datastore['CERT_FILE'].present?
          certificate = File.read(datastore['CERT_FILE'])
          begin
            @pfx = OpenSSL::PKCS12.new(certificate, datastore['CERT_PASSWORD'] || '')
    Severity: Minor
    Found in modules/auxiliary/admin/kerberos/get_ticket.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

    File get_ticket.rb has 267 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Auxiliary
      include Msf::Auxiliary::Report
      include Msf::Exploit::Remote::Kerberos
      include Msf::Exploit::Remote::Kerberos::Client
      include Msf::Exploit::Remote::Kerberos::Ticket::Storage
    Severity: Minor
    Found in modules/auxiliary/admin/kerberos/get_ticket.rb - About 2 hrs to fix

      Method validate_options has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def validate_options
          if datastore['CERT_FILE'].present?
            certificate = File.read(datastore['CERT_FILE'])
            begin
              @pfx = OpenSSL::PKCS12.new(certificate, datastore['CERT_PASSWORD'] || '')
      Severity: Minor
      Found in modules/auxiliary/admin/kerberos/get_ticket.rb - About 1 hr to fix

        Method action_get_tgs has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def action_get_tgs
            authenticator = init_authenticator({ ticket_storage: kerberos_ticket_storage(read: true, write: true) })
            tgt_request_options = {}
            if datastore['Krb5Ccname'].present?
              tgt_request_options[:cache_file] = datastore['Krb5Ccname']
        Severity: Minor
        Found in modules/auxiliary/admin/kerberos/get_ticket.rb - About 1 hr to fix

          Method init_authenticator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def init_authenticator(options = {})
              options.merge!({
                host: rhost,
                realm: @realm,
                username: @username,
          Severity: Minor
          Found in modules/auxiliary/admin/kerberos/get_ticket.rb - About 25 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