rapid7/metasploit-framework

View on GitHub

Showing 15,831 of 21,886 total issues

Method data_connect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def data_connect(mode = nil, nsock = self.sock)
          if mode
            res = send_cmd([ 'TYPE' , mode ], true, nsock)
            return nil if not res =~ /^200/
          end
Severity: Minor
Found in lib/metasploit/framework/ftp/client.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

Method show_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def show_command
          cmd_string = binary_path

          pot_file = pot || john_pot_file
          if cracker == 'hashcat'
Severity: Minor
Found in lib/metasploit/framework/password_crackers/cracker.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

Method find_or_create_note has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def find_or_create_note(opts)
    begin
      # create separate opts for find operation since the report operation uses slightly different keys
      # TODO: standardize option keys used for the find and report operations
      find_opts = opts.clone
Severity: Minor
Found in lib/metasploit/framework/data_service/proxy/note_data_proxy.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

Method attempt_login has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def attempt_login(credential)
          result_opts = {
              credential: credential,
              host: host,
              port: port,
Severity: Minor
Found in lib/metasploit/framework/login_scanner/buffalo.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

Method get_auth_token has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def get_auth_token(user)
          auth_token_uri = normalize_uri("#{uri}/runtime/core/user/#{user}/authentication-token")

          # send the request to get an authentication token
          auth_res = send_request({
Severity: Minor
Found in lib/metasploit/framework/login_scanner/softing_sis.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

Method validate_http_codes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def validate_http_codes
          errors.add(:http_success_codes, "HTTP codes must be an Array") unless @http_success_codes.is_a?(Array)
          @http_success_codes.each do |code|
            next if code >= 200 && code < 400
            errors.add(:http_success_codes, "Invalid HTTP code provided #{code}")
Severity: Minor
Found in lib/metasploit/framework/login_scanner/http.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

Method try_login has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def try_login(credential)

          # Obtain a CSRF token first
          res = send_request({
            'uri' => normalize_uri('/users/login')
Severity: Minor
Found in lib/metasploit/framework/login_scanner/chef_webui.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

Method attempt_login has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def attempt_login(credential)
          result_options = {
            credential: credential,
            status: Metasploit::Model::Login::Status::INCORRECT,
            host: host,
Severity: Minor
Found in lib/metasploit/framework/login_scanner/x3.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

Method get_random_statements has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def get_random_statements
            ignored_classes = [:Base, :FakeFunction, :FakeFunctionCollection]
            class_name = Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory.constants.select { |c|
              next if ignored_classes.include?(c)
              Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory.const_get(c).instance_of?(Class)
Severity: Minor
Found in lib/metasploit/framework/obfuscation/crandomizer/random_statements.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

Method each_unfiltered has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def each_unfiltered
      if pass_file.present?
        pass_fd = File.open(pass_file, 'r:binary')
      end

Severity: Minor
Found in lib/metasploit/framework/credential_collection.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

Method hexdigest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def hexdigest(value)
          if value.nil? || !value.instance_of?(String)
            print_error "Unexpected value format"
            return nil
          end
Severity: Minor
Found in lib/metasploit/framework/aws/client.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

Severity
Category
Status
Source
Language