modules/exploits/linux/http/vmware_vrli_rce.rb
Method generate_malicious_tar
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def generate_malicious_tar
mf_file = <<~EOF.strip
{
"CHECKSUMS": [
{
File vmware_vrli_rce.rb
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'rex/proto/thrift'
require 'rex/stopwatch'
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
Method exploit
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def exploit
# This is an important check...
fail_with(Failure::BadConfig, 'SRVHOST can\'t be localhost') if datastore['SRVHOST'] =~ /(127|0)\.0\.0\.(0|1)|localhost/
# Step 1 generate malicious TAR archive
Method initialize
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'VMware vRealize Log Insight Unauthenticated RCE',
Method exploit
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def exploit
# This is an important check...
fail_with(Failure::BadConfig, 'SRVHOST can\'t be localhost') if datastore['SRVHOST'] =~ /(127|0)\.0\.0\.(0|1)|localhost/
# Step 1 generate malicious TAR archive
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def check
print_status "Checking if #{peer} can be exploited."
res = send_request_cgi({
'uri' => normalize_uri(target_uri.path, 'i18n', 'component'),
'method' => 'GET'
- 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"