Method run
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def run
unless datastore['CURRENT'] || datastore['RECENT'] || datastore['ENTERED']
fail_with(Failure::BadConfig, 'At least one option (CURRENT, RECENT, ENTERED) must be enabled. Nothing to do.')
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 enum_conf_shares
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def enum_conf_shares
shares_key = nil
[
'HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\services\\LanmanServer\\Shares',
- 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_conf_shares
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def enum_conf_shares
shares_key = nil
[
'HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\services\\LanmanServer\\Shares',
Method run
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
unless datastore['CURRENT'] || datastore['RECENT'] || datastore['ENTERED']
fail_with(Failure::BadConfig, 'At least one option (CURRENT, RECENT, ENTERED) must be enabled. Nothing to do.')
end
Method initialize
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Windows Gather SMB Share Enumeration via Registry',
Method enum_recent_mounts
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def enum_recent_mounts(base_key)
partial_path = base_key + '\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer'
explorer_keys = registry_enumkeys(partial_path).to_s || ''
return [] unless explorer_keys.include?('Map Network Drive MRU')
- 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_run_unc
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def enum_run_unc(base_key)
full_path = base_key + '\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU'
vals_found = registry_enumvals(full_path)
return [] unless vals_found
- 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"