rapid7/metasploit-framework

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

Summary

Maintainability
F
5 days
Test Coverage

Method get_registry has a Cognitive Complexity of 123 (exceeds 5 allowed). Consider refactoring.
Open

  def get_registry(outlook_ver)
    # Determine if saved accounts exist within Outlook.  Ignore the Address Book and Personal Folder registry entries.
    outlook_exists = 0
    saved_accounts = 0

Severity: Minor
Found in modules/post/windows/gather/credentials/outlook.rb - About 2 days 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_registry has 245 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def get_registry(outlook_ver)
    # Determine if saved accounts exist within Outlook.  Ignore the Address Book and Personal Folder registry entries.
    outlook_exists = 0
    saved_accounts = 0

Severity: Major
Found in modules/post/windows/gather/credentials/outlook.rb - About 1 day to fix

    File outlook.rb has 337 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Post
      include Msf::Post::Windows::Registry
      include Msf::Post::Windows::Priv
      include Msf::Auxiliary::Report
    
    
    Severity: Minor
    Found in modules/post/windows/gather/credentials/outlook.rb - About 4 hrs to fix

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

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

        Avoid deeply nested control flow statements.
        Open

                  if !imap_use_spa.nil? # Account for SPA (NTLM auth)
                    print_status('     Secure Password Authentication (SPA): Enabled')
                  end
        Severity: Major
        Found in modules/post/windows/gather/credentials/outlook.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      if http_server_url.include? "h\x00t\x00t\x00p\x00s"
                        portnum = 443
                      else
                        portnum = 80
                      end
          Severity: Major
          Found in modules/post/windows/gather/credentials/outlook.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                      if smtp_use_ssl.nil?
                        print_status('     SMTP Use SSL: No')
                      else
                        print_status('     SMTP Use SSL: Yes')
                      end
            Severity: Major
            Found in modules/post/windows/gather/credentials/outlook.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        if imap_password.nil?
                          print_status('     User Password: <not stored>')
                        else
                          imap_password.slice!(0, 1)
                          pass = decrypt_password(imap_password)
              Severity: Major
              Found in modules/post/windows/gather/credentials/outlook.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                          if imap_use_ssl.nil?
                            print_status('     IMAP Use SSL: No')
                          else
                            print_status('     IMAP Use SSL: Yes')
                          end
                Severity: Major
                Found in modules/post/windows/gather/credentials/outlook.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                            if smtp_use_auth.nil? # Account for SMTP servers requiring authentication
                              print_status("     Outgoing Mail Server (SMTP): #{smtp_server}")
                            else
                              print_status("     Outgoing Mail Server (SMTP): #{smtp_server}   [Authentication Required]")
                              # Check if smtp_auth_method is null.  If so, the inbound credentials are utilized
                  Severity: Major
                  Found in modules/post/windows/gather/credentials/outlook.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                              if imap_port.nil?
                                print_status('     IMAP Port: 143')
                                portnum = 143
                              else
                                print_status("     IMAP Port: #{imap_port}")
                    Severity: Major
                    Found in modules/post/windows/gather/credentials/outlook.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                if smtp_port.nil?
                                  print_status('     SMTP Port: 25')
                                  smtp_port = 25
                                else
                                  print_status("     SMTP Port: #{smtp_port}")
                      Severity: Major
                      Found in modules/post/windows/gather/credentials/outlook.rb - About 45 mins to fix

                        There are no issues that match your filters.

                        Category
                        Status