rapid7/metasploit-framework

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

Summary

Maintainability
B
6 hrs
Test Coverage

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

  def initialize(info={})
    super(update_info(info,
      'Name'           => 'Total.js CMS 12 Widget JavaScript Code Injection',
      'Description'    => %q{
        This module exploits a vulnerability in Total.js CMS. The issue is that a user with
Severity: Minor
Found in modules/exploits/multi/http/totaljs_cms_widget_exec.rb - About 1 hr to fix

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

      def create_widget(admin_token)
        platform = target.platform.names.first
        host = datastore['SRVHOST'] == '0.0.0.0' ? Rex::Socket::source_address : datastore['SRVHOST']
        port = datastore['SRVPORT']
        proto = datastore['SSL'] ? 'https' : 'http'
    Severity: Minor
    Found in modules/exploits/multi/http/totaljs_cms_widget_exec.rb - About 1 hr to fix

      Method clear_widget has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def clear_widget
          admin_token = get_admin_token
          widget = get_widget
      
          print_status('Finding the payload from the widget list...')
      Severity: Minor
      Found in modules/exploits/multi/http/totaljs_cms_widget_exec.rb - About 1 hr to fix

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

          def create_widget(admin_token)
            platform = target.platform.names.first
            host = datastore['SRVHOST'] == '0.0.0.0' ? Rex::Socket::source_address : datastore['SRVHOST']
            port = datastore['SRVPORT']
            proto = datastore['SSL'] ? 'https' : 'http'
        Severity: Minor
        Found in modules/exploits/multi/http/totaljs_cms_widget_exec.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 get_widget_item has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def get_widget_item(admin_token, widget)
            res = send_request_cgi({
              'method' => 'GET',
              'uri'    => normalize_uri(target_uri.path, 'admin', 'api', 'widgets'),
              'cookie' => "__admin=#{admin_token.token}",
        Severity: Minor
        Found in modules/exploits/multi/http/totaljs_cms_widget_exec.rb - About 45 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 check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def check
            code = CheckCode::Safe
        
            res = send_request_cgi({
              'method' => 'GET',
        Severity: Minor
        Found in modules/exploits/multi/http/totaljs_cms_widget_exec.rb - About 45 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