Method process_ntlm_type3
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_ntlm_type3(type3_msg)
if type3_msg.user == '' && type3_msg.domain == ''
if @provider.allow_anonymous
@session_key = "\x00".b * 16 # see MS-NLMP section 3.4
return WindowsError::NTStatus::STATUS_SUCCESS
Method process_ntlm_type3
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def process_ntlm_type3(type3_msg)
if type3_msg.user == '' && type3_msg.domain == ''
if @provider.allow_anonymous
@session_key = "\x00".b * 16 # see MS-NLMP section 3.4
return WindowsError::NTStatus::STATUS_SUCCESS
- 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 process_gss_type3
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_gss_type3(gss_api)
neg_token_init = Hash[RubySMB::Gss.asn1dig(gss_api, 0).value.map { |obj| [obj.tag, obj.value[0].value] }]
raw_type3_msg = neg_token_init[2]
type3_msg = Net::NTLM::Message.parse(raw_type3_msg)
Method process
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process(request_buffer=nil)
if request_buffer.nil?
# this is only NTLMSSP (as opposed to SPNEGO + NTLMSSP)
buffer = OpenSSL::ASN1::ASN1Data.new([
Gss::OID_SPNEGO,
Method process_ntlm_type1
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_ntlm_type1(type1_msg)
type2_msg = Net::NTLM::Message::Type2.new.tap do |msg|
msg.target_name = 'LOCALHOST'.encode('UTF-16LE').b
msg.flag = 0
%i{ KEY56 KEY128 KEY_EXCHANGE UNICODE TARGET_INFO VERSION_INFO }.each do |flag|
Method process_gss_type3
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def process_gss_type3(gss_api)
neg_token_init = Hash[RubySMB::Gss.asn1dig(gss_api, 0).value.map { |obj| [obj.tag, obj.value[0].value] }]
raw_type3_msg = neg_token_init[2]
type3_msg = Net::NTLM::Message.parse(raw_type3_msg)
- 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
Avoid too many return
statements within this method. Open
return WindowsError::NTStatus::STATUS_LOGON_FAILURE
Method process
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process(request_buffer=nil)
if request_buffer.nil?
# this is only NTLMSSP (as opposed to SPNEGO + NTLMSSP)
buffer = OpenSSL::ASN1::ASN1Data.new([
Gss::OID_SPNEGO,
- 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"