Showing 173 of 310 total issues
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 compress_chunk
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.compress_chunk(chunk)
blob = chunk
out = ''
pow2 = 0x10
l_mask3 = 0x1002
- 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 negotiate_response
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def negotiate_response(raw_data)
response = nil
if smb1
packet = RubySMB::SMB1::Packet::NegotiateResponseExtended.read raw_data
- 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 read
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def read(bytes: size, offset: 0)
max_read = tree.client.server_max_read_size
max_read = 65536 unless tree.client.server_supports_multi_credit
atomic_read_size = [bytes, max_read].min
credit_charge = 0
- 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 transaction2_smb1_find_first2
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def transaction2_smb1_find_first2(request)
# see: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-cifs/f93455dc-2bd7-4698-b91e-8c9c7abd63cf
raise ArgumentError unless request.data_block.trans2_parameters.is_a? SMB1::Packet::Trans2::FindFirst2RequestTrans2Parameters
subdir, _, search_pattern = request.data_block.trans2_parameters.filename.encode.gsub('\\', File::SEPARATOR).rpartition(File::SEPARATOR)
Method _open
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _open(filename:, attributes: nil, options: nil, disposition: RubySMB::Dispositions::FILE_OPEN,
impersonation: RubySMB::ImpersonationLevels::SEC_IMPERSONATE, read: true, write: false, delete: false)
create_request = RubySMB::SMB2::Packet::CreateRequest.new
create_request = set_header_fields(create_request)
Method handle_smb1
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_smb1(raw_request, header)
session = @session_table[header.uid]
if session.nil? && !(header.command == SMB1::Commands::SMB_COM_SESSION_SETUP_ANDX && header.uid == 0)
response = SMB1::Packet::EmptyPacket.new
Method ioctl_send_recv
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ioctl_send_recv(action, options={})
request = set_header_fields(RubySMB::SMB2::Packet::IoctlRequest.new(options))
request.ctl_code = 0x0011C017
request.flags.is_fsctl = 0x00000001
# TODO: handle fragmentation when the request size > MAX_XMIT_FRAG
Method read
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def read(bytes: @size, offset: 0)
atomic_read_size = [bytes, @tree.client.max_buffer_size].min
remaining_bytes = bytes
data = ''
- 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 smb2_authenticate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def smb2_authenticate
response = smb2_ntlmssp_negotiate
challenge_packet = smb2_ntlmssp_challenge_packet(response)
if @dialect == '0x0311'
update_preauth_hash(challenge_packet)
- 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 _open
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _open(filename:, flags: nil, options: nil, disposition: RubySMB::Dispositions::FILE_OPEN,
impersonation: RubySMB::ImpersonationLevels::SEC_IMPERSONATE, read: true, write: false, delete: false)
nt_create_andx_request = RubySMB::SMB1::Packet::NtCreateAndxRequest.new
nt_create_andx_request = set_header_fields(nt_create_andx_request)
- 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 initialize
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def initialize(args = nil)
if args.nil?
super
elsif args.is_a? String
super(args)
- 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 drs_bind
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def drs_bind
drs_extensions_int = DrsExtensionsInt.new(
dw_flags: DRS_EXT_GETCHGREQ_V6 | DRS_EXT_GETCHGREPLY_V6 | DRS_EXT_GETCHGREQ_V8 | DRS_EXT_STRONG_ENCRYPTION,
dw_ext_caps: 0xFFFFFFFF
)
Method fetch_alias_referent
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def fetch_alias_referent(current: parent, ref: get_parameter(:ref_to), name: nil)
return if current.nil?
if current.get_parameter(:ref_to) == ref
raise ArgumentError.new(
"Pointer alias refering to #{ref} cannot be found. This referent "\
- 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 do_num_bytes
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def do_num_bytes(struct_offset = 0, is_deferred: false)
sum = 0
if is_deferred
if is_a?(NdrStruct) && self.class.superclass.has_conformant_array
# align :max_count since it will be placed in front of the structure.
- 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 negotiate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def negotiate
request_packet = negotiate_request
raw_response = send_recv(request_packet)
response_packet = negotiate_response(raw_response)
# The list of dialect identifiers sent to the server is stored
- 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 extend_top_level_class
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def extend_top_level_class
current = self
loop do
current.extend(TopLevelPlugin) unless current.is_a?(TopLevelPlugin)
if current.parent.nil?
- 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 find
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def find(src, target, max_len)
result_offset = 0
result_length = 0
1.upto(max_len - 1) do |i|
offset = src.rindex(target[0...i])
- 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 read
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read(bytes: size, offset: 0)
max_read = tree.client.server_max_read_size
max_read = 65536 unless tree.client.server_supports_multi_credit
atomic_read_size = [bytes, max_read].min
credit_charge = 0
Method send_recv
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_recv(packet, encrypt: false)
version = packet.packet_smb_version
case version
when 'SMB1'
packet.smb_header.uid = self.user_id if self.user_id