lib/msf/core/post/windows/ldap.rb
Method query_ldap
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
def query_ldap(session_handle, base, scope, filter, fields)
vprint_status('Searching LDAP directory')
search = wldap32.ldap_search_sA(session_handle, base, scope, filter, nil, 0, 4)
if search['return'] == LDAP_SIZELIMIT_EXCEEDED
print_error('LDAP_SIZELIMIT_EXCEEDED, parsing what we retrieved, try increasing the MAX_SEARCH value [0:LDAP_NO_LIMIT]')
- 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 query_ldap
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def query_ldap(session_handle, base, scope, filter, fields)
vprint_status('Searching LDAP directory')
search = wldap32.ldap_search_sA(session_handle, base, scope, filter, nil, 0, 4)
if search['return'] == LDAP_SIZELIMIT_EXCEEDED
print_error('LDAP_SIZELIMIT_EXCEEDED, parsing what we retrieved, try increasing the MAX_SEARCH value [0:LDAP_NO_LIMIT]')
Method bind_default_ldap_server
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def bind_default_ldap_server(size_limit, domain = nil)
vprint_status('Initializing LDAP connection.')
# If domain is still null the API may be able to handle it...
init_result = wldap32.ldap_sslinitA(domain, 389, 0)
Method query
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def query(filter, max_results, fields, domain = nil)
domain ||= datastore['DOMAIN']
domain ||= get_domain
if domain.blank?
- 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 query_ldap
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def query_ldap(session_handle, base, scope, filter, fields)