rapid7/metasploit-framework

View on GitHub
modules/post/multi/gather/chrome_cookies.rb

Summary

Maintainability
C
1 day
Test Coverage

Method configure_for_platform has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def configure_for_platform
    vprint_status('Determining session platform')
    vprint_status("Platform: #{session.platform}")
    vprint_status("Type: #{session.type}")

Severity: Major
Found in modules/post/multi/gather/chrome_cookies.rb - About 2 hrs to fix

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

      def configure_for_platform
        vprint_status('Determining session platform')
        vprint_status("Platform: #{session.platform}")
        vprint_status("Type: #{session.type}")
    
    
    Severity: Minor
    Found in modules/post/multi/gather/chrome_cookies.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 create_cookie_stealing_html has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create_cookie_stealing_html(temp_storage_dir)
        cookie_stealing_html = %(
          <!DOCTYPE html>
          <html lang="en">
          <head>
    Severity: Minor
    Found in modules/post/multi/gather/chrome_cookies.rb - About 1 hr to fix

      Method get_cookies has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def get_cookies
          if session.platform == 'windows'
            chrome_cmd = @chrome_debugging_cmd.to_s
            kill_cmd = 'taskkill /f /pid'
          else
      Severity: Minor
      Found in modules/post/multi/gather/chrome_cookies.rb - About 1 hr to fix

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

          def get_cookies
            if session.platform == 'windows'
              chrome_cmd = @chrome_debugging_cmd.to_s
              kill_cmd = 'taskkill /f /pid'
            else
        Severity: Minor
        Found in modules/post/multi/gather/chrome_cookies.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def run
            fail_with Failure::BadConfig, 'No session found, giving up' if session.nil?
        
            # Issues with write_file. Maybe a path problem?
            if session.platform == 'windows' && session.type == 'shell'
        Severity: Minor
        Found in modules/post/multi/gather/chrome_cookies.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