modules/auxiliary/admin/kerberos/forge_ticket.rb
File forge_ticket.rb
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class MetasploitModule < Msf::Auxiliary
include Msf::Auxiliary::Report
include Msf::Exploit::Remote::Kerberos::Client
include Msf::Exploit::Remote::Kerberos::Ticket
Method initialize
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Kerberos Silver/Golden/Diamond/Sapphire Ticket Forging',
Method forge_diamond
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def forge_diamond
validate_remote
validate_aes256_key!
begin
Method forge_sapphire
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def forge_sapphire
validate_remote
validate_key!
options = {}
enc_key, enc_type = get_enc_key_and_type
Method get_enc_key_and_type
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_enc_key_and_type
enc_type = nil
key = nil
if datastore['NTHASH']
enc_type = Rex::Proto::Kerberos::Crypto::Encryption::RC4_HMAC
- Read upRead up
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
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')
- Read upRead up
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"