Showing 173 of 310 total issues
Method run_authentication
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def run_authentication(address, smb1, smb2, smb3, username, password)
Method parse_smb3_capabilities
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_smb3_capabilities(response_packet)
nc = response_packet.find_negotiate_context(
RubySMB::SMB2::NegotiateContext::SMB2_PREAUTH_INTEGRITY_CAPABILITIES
)
@preauth_integrity_hash_algorithm = RubySMB::SMB2::PreauthIntegrityCapabilities::HASH_ALGORITM_MAP[nc&.data&.hash_algorithms&.first]
- 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 net_share_enum_all
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def net_share_enum_all(host)
host = "\\\\#{host}" unless host.start_with?('\\\\')
bind(endpoint: RubySMB::Dcerpc::Srvsvc)
net_share_enum_all_request_packet = RubySMB::Dcerpc::Srvsvc::NetShareEnumAllRequest.new(server_name: host)
- 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_nt_create_andx_smb1
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def do_nt_create_andx_smb1(request)
path = request.data_block.file_name.snapshot
path = path.encode.gsub(/\/|\\/, File::SEPARATOR)
path = path.delete_prefix(File::SEPARATOR)
local_path = get_local_path(path)
- 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_andx_smb1
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def do_session_setup_andx_smb1(request, session)
session_id = request.smb_header.uid
if session_id == 0
session_id = rand(1..0x10000)
session = @session_table[session_id] = Server::Session.new(session_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 sanitize_parameters!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def sanitize_parameters!(obj_class, params)
res = super
type_class = params[:type]
# Let the BinData::Array sanitization routine deal with "no type provided"
- 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 display_field
has a Cognitive Complexity of 8 (exceeds 5 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
- 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 assign
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def assign(val)
if val == :null
@ref_id = 0
elsif is_alias?
ref_field = fetch_alias_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 run_negotiation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def run_negotiation(address, smb1, smb2, smb3, netbios_name)
Method run_negotiation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def run_negotiation(address, smb1, smb2, smb3, opts = {})
Method do_write
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def do_write(io)
if should_process_max_count?
max_count = retrieve_max_count
io.writebytes([max_count].pack('L<')) if max_count
- 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_and_return_value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def read_and_return_value(io)
max_length = eval_parameter(:max_length)
if max_length && max_length % 2 != 0
raise ArgumentError, "[Stringz16] #max_length should be a multiple of "\
"two, since it is Unicode (got #{max_length})"
- 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 send_packet
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def send_packet(packet, nbss_header: true)
data = nbss_header ? nbss(packet) : ''
data << packet.to_binary_s
bytes_written = 0
begin
- 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 method_missing
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(symbol, *args)
# should we forward to one of the stat methods
if STAT_METHODS.include?(symbol)
# if we have a stat object then forward it
return stat.send(symbol, *args) if exist?
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def do_num_bytes
sum = 0
if should_process_max_count?
# count max_count (4 bytes)
- 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 enum_registry_key
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def enum_registry_key(key, bind: true)
bind(endpoint: RubySMB::Dcerpc::Winreg) if bind
root_key, sub_key = key.gsub(/\//, '\\').split('\\', 2)
root_key_handle = open_root_key(root_key)
- 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_transactions2_smb1
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def do_transactions2_smb1(request)
# can't find an example where more than one setup is set, this code makes alot of assumptions that there
# are exactly 0 or 1 entries
if request.parameter_block.setup.length > 1
raise NotImplementedError, 'There are more than 1 TRANSACTION2 setup values'
- 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 bytes_to_align
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def bytes_to_align(obj, rel_offset)
if obj.is_a?(PointerPlugin)
# Pointers are always 4-bytes aligned
return (4 - (rel_offset % 4)) % 4
end
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.compress(buf, chunk_size: 0x1000)
out = ''
until buf.empty?
chunk = buf[0...chunk_size]
compressed = compress_chunk(chunk)
- 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 add
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add(virtual_pathname)
raise ArgumentError.new('paths must be absolute') unless virtual_pathname.absolute?
path = virtual_pathname.to_s
raise ArgumentError.new('paths must be normalized') unless VirtualPathname.cleanpath(path) == path
- 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"