rapid7/metasploit-framework

View on GitHub
modules/exploits/multi/http/metasploit_webui_console_command_execution.rb

Summary

Maintainability
B
5 hrs
Test Coverage

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

  def initialize(info = {})
    super(update_info(info,
      'Name'          => 'Metasploit Web UI Diagnostic Console Command Execution',
      'Description'   => %q{
        This module exploits the "diagnostic console" feature in the Metasploit

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

      def do_login()
    
        print_status('Obtaining cookies and authenticity_token')
    
        res = send_request_cgi({

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

        def get_console_status(session)
      
          print_status('Getting diagnostic console status and profile_id')
      
          res = send_request_cgi({

      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_command has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def run_command(session, container_label, console_authenticity_token, container_id, console_id, command)

        Method do_login has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def do_login()
        
            print_status('Obtaining cookies and authenticity_token')
        
            res = send_request_cgi({

        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 exploit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def exploit
        
            session, authenticity_token = do_login()
        
            original_console_status, profile_id = get_console_status(session)

        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