rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

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

  def vim_get_dc_vms(datacenter)
    soap_data = vim_soap_envelope(vim_soap_retrieve_properties('vmFolder', 'Datacenter', datacenter))
    res = vim_send_soap_request(soap_data)
    if res.class == Hash
      vmfolder = res['RetrievePropertiesResponse']['returnval']['propSet']['val']
Severity: Minor
Found in lib/msf/core/exploit/remote/vim_soap.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 ncs_login has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def ncs_login
    unless datastore['NCSVERSION'] || server_version
      if datastore['NCSBRUTEAPI']
        vprint_status('Bruteforcing Version string')
        self.server_version = ncs_version_bruteforce
Severity: Minor
Found in lib/msf/core/exploit/remote/nuuo.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 spip_plugin_version has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def spip_plugin_version(plugin_name)
      res = send_request_cgi('method' => 'GET', 'uri' => normalize_uri(target_uri.path, 'spip.php'))
      return unless res

      composed_by = res.headers['Composed-By']
Severity: Minor
Found in lib/msf/core/exploit/remote/http/spip.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 stop_processor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def stop_processor(token, processor)
    vprint_status("Attempting to stop Processor: #{processor}")
    body = {
      'revision' => {
        'clientId' => 'x',
Severity: Minor
Found in lib/msf/core/exploit/remote/http/nifi/processor.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 check_response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def check_response(response)
      if response.nil?
        fail_with(Msf::Module::Failure::Unreachable, 'The server not responding.')
      elsif response.code != 200
        fail_with(Msf::Module::Failure::UnexpectedReply, 'The server sent a response, but the response status code not in the expected status code: 200. The target is likely patched.')
Severity: Minor
Found in lib/msf/core/exploit/remote/http/sap_sol_man_eem_miss_auth.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 wordpress_helper_post_comment has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def wordpress_helper_post_comment(comment, comment_post_id, login_cookie, author, email, url)
Severity: Minor
Found in lib/msf/core/exploit/remote/http/wordpress/helpers.rb - About 45 mins to fix

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

      def wordpress_helper_post_comment(comment, comment_post_id, login_cookie, author, email, url)
        vars_post = {
          'comment' => comment,
          'submit' => 'Post+Comment',
          'comment_post_ID' => comment_post_id.to_s,
    Severity: Minor
    Found in lib/msf/core/exploit/remote/http/wordpress/helpers.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 call_api has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

                def call_api(request, options = {})
                  res = http_client.send_request_raw(request_options(request, options))
    
                  if res.nil? || res.body.nil?
                    raise Kubernetes::Error::InvalidApiError.new(res: res)
    Severity: Minor
    Found in lib/msf/core/exploit/remote/http/kubernetes/client.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 gitea_helper_repo_migrate_post_data has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def gitea_helper_repo_migrate_post_data(name, uid, service, url, token, csrf)
    Severity: Minor
    Found in lib/msf/core/exploit/remote/http/gitea/helpers.rb - About 45 mins to fix

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

        def deploy(opts = {}, num_attempts = 5)
          uri = opts['uri']
      
          if uri.blank?
            return nil
      Severity: Minor
      Found in lib/msf/core/exploit/remote/http/jboss/base.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 parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

                def parse(set_cookie_header, origin_url)
                  cookies = []
                  ::HTTP::Cookie::Scanner.new(set_cookie_header).scan_set_cookie do |name, value, attrs|
                    if name.nil? || name.empty?
                      next
      Severity: Minor
      Found in lib/msf/core/exploit/remote/http/http_cookie_jar.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 download has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def download(url)
          print_status "Downloading '#{url}'"
      
          begin
            target = URI.parse url
      Severity: Minor
      Found in lib/msf/core/exploit/remote/http_client.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 compact_policy_rules has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def compact_policy_rules(policy_rules)
          compact_rules = []
          simple_rules = {}
          policy_rules.each do |policy_rule|
            simple_rule = as_simple_rule(policy_rule)
      Severity: Minor
      Found in lib/msf/core/exploit/remote/http/kubernetes/auth_parser.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 authenticate has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def authenticate(username, password, finish_install, handle_full_install = true, handle_license = true, handle_nsp = false)
      Severity: Minor
      Found in lib/msf/core/exploit/remote/http/nagios_xi/login.rb - About 45 mins to fix

        Method extract_and_check_version has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def extract_and_check_version(body, type, item_type, fixed_version = nil, vuln_introduced_version = nil, regex = nil)
        Severity: Minor
        Found in lib/msf/core/exploit/remote/http/wordpress/version.rb - About 45 mins to fix

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

            def gitlab_import_github_repo(group_name:, github_hostname:, api_token:)
              res = send_request_cgi({
                'method' => 'POST',
                'uri' => normalize_uri(target_uri.path, '/api/v4/import/github'),
                'ctype' => 'application/json',
          Severity: Minor
          Found in lib/msf/core/exploit/remote/http/gitlab/rest/v4/import.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 oid has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def oid(itut, rec, t, t124, ver, desc)
          Severity: Minor
          Found in lib/msf/core/exploit/remote/rdp.rb - About 45 mins to fix

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

              def rdp_parse_negotiation_response(data)
                return false, "Response is not an RDP Negotiation Response packet." unless data.match("\x03\x00\x00..\xd0")
                return false, "Negotiation Response packet too short." if data.length < 19
            
                response_code = data[11].unpack("C")[0]
            Severity: Minor
            Found in lib/msf/core/exploit/remote/rdp.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def initialize(
                  realm: nil,
                  hostname: nil,
                  username: nil,
                  password: nil,
            Severity: Minor
            Found in lib/msf/core/exploit/remote/kerberos/service_authenticator/base.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 smb_fingerprint has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def smb_fingerprint
                    fprint = {}
            
                    # Connect to the server if needed
                    if not self.simple
            Severity: Minor
            Found in lib/msf/core/exploit/remote/smb/client.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

            Severity
            Category
            Status
            Source
            Language