rapid7/metasploit-framework

View on GitHub
modules/exploits/windows/http/octopusdeploy_deploy.rb

Summary

Maintainability
C
1 day
Test Coverage

File octopusdeploy_deploy.rb has 313 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'json'

class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking

Severity: Minor
Found in modules/exploits/windows/http/octopusdeploy_deploy.rb - About 3 hrs to fix

    Class MetasploitModule has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Exploit::Remote
      Rank = ExcellentRanking
    
      include Msf::Exploit::Remote::HttpClient
      include Msf::Exploit::Powershell
    Severity: Minor
    Found in modules/exploits/windows/http/octopusdeploy_deploy.rb - About 3 hrs to fix

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

        def exploit
          # Generate the powershell payload
          command = cmd_psh_payload(payload.encoded, payload_instance.arch.first, remove_comspec: true, wrap_double_quotes: true)
          step_name = datastore['STEPNAME'] || rand_text_alphanumeric(4 + rand(32 - 4))
          session = create_octopus_session unless datastore['APIKEY']
      Severity: Major
      Found in modules/exploits/windows/http/octopusdeploy_deploy.rb - About 2 hrs to fix

        Method initialize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def initialize(info = {})
            super(update_info(info,
              'Name'        => 'Octopus Deploy Authenticated Code Execution',
              'Description' => %q{
                  This module can be used to execute a payload on an Octopus Deploy server given
        Severity: Minor
        Found in modules/exploits/windows/http/octopusdeploy_deploy.rb - About 1 hr to fix

          Method check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def check
              res = nil
              if datastore['APIKEY']
                res = check_api_key
              elsif datastore['USERNAME'] && datastore['PASSWORD']
          Severity: Minor
          Found in modules/exploits/windows/http/octopusdeploy_deploy.rb - About 45 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