Showing 173 of 310 total issues
Method get_host_port_from_ept_mapper
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_host_port_from_ept_mapper(uuid:, maj_ver:, min_ver:, max_towers: 1)
decoded_tower = EpmDecodedTowerOctetString.new(
interface_identifier: {
interface: uuid,
major_version: maj_ver,
Method cert_server_request
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cert_server_request(attributes:, authority:, csr:)
cert_server_request_request = CertServerRequestRequest.new(
pwsz_authority: authority,
pctb_attribs: { pb: (attributes.map { |k,v| "#{k}:#{v}" }.join("\n").encode('UTF-16LE').force_encoding('ASCII-8BIT') + "\x00\x00".b) },
pctb_request: { pb: csr.to_der }
Method oid_from_attid
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def oid_from_attid(attr_typ)
upper_word = attr_typ / 0x10000
lower_word = attr_typ % 0x10000
prefix_table = self.prefix_table_src.p_prefix_entry
binary_oid = 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 do_read
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def do_read(io, is_deferred: false)
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.
# The structure itself will be properly aligned later.
- 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_write
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def do_write(io, is_deferred: false)
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.
# The structure itself will be properly aligned later.
- 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 dcerpc_request
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def dcerpc_request(stub_packet, auth_level: nil, auth_type: nil)
stub_class = stub_packet.class.name.split('::')
#opts.merge!(endpoint: stub_class[-2])
values = {
opnum: stub_packet.opnum,
- 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 run
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def run
loop do
begin
raw_request = recv_packet
rescue RubySMB::Error::CommunicationError
- 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 list
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def list(directory: nil, pattern: '*', type: RubySMB::Fscc::FileInformation::FileIdFullDirectoryInformation)
create_response = open_directory(directory: directory)
opened_directory = RubySMB::SMB2::File.new(tree: self, response: create_response, name: directory)
file_id = create_response.file_id
- 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_session_setup_smb2
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def do_session_setup_smb2(request, session)
@smb2_related_operations_state.delete(:session_id)
session_id = request.smb2_header.session_id
if session_id == 0
Method do_negotiate_smb1
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def do_negotiate_smb1(request)
client_dialects = request.dialects.map(&:dialect_string).map(&:value)
if client_dialects.include?(Client::SMB1_DIALECT_SMB2_WILDCARD) && \
@server.dialects.any? { |dialect| Dialect[dialect].order == Dialect::ORDER_SMB2 }
Method list
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list(directory: nil, pattern: '*', type: RubySMB::Fscc::FileInformation::FileIdFullDirectoryInformation)
create_response = open_directory(directory: directory)
opened_directory = RubySMB::SMB2::File.new(tree: self, response: create_response, name: directory)
file_id = create_response.file_id
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 smb2_authenticate
has 36 lines of code (exceeds 25 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)
Method drs_get_nc_changes
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def drs_get_nc_changes(h_drs, nc_guid:, dsa_object_guid:)
drs_get_nc_changes_request = DrsGetNcChangesRequest.new(
h_drs: h_drs,
dw_in_version: 8,
pmsg_in: {
Method initialize
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(dispatcher, smb1: true, smb2: true, smb3: true, username:, password:, domain: '.',
local_workstation: 'WORKSTATION', always_encrypt: true, ntlm_flags: NTLM::DEFAULT_CLIENT_FLAGS)
raise ArgumentError, 'No Dispatcher provided' unless dispatcher.is_a? RubySMB::Dispatcher::Base
if smb1 == false && smb2 == false && smb3 == false
raise ArgumentError, 'You must enable at least one Protocol'
Method display_field
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def display_field(field, depth = 0, parents = [])
my_parents = parents.dup
field_str = ''
name = field[:name]
if field[:class] == BinData::Array
Method compress_chunk
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.compress_chunk(chunk)
blob = chunk
out = ''
pow2 = 0x10
l_mask3 = 0x1002
Method write_ref_id
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def write_ref_id(io)
if is_alias?
ref_field = fetch_alias_referent
if ref_field
if ref_field.class != self.class
- 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 share_io
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def share_io(method_name, request)
@provider.hooks.each do |hook|
next unless hook.request_class == request.class && hook.location == :before
request = hook.callback.call(@session, request) || 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 consume_dirents
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def consume_dirents(local_path, dirents, filter_regex: nil)
until dirents.empty?
dirent = dirents.shift
next unless dirent.file? || dirent.directory? # filter out everything but files and directories
- 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"