rapid7/metasploit-framework

View on GitHub
modules/post/windows/gather/credentials/rdc_manager_creds.rb

Summary

Maintainability
C
1 day
Test Coverage

Method parse_connections has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_connections(connection_data)
    doc = REXML::Document.new(connection_data)

    # Process all of the server records
    doc.elements.each('//server') do |server|
Severity: Minor
Found in modules/post/windows/gather/credentials/rdc_manager_creds.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 run has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    if is_system?
      uid = session.sys.config.getuid
      print_warning("This module is running under #{uid}.")
      print_warning('Automatic decryption of encrypted passwords will not be possible.')
Severity: Minor
Found in modules/post/windows/gather/credentials/rdc_manager_creds.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 extract_password has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def extract_password(object)
    if object.name == 'server'
      logon_creds = object.elements['logonCredentials']
    elsif object.elements['properties'] && object.elements['properties'].elements['logonCredentials']
      logon_creds = object.elements['properties'].elements['logonCredentials']
Severity: Minor
Found in modules/post/windows/gather/credentials/rdc_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 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Windows Gather Remote Desktop Connection Manager Saved Password Extraction',
Severity: Minor
Found in modules/post/windows/gather/credentials/rdc_manager_creds.rb - About 1 hr to fix

    Method parse_connections has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def parse_connections(connection_data)
        doc = REXML::Document.new(connection_data)
    
        # Process all of the server records
        doc.elements.each('//server') do |server|
    Severity: Minor
    Found in modules/post/windows/gather/credentials/rdc_manager_creds.rb - About 1 hr to fix

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

        def run
          if is_system?
            uid = session.sys.config.getuid
            print_warning("This module is running under #{uid}.")
            print_warning('Automatic decryption of encrypted passwords will not be possible.')
      Severity: Minor
      Found in modules/post/windows/gather/credentials/rdc_manager_creds.rb - About 1 hr to fix

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

          def register_creds(host_ip, user, pass, realm, port)
            # Note that entries added by hostname instead of IP will not
            # generate complete records.  See discussion here:
            # https://github.com/rapid7/metasploit-framework/pull/3599#issuecomment-51710319
        
        
        Severity: Minor
        Found in modules/post/windows/gather/credentials/rdc_manager_creds.rb - About 1 hr to fix

          Method register_creds has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def register_creds(host_ip, user, pass, realm, port)
          Severity: Minor
          Found in modules/post/windows/gather/credentials/rdc_manager_creds.rb - About 35 mins to fix

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

              def decrypt_password(data)
                session.railgun.add_dll('crypt32') unless session.railgun.get_dll('crypt32')
            
                pid = client.sys.process.getpid
                process = client.sys.process.open(pid, PROCESS_ALL_ACCESS)
            Severity: Minor
            Found in modules/post/windows/gather/credentials/rdc_manager_creds.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