File java_jmx_server.rb
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpServer
include Msf::Exploit::Remote::Java::Rmi::Client
Method load_payload_from_url
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_payload_from_url(conn_stub)
vprint_status("Creating javax.management.loading.MLet MBean...")
begin
res = send_jmx_create_mbean(
Method exploit
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exploit
vprint_status("Starting service...")
start_service
@mlet = "MLet#{rand_text_alpha(8 + rand(4)).capitalize}"
Method initialize
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(update_info(info,
'Name' => 'Java JMX Server Insecure Configuration Java Code Execution',
'Description' => %q{
This module takes advantage a Java JMX interface insecure configuration, which would
Method on_request_uri
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def on_request_uri(cli, request)
if @jar.nil?
p = regenerate_payload(cli)
@jar = p.encoded_jar({random:true})
paths = [
Method exploit
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def exploit
vprint_status("Starting service...")
start_service
@mlet = "MLet#{rand_text_alpha(8 + rand(4)).capitalize}"
- 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 load_payload_from_url
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load_payload_from_url(conn_stub)
vprint_status("Creating javax.management.loading.MLet MBean...")
begin
res = send_jmx_create_mbean(
- 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 false
Method check
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check
connect
unless is_rmi?
return Exploit::CheckCode::Safe
- 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"