rapid7/metasploit-framework

View on GitHub
modules/post/windows/gather/enum_chrome.rb

Summary

Maintainability
D
2 days
Test Coverage

Method process_files has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

  def process_files(username)
    secrets = ''
    masterkey = nil
    decrypt_table = Rex::Text::Table.new(
      'Header' => 'Decrypted data',
Severity: Minor
Found in modules/post/windows/gather/enum_chrome.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

File enum_chrome.rb has 322 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class MetasploitModule < Msf::Post
  include Msf::Post::File
  include Msf::Post::Windows::Priv

  def initialize(info = {})
Severity: Minor
Found in modules/post/windows/gather/enum_chrome.rb - About 3 hrs to fix

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

      def run
        @chrome_files = [
          { raw: '', in_file: 'Web Data', sql: 'select * from autofill;' },
          { raw: '', in_file: 'Web Data', sql: 'SELECT username_value,origin_url,signon_realm FROM logins;' },
          { raw: '', in_file: 'Web Data', sql: 'select * from autofill_profiles;' },
    Severity: Major
    Found in modules/post/windows/gather/enum_chrome.rb - About 2 hrs to fix

      Method process_files has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def process_files(username)
          secrets = ''
          masterkey = nil
          decrypt_table = Rex::Text::Table.new(
            'Header' => 'Decrypted data',
      Severity: Major
      Found in modules/post/windows/gather/enum_chrome.rb - About 2 hrs to fix

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

          def run
            @chrome_files = [
              { raw: '', in_file: 'Web Data', sql: 'select * from autofill;' },
              { raw: '', in_file: 'Web Data', sql: 'SELECT username_value,origin_url,signon_realm FROM logins;' },
              { raw: '', in_file: 'Web Data', sql: 'select * from autofill_profiles;' },
        Severity: Minor
        Found in modules/post/windows/gather/enum_chrome.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 initialize has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def initialize(info = {})
            super(
              update_info(
                info,
                'Name' => 'Windows Gather Google Chrome User Data Enumeration',
        Severity: Minor
        Found in modules/post/windows/gather/enum_chrome.rb - About 1 hr to fix

          Method migrate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def migrate(pid = nil)
              current_pid = session.sys.process.open.pid
              if !pid.nil? && (current_pid != pid)
                # PID is specified
                target_pid = pid
          Severity: Minor
          Found in modules/post/windows/gather/enum_chrome.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 parse_prefs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def parse_prefs(username, filepath)
              prefs = ''
              File.open(filepath, 'rb') do |f|
                prefs = f.read
              end
          Severity: Minor
          Found in modules/post/windows/gather/enum_chrome.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 decrypt_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def decrypt_data(data)
              mem = session.railgun.kernel32.LocalAlloc(0, data.length)['return']
              return nil if mem == 0
          
              session.railgun.memwrite(mem, data, data.length)
          Severity: Minor
          Found in modules/post/windows/gather/enum_chrome.rb - About 35 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 extract_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def extract_data(username)
              # Prepare Chrome's path on remote machine
              chrome_path = @profiles_path + '\\' + username + @data_path + 'Default'
              raw_files = {}
          
          
          Severity: Minor
          Found in modules/post/windows/gather/enum_chrome.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