modules/auxiliary/scanner/ssh/libssh_auth_bypass.rb
Method run_host
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Open
def run_host(ip)
if action.name == 'Execute' && datastore['CMD'].blank?
fail_with(Failure::BadConfig, 'Execute action requires CMD to be set')
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 run_host
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def run_host(ip)
if action.name == 'Execute' && datastore['CMD'].blank?
fail_with(Failure::BadConfig, 'Execute action requires CMD to be set')
end
Method initialize
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(info = {})
super(update_info(info,
'Name' => 'libssh Authentication Bypass Scanner',
'Description' => %q{
This module exploits an authentication bypass in libssh server code
Avoid too many return
statements within this method. Open
Open
return
Method check_banner
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def check_banner(ip, version)
version =~ /libssh[_-]?([\d.]*)$/ && $1 && (v = Rex::Version.new($1))
if v.nil?
vprint_error("#{ip}:#{rport} - #{version} does not appear to be libssh")
- 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"