rapid7/metasploit-framework

View on GitHub
modules/post/linux/gather/manageengine_password_manager_creds.rb

Summary

Maintainability
C
1 day
Test Coverage

File manageengine_password_manager_creds.rb has 283 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class MetasploitModule < Msf::Post

  include Msf::Post::File
  include Msf::Post::Process

Severity: Minor
Found in modules/post/linux/gather/manageengine_password_manager_creds.rb - About 2 hrs to fix

    Method run has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        install_path = datastore['INSTALL_PATH'].blank? ? detect_install_path : datastore['INSTALL_PATH']
        unless install_path
          fail_with(Failure::BadConfig,
                    'Unable to detect the PMP installation path. Use the INSTALL_PATH option instead.')
    Severity: Minor
    Found in modules/post/linux/gather/manageengine_password_manager_creds.rb - About 1 hr 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 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def initialize(info = {})
        super(
          update_info(
            info,
            'Name' => 'Linux Gather ManageEngine Password Manager Pro Password Extractor',
    Severity: Minor
    Found in modules/post/linux/gather/manageengine_password_manager_creds.rb - About 1 hr to fix

      Method detect_service has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def detect_service
          # Check if PMP is installed as a service. The default Linux installer
          # just create a symlink to the `pmp-service` service script in `/etc/init.d/`.
          vprint_status('Trying to detect path from the PMP service')
      
      
      Severity: Minor
      Found in modules/post/linux/gather/manageengine_password_manager_creds.rb - About 1 hr to fix

        Method get_db_enc_key has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def get_db_enc_key(install_path)
            vprint_status('Getting the database encryption key')
        
            manage_key_conf_path = "#{install_path}/#{MANAGE_KEY_CONF_PATH}"
            begin
        Severity: Minor
        Found in modules/post/linux/gather/manageengine_password_manager_creds.rb - About 1 hr to fix

          Method run has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def run
              install_path = datastore['INSTALL_PATH'].blank? ? detect_install_path : datastore['INSTALL_PATH']
              unless install_path
                fail_with(Failure::BadConfig,
                          'Unable to detect the PMP installation path. Use the INSTALL_PATH option instead.')
          Severity: Minor
          Found in modules/post/linux/gather/manageengine_password_manager_creds.rb - About 1 hr to fix

            Method detect_service has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def detect_service
                # Check if PMP is installed as a service. The default Linux installer
                # just create a symlink to the `pmp-service` service script in `/etc/init.d/`.
                vprint_status('Trying to detect path from the PMP service')
            
            
            Severity: Minor
            Found in modules/post/linux/gather/manageengine_password_manager_creds.rb - About 55 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

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

              def get_db_enc_key(install_path)
                vprint_status('Getting the database encryption key')
            
                manage_key_conf_path = "#{install_path}/#{MANAGE_KEY_CONF_PATH}"
                begin
            Severity: Minor
            Found in modules/post/linux/gather/manageengine_password_manager_creds.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

            Avoid too many return statements within this method.
            Open

                  return
            Severity: Major
            Found in modules/post/linux/gather/manageengine_password_manager_creds.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                    return install_dir.join('/')
              Severity: Major
              Found in modules/post/linux/gather/manageengine_password_manager_creds.rb - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status