File execute_dotnet_assembly.rb
has 330 lines of code (exceeds 250 allowed). Consider refactoring. Open
class MetasploitModule < Msf::Post
include Msf::Post::File
include Msf::Exploit::Retry
include Msf::Post::Windows::Priv
Method execute_assembly
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def execute_assembly(exe_path, clr_version)
if datastore['TECHNIQUE'] == 'SPAWN_AND_INJECT'
self.hprocess = launch_process
self.terminate_process = datastore['KILL']
check_process_suitability(hprocess.pid)
- 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 execute_assembly
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute_assembly(exe_path, clr_version)
if datastore['TECHNIQUE'] == 'SPAWN_AND_INJECT'
self.hprocess = launch_process
self.terminate_process = datastore['KILL']
check_process_suitability(hprocess.pid)
Method initialize
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Execute .net Assembly (x64 only)',
Method copy_assembly
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def copy_assembly(pipe_name, appdomain_name, clr_version, exe_path, process)
print_status("Host injected. Copy assembly into #{process.pid}...")
# Structure:
# - Packed metadata (string/data lengths, flags)
# - Pipe Name
Method check_requirements
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check_requirements(clr_req, installed_dotnet_versions)
installed_dotnet_versions.each do |fi|
if clr_req == 'v4.0.30319'
if fi[0] == '4'
vprint_status('Requirements ok')
- 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 read_output
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def read_output(pipe, logfilename)
print_status('Start reading output')
print_status("Writing output to #{logfilename}")
logfile = File.open(logfilename, 'wb')
- 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 copy_assembly
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def copy_assembly(pipe_name, appdomain_name, clr_version, exe_path, process)
Method find_required_clr
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def find_required_clr(exe_path)
filecontent = File.read(exe_path).bytes
sign = 'v4.0.30319'.bytes
filecontent.each_with_index do |_item, index|
sign.each_with_index do |subitem, indexsub|
- 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 copy_assembly
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def copy_assembly(pipe_name, appdomain_name, clr_version, exe_path, process)
print_status("Host injected. Copy assembly into #{process.pid}...")
# Structure:
# - Packed metadata (string/data lengths, flags)
# - Pipe Name
- 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 open_process
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def open_process(pid)
if (pid == 0) || pid.nil?
fail_with(Failure::BadConfig, 'Inject technique selected, but no PID 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run
exe_path = datastore['DOTNET_EXE']
unless File.file?(exe_path)
fail_with(Failure::BadConfig, 'Assembly not found')
- 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"