Method get_files_info
has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring. Open
def get_files_info(ip, shares)
# Creating a separate file for each IP address's results.
detailed_tbl = Rex::Text::Table.new(
'Header' => "Spidered results for #{ip}.",
'Indent' => 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 get_files_info
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_files_info(ip, shares)
# Creating a separate file for each IP address's results.
detailed_tbl = Rex::Text::Table.new(
'Header' => "Spidered results for #{ip}.",
'Indent' => 1,
File smb_enumshares.rb
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
class MetasploitModule < Msf::Auxiliary
# Exploit mixins should be called first
include Msf::Exploit::Remote::SMB::Client
include Msf::Exploit::Remote::SMB::Client::Authenticated
Method run_host
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def run_host(ip)
if session
print_status("Using existing session #{session.sid}")
client = session.client
self.simple = ::Rex::Proto::SMB::SimpleClient.new(client.dispatcher.tcp_socket, client: client)
- 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_tree
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def enum_tree(tree, share, subdir = '')
subdir = subdir[1..subdir.length] if subdir.starts_with?('\\')
read = tree.permissions.read_ea == 1
write = tree.permissions.write_ea == 1
skip = false
- 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_shares
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def enum_shares(ip)
shares = []
begin
# Return all shares if `Shares` option has not been set
- 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_shares
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def enum_shares(ip)
shares = []
begin
# Return all shares if `Shares` option has not been set
Method run_host
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_host(ip)
if session
print_status("Using existing session #{session.sid}")
client = session.client
self.simple = ::Rex::Proto::SMB::SimpleClient.new(client.dispatcher.tcp_socket, client: client)
Method initialize
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'SMB Share Enumeration',
Method enum_tree
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def enum_tree(tree, share, subdir = '')
subdir = subdir[1..subdir.length] if subdir.starts_with?('\\')
read = tree.permissions.read_ea == 1
write = tree.permissions.write_ea == 1
skip = false