File service_persistence.rb
has 359 lines of code (exceeds 250 allowed). Consider refactoring. Open
class MetasploitModule < Msf::Exploit::Local
Rank = ExcellentRanking
include Msf::Post::File
include Msf::Post::Unix
Method system_v
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
def system_v(backdoor_path, backdoor_file, runlevel, has_updatercd)
if has_updatercd
print_status('Utilizing update-rc.d')
else
print_status('Utilizing chkconfig')
Method initialize
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Service Persistence',
Method systemd_user
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def systemd_user(backdoor_path, backdoor_file)
script = <<~EOF
[Unit]
Description=Start daemon at boot time
After=
Method system_v
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def system_v(backdoor_path, backdoor_file, runlevel, has_updatercd)
if has_updatercd
print_status('Utilizing update-rc.d')
else
print_status('Utilizing chkconfig')
- 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 exploit
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exploit
backdoor = write_shell(datastore['BACKDOOR_PATH'])
if backdoor.nil?
return
end
Method exploit
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def exploit
backdoor = write_shell(datastore['BACKDOOR_PATH'])
if backdoor.nil?
return
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 systemd_user
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def systemd_user(backdoor_path, backdoor_file)
script = <<~EOF
[Unit]
Description=Start daemon at boot time
After=
- 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"