Method run
has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring. Open
def run
print_status("Upgrading session ID: #{datastore['SESSION']}")
# Try hard to find a valid LHOST value in order to
# make running 'sessions -u' as robust as possible.
- 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
has 161 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
print_status("Upgrading session ID: #{datastore['SESSION']}")
# Try hard to find a valid LHOST value in order to
# make running 'sessions -u' as robust as possible.
File shell_to_meterpreter.rb
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rex/exploitation/cmdstager'
class MetasploitModule < Msf::Post
include Exploit::Powershell
include Post::Architecture
Method transmit_payload
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def transmit_payload(exe, platform)
#
# Generate the stager command array
#
linemax = 1700
- 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 transmit_payload
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def transmit_payload(exe, platform)
#
# Generate the stager command array
#
linemax = 1700
Method initialize
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Shell to Meterpreter Upgrade',
Method cleanup_handler
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def cleanup_handler(listener_job_id, aborted)
# Return if the job has already finished
return nil if framework.jobs[listener_job_id].nil?
framework.threads.spawn('ShellToMeterpreterUpgradeCleanup', false) do
- 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 check_for_listener
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check_for_listener(lhost, lport)
client.framework.jobs.each do |_k, j|
next unless j.name =~ %r{ multi/handler}
current_id = j.jid
- 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
return nil
Avoid too many return
statements within this method. Open
return nil
Avoid too many return
statements within this method. Open
return nil
Avoid too many return
statements within this method. Open
return nil
Avoid too many return
statements within this method. Open
return nil
Avoid too many return
statements within this method. Open
return nil