File registry_parser.rb
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Msf
module Util
module WindowsRegistry
#
Method find_root_key
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def find_root_key
reg_hbin = nil
# Split the data in 4096-bytes blocks
@hive_data.unpack('a4096' * (@hive_data.size / 4096)).each do |data|
next unless data[0,4] == 'hbin'
- 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_sub_key
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def find_sub_key(parent_key, sub_key)
unless parent_key&.data&.magic == NK_MAGIC
raise ArgumentError, "find_sub_key: parent key must be a NK record"
end
block = get_block(parent_key.data.offset_sub_key_lf)
- 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 get_value
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_value(reg_key, reg_value = nil)
reg_key = find_key(reg_key)
return nil unless reg_key
if reg_key.data.num_values > 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 get_offset
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_offset(magic, hash_rec, key)
case magic
when LF_MAGIC
if hash_rec.key_name.gsub(/(^\x00*)|(\x00*$)/, '') == key[0,4]
return hash_rec.offset_nk
- 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_key
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def find_key(key)
# Let's strip '\' from the beginning, except for the case of
# only asking for the root node
key = key[1..-1] if key[0] == '\\' && key.size > 1
- 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_values
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def enum_values(key)
key_obj = find_key(key)
return nil unless key_obj
unless key_obj&.data&.magic == NK_MAGIC
- 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_key
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def enum_key(key)
parent_key = find_key(key)
return nil unless parent_key
unless parent_key.data&.magic == NK_MAGIC
- 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"