rapid7/metasploit-framework

View on GitHub
modules/auxiliary/admin/citrix/citrix_netscaler_config_decrypt.rb

Summary

Maintainability
D
1 day
Test Coverage

Method parse_ns_config has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_ns_config
    ns_config_data = File.binread(ns_conf)
    ns_secret.each do |secret|
      element = secret[0]
      secret[1].each do |keyword|
Severity: Minor
Found in modules/auxiliary/admin/citrix/citrix_netscaler_config_decrypt.rb - About 1 day 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 parse_ns_config has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def parse_ns_config
    ns_config_data = File.binread(ns_conf)
    ns_secret.each do |secret|
      element = secret[0]
      secret[1].each do |keyword|
Severity: Major
Found in modules/auxiliary/admin/citrix/citrix_netscaler_config_decrypt.rb - About 2 hrs to fix

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

      def initialize(info = {})
        super(
          update_info(
            info,
            'Name' => 'Decrypt Citrix NetScaler Config Secrets',
    Severity: Minor
    Found in modules/auxiliary/admin/citrix/citrix_netscaler_config_decrypt.rb - About 1 hr to fix

      Method build_ns_kek has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def build_ns_kek
          unless File.size(ns_kek_f1) == 256 && File.size(ns_kek_f2) == 256
            print_error('KEK files must be 256 bytes in size')
            return false
          end
      Severity: Minor
      Found in modules/auxiliary/admin/citrix/citrix_netscaler_config_decrypt.rb - About 1 hr to fix

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

          def build_ns_kek
            unless File.size(ns_kek_f1) == 256 && File.size(ns_kek_f2) == 256
              print_error('KEK files must be 256 bytes in size')
              return false
            end
        Severity: Minor
        Found in modules/auxiliary/admin/citrix/citrix_netscaler_config_decrypt.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 parse_username_from_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def parse_username_from_config(line)
            # Ugly but effective way to extract the principal name from a config line for loot storage
            # The whitespace prefixed to ' user' is intentional so that it does not clobber other parameters with 'user' in the pattern
            [' user', 'userName', '-clientID', '-bindDN', '-ldapBindDn'].each do |user_param|
              next unless line.match?(/#{user_param} (.+)/)
        Severity: Minor
        Found in modules/auxiliary/admin/citrix/citrix_netscaler_config_decrypt.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