lib/msf/core/exploit/remote/http/nagios_xi/install.rb
Method install_nagios_xi
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def install_nagios_xi(pass)
print_status('Attempting to finish the Nagios XI installation on the target using the provided password. The username will be `nagiosadmin`.')
# Visit the install page to obtain the cookies and nsp token required for installing the app
res_install_page = send_request_cgi({
Method install_nagios_xi
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def install_nagios_xi(pass)
print_status('Attempting to finish the Nagios XI installation on the target using the provided password. The username will be `nagiosadmin`.')
# Visit the install page to obtain the cookies and nsp token required for installing the app
res_install_page = send_request_cgi({
- 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 sign_license_agreement
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def sign_license_agreement(cookies, nsp)
if cookies.blank?
return [2, 'Cannot sign the license agreement. The provided cookies are empty or nil.']
end
Method sign_license_agreement
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def sign_license_agreement(cookies, nsp)
if cookies.blank?
return [2, 'Cannot sign the license agreement. The provided cookies are empty or nil.']
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
Avoid too many return
statements within this method. Open
Open
return
Avoid too many return
statements within this method. Open
Open
return [1, 'Connection failed']
Avoid too many return
statements within this method. Open
Open
return
Avoid too many return
statements within this method. Open
Open
return [2, 'Received unexpected reply while trying to install Nagios XI on the target.']