rapid7/metasploit-framework

View on GitHub
modules/auxiliary/gather/manageengine_datasecurity_plus_xnode_enum.rb

Summary

Maintainability
F
3 days
Test Coverage

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

  def run
    # check if we already have a socket, if not, create one
    unless @sock
      # create a socket
      res_code, sock_or_msg = create_socket_for_xnode(rhost, rport)
Severity: Minor
Found in modules/auxiliary/gather/manageengine_datasecurity_plus_xnode_enum.rb - About 1 day 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 run has 122 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def run
    # check if we already have a socket, if not, create one
    unless @sock
      # create a socket
      res_code, sock_or_msg = create_socket_for_xnode(rhost, rport)
Severity: Major
Found in modules/auxiliary/gather/manageengine_datasecurity_plus_xnode_enum.rb - About 4 hrs to fix

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

      def initialize(_info = {})
        super(
          'Name' => 'ManageEngine DataSecurity Plus Xnode Enumeration',
          'Description' => %q{
            This module exploits default admin credentials for the DataEngine

      Avoid too many return statements within this method.
      Open

            return Exploit::CheckCode::Unknown('An unexpected error occurred whilst running this module. Please raise a bug ticket!')
      Severity: Major
      Found in modules/auxiliary/gather/manageengine_datasecurity_plus_xnode_enum.rb - About 30 mins to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            datasecurity_plus_data_repos.each do |repo|
              # send a general query, which should return the "total_hits" parameter that represents the total record count
              res_code, res = get_response(@sock, action_dr_search(repo))
              total_hits = process_dr_search(res, res_code, repo, ['UNIQUE_ID'], 'total_hits')
              # check if total_hits is nil, as that means process_dr_search failed and we should skip to the next repo
        modules/auxiliary/gather/manageengine_adaudit_plus_xnode_enum.rb on lines 136..168

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 126.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

              until hit_upper_limit
                # build a custom query for the unique_id range
                custom_query = { 'query' => "UNIQUE_ID:[#{id_range_lower} TO #{id_range_upper}]" }
                query = action_dr_search(repo, fields, custom_query)
                res_code, res = get_response(@sock, query)
        modules/auxiliary/gather/manageengine_adaudit_plus_xnode_enum.rb on lines 225..246

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 81.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

          def check
            # create a socket
            res_code, sock_or_msg = create_socket_for_xnode(rhost, rport)
            if res_code == 1
              return Exploit::CheckCode::Unknown(sock_or_msg)
        modules/auxiliary/gather/manageengine_adaudit_plus_xnode_enum.rb on lines 70..89

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 61.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            if dump_all
              data_to_dump = datasecurity_plus_data_repos
            else
              data_to_dump = grab_config(config_file)
        
        
        modules/auxiliary/gather/manageengine_adaudit_plus_xnode_enum.rb on lines 178..191

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 54.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          def initialize(_info = {})
            super(
              'Name' => 'ManageEngine DataSecurity Plus Xnode Enumeration',
              'Description' => %q{
                This module exploits default admin credentials for the DataEngine
        modules/auxiliary/gather/manageengine_adaudit_plus_xnode_enum.rb on lines 12..51

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 51.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            if res_code == 0
              if res_info['response'].keys.include?('xnode_version')
                print_status("Target is running Xnode version: \"#{res_info['response']['xnode_version']}\".")
              else
                print_warning('Failed to obtain the Xnode version.')
        modules/auxiliary/gather/manageengine_adaudit_plus_xnode_enum.rb on lines 120..130

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 41.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        There are no issues that match your filters.

        Category
        Status