rapid7/metasploit-framework

View on GitHub
lib/rex/proto/ntlm/message.rb

Summary

Maintainability
D
2 days
Test Coverage

File message.rb has 346 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Rex
module Proto
module NTLM
class Message < Rex::Proto::NTLM::Base::FieldSet

Severity: Minor
Found in lib/rex/proto/ntlm/message.rb - About 4 hrs to fix

    Method process_type1_message has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.process_type1_message(message, nonce = "\x11\x22\x33\x44\x55\x66\x77\x88", win_domain = 'DOMAIN',
              win_name = 'SERVER', dns_name = 'server', dns_domain = 'example.com', downgrade = true)
    
        dns_name = Rex::Text.to_unicode(dns_name + "." + dns_domain)
        win_domain = Rex::Text.to_unicode(win_domain)
    Severity: Minor
    Found in lib/rex/proto/ntlm/message.rb - About 2 hrs 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 process_type1_message has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.process_type1_message(message, nonce = "\x11\x22\x33\x44\x55\x66\x77\x88", win_domain = 'DOMAIN',
              win_name = 'SERVER', dns_name = 'server', dns_domain = 'example.com', downgrade = true)
    
        dns_name = Rex::Text.to_unicode(dns_name + "." + dns_domain)
        win_domain = Rex::Text.to_unicode(win_domain)
    Severity: Major
    Found in lib/rex/proto/ntlm/message.rb - About 2 hrs to fix

      Method downgrade_type_message has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.downgrade_type_message(message)
          decode = Rex::Text.decode_base64(message.strip)
      
          type = decode[8,1].unpack("C").first
      
      
      Severity: Minor
      Found in lib/rex/proto/ntlm/message.rb - About 2 hrs 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 response has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def response(arg, opt = {})
            usr = arg[:user]
            pwd = arg[:password]
            if usr.nil? or pwd.nil?
              raise ArgumentError, "user and password have to be supplied"
      Severity: Major
      Found in lib/rex/proto/ntlm/message.rb - About 2 hrs to fix

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

            def response(arg, opt = {})
              usr = arg[:user]
              pwd = arg[:password]
              if usr.nil? or pwd.nil?
                raise ArgumentError, "user and password have to be supplied"
        Severity: Minor
        Found in lib/rex/proto/ntlm/message.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 downgrade_type_message has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.downgrade_type_message(message)
            decode = Rex::Text.decode_base64(message.strip)
        
            type = decode[8,1].unpack("C").first
        
        
        Severity: Minor
        Found in lib/rex/proto/ntlm/message.rb - About 1 hr to fix

          Method process_type1_message has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def self.process_type1_message(message, nonce = "\x11\x22\x33\x44\x55\x66\x77\x88", win_domain = 'DOMAIN',
                    win_name = 'SERVER', dns_name = 'server', dns_domain = 'example.com', downgrade = true)
          Severity: Major
          Found in lib/rex/proto/ntlm/message.rb - About 50 mins to fix

            There are no issues that match your filters.

            Category
            Status