rapid7/metasploit-framework

View on GitHub
modules/auxiliary/admin/vmware/vcenter_forge_saml_token.rb

Summary

Maintainability
D
2 days
Test Coverage

File vcenter_forge_saml_token.rb has 321 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'metasploit/framework/credential_collection'

class MetasploitModule < Msf::Auxiliary
  include Msf::Auxiliary::WmapScanUniqueQuery
  include Msf::Exploit::Remote::HttpClient
Severity: Minor
Found in modules/auxiliary/admin/vmware/vcenter_forge_saml_token.rb - About 3 hrs to fix

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

      def initialize(info = {})
        super(
          update_info(
            info,
            'Name' => 'VMware vCenter Forge SAML Authentication Credentials',
    Severity: Major
    Found in modules/auxiliary/admin/vmware/vcenter_forge_saml_token.rb - About 2 hrs to fix

      Method submit_vcenter_auth has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def submit_vcenter_auth(xml)
          saml_response = Base64.strict_encode64(xml)
      
          if @vcenter_saml_relay_state
            res = send_request_cgi({
      Severity: Minor
      Found in modules/auxiliary/admin/vmware/vcenter_forge_saml_token.rb - About 1 hr to fix

        Method validate_idp_options has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          def validate_idp_options
            begin
              idp_cert_file = File.binread(vc_idp_cert)
              idp_key_file = File.binread(vc_idp_key)
              vmca_cert_file = File.binread(vc_vmca_cert)
        Severity: Minor
        Found in modules/auxiliary/admin/vmware/vcenter_forge_saml_token.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 sign_vcenter_saml has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def sign_vcenter_saml(xml)
            xmldoc = Nokogiri::XML(xml) do |config|
              config.options = Nokogiri::XML::ParseOptions::STRICT | Nokogiri::XML::ParseOptions::NONET
            end
        
        
        Severity: Minor
        Found in modules/auxiliary/admin/vmware/vcenter_forge_saml_token.rb - About 1 hr to fix

          Method submit_vcenter_auth has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def submit_vcenter_auth(xml)
              saml_response = Base64.strict_encode64(xml)
          
              if @vcenter_saml_relay_state
                res = send_request_cgi({
          Severity: Minor
          Found in modules/auxiliary/admin/vmware/vcenter_forge_saml_token.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 init_vsphere_login has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def init_vsphere_login
              res = send_request_cgi({
                'uri' => '/ui/login',
                'method' => 'GET'
              })
          Severity: Minor
          Found in modules/auxiliary/admin/vmware/vcenter_forge_saml_token.rb - About 1 hr to fix

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

              def validate_idp_options
                begin
                  idp_cert_file = File.binread(vc_idp_cert)
                  idp_key_file = File.binread(vc_idp_key)
                  vmca_cert_file = File.binread(vc_vmca_cert)
            Severity: Minor
            Found in modules/auxiliary/admin/vmware/vcenter_forge_saml_token.rb - About 1 hr to fix

              Method init_vsphere_login has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def init_vsphere_login
                  res = send_request_cgi({
                    'uri' => '/ui/login',
                    'method' => 'GET'
                  })
              Severity: Minor
              Found in modules/auxiliary/admin/vmware/vcenter_forge_saml_token.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def run
                  cookie_jar.clear
              
                  validate_domains
                  validate_timestamps
              Severity: Minor
              Found in modules/auxiliary/admin/vmware/vcenter_forge_saml_token.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