rapid7/metasploit-framework

View on GitHub
modules/exploits/linux/http/dcos_marathon.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method exploit has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def exploit
    if get_apps.nil?
      fail_with(Failure::Unknown, 'Failed to connect to the targeturi')
    end
    # create required information to create json container information.
Severity: Minor
Found in modules/exploits/linux/http/dcos_marathon.rb - About 2 hrs to fix

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 initialize has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def initialize(info = {})
    super(update_info(info,
      'Name'           => 'DC/OS Marathon UI Docker Exploit',
      'Description'    => %q{
        Utilizing the DCOS Cluster's Marathon UI, an attacker can create
Severity: Minor
Found in modules/exploits/linux/http/dcos_marathon.rb - About 1 hr to fix

    Method exploit has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def exploit
        if get_apps.nil?
          fail_with(Failure::Unknown, 'Failed to connect to the targeturi')
        end
        # create required information to create json container information.
    Severity: Minor
    Found in modules/exploits/linux/http/dcos_marathon.rb - About 1 hr to fix

      Method make_container has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def make_container(mnt_path, cron_path, payload_path, container_id)
          vprint_status('Setting container json request variables')
          container_data = {
            'cmd'                 => make_cmd(mnt_path, cron_path, payload_path),
            'cpus'                => 1,
      Severity: Minor
      Found in modules/exploits/linux/http/dcos_marathon.rb - About 1 hr to fix

        Method get_apps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def get_apps
            res = send_request_raw({
              'method'  => 'GET',
              'uri'     => target_uri.path
            })
        Severity: Minor
        Found in modules/exploits/linux/http/dcos_marathon.rb - About 25 mins to fix

        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

        There are no issues that match your filters.

        Category
        Status