rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

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

  def run_host(rhost)

    vprint_status("#{rhost}:#{rport} - Connecting to SAP Host Control service")

    data = '<?xml version="1.0" encoding="utf-8"?>'
Severity: Minor
Found in modules/auxiliary/scanner/sap/sap_hostctrl_getcomputersystem.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_detailed_info has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_detailed_info(data)
    data.each do |properties|
      if not properties.get_elements("item//mValue[text()=\"ITSAMOperatingSystem\"]").empty?
        values = parse_values(properties, "ITSAMOperatingSystem")
        parse_os_info(values)
Severity: Minor
Found in modules/auxiliary/scanner/sap/sap_hostctrl_getcomputersystem.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

Avoid deeply nested control flow statements.
Open

            if sock.recv(150)  =~ /access denied/
              print_error("#{host_port} - Access denied")
              sock.recv(packet_len)
              packet_len = sock.recv(4).unpack('H*')[0].to_i 16
            else
Severity: Major
Found in modules/auxiliary/scanner/sap/sap_router_info_request.rb - About 45 mins to fix

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

      def do_show_version(cookie, tries = 3)
        # Make up to three attempts because server can be a little flaky
        tries.times do |i|
          command = "show version"
          resp = run_command(command, cookie)
    Severity: Minor
    Found in modules/auxiliary/scanner/http/cisco_ssl_vpn_priv_esc.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 add_user has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def add_user(cookie, tries = 3)
        username = Rex::Text.rand_text_alpha_lower(8)
        password = Rex::Text.rand_text_alphanumeric(20)
    
        tries.times do |i|
    Severity: Minor
    Found in modules/auxiliary/scanner/http/cisco_ssl_vpn_priv_esc.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 is_password_required? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def is_password_required?(version)
        success = false
    
        if version =~ /^[29]\.x$/
          res = send_request_cgi({'uri'=>'/applications/upload.jsf'})
    Severity: Minor
    Found in modules/auxiliary/scanner/http/glassfish_login.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 bruteforce has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def bruteforce(ip)
        @scanner.scan! do |result|
          case result.status
          when Metasploit::Model::Login::Status::SUCCESSFUL
            print_brute :level => :good, :ip => ip, :msg => "Success: '#{result.credential}'"
    Severity: Minor
    Found in modules/auxiliary/scanner/http/glassfish_login.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 lfi_download has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def lfi_download(trigger, files)
        counter = 0
        files.each_line do |f|
          # Our trigger already puts us in '/', so our filename doesn't need to begin with that
          f = f[1,f.length] if f =~ /^\//
    Severity: Minor
    Found in modules/auxiliary/scanner/http/http_traversal.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

    Avoid deeply nested control flow statements.
    Open

          return if trigger.nil?
    Severity: Major
    Found in modules/auxiliary/scanner/http/http_traversal.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                        if alive.nil?
                          print_good("[#{rhost}] #{target} is alive.")
                          alive = true
                        end
      Severity: Major
      Found in modules/auxiliary/scanner/http/squid_pivot_scanning.rb - About 45 mins to fix

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

          def determine_result(response)
            return :abort unless response.kind_of?(Rex::Proto::Http::Response)
            return :abort unless response.code
        
            if [200, 301, 302].include?(response.code)
        Severity: Minor
        Found in modules/auxiliary/scanner/http/joomla_bruteforce_login.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 bruteforce has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def bruteforce(ip)
            @scanner.scan! do |result|
              case result.status
                when Metasploit::Model::Login::Status::SUCCESSFUL
                  print_brute :level => :good, :ip => ip, :msg => "Success: '#{result.credential}'"
        Severity: Minor
        Found in modules/auxiliary/scanner/http/zabbix_login.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

        Avoid deeply nested control flow statements.
        Open

                        elsif res.body =~ /id="sysmsg".*No route to host/
                          dead = true
                          print_error("[#{rhost}] No route to #{target}")
        Severity: Major
        Found in modules/auxiliary/scanner/http/squid_pivot_scanning.rb - About 45 mins to fix

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

            def do_extract()
              print_status("#{rhost}:#{rport} - Attempting to extract Administrator password...")
              begin
                res = send_request_cgi({
                    'uri' => '/html/en/confAccessProt.html',
          Severity: Minor
          Found in modules/auxiliary/scanner/http/meteocontrol_weblog_extractadmin.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 do_update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def do_update
              posts_to_update = []
          
              if datastore['POST_ID'] == 0
                posts_to_update = list_posts
          Severity: Minor
          Found in modules/auxiliary/scanner/http/wordpress_content_injection.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

          Avoid deeply nested control flow statements.
          Open

                            :sname => (ssl ? 'https' : 'http'),
          Severity: Major
          Found in modules/auxiliary/scanner/http/web_vulndb.rb - About 45 mins to fix

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

              def run_host(ip)
                uri = normalize_uri(target_uri.path.to_s, 'users', 'sign_in')
                res = send_request_cgi(
                  'method' => 'GET',
                  'cookie' => 'request_method=GET',
            Severity: Minor
            Found in modules/auxiliary/scanner/http/gitlab_login.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

            Avoid deeply nested control flow statements.
            Open

                        ssid = ssid_input[0]['value'] if ssid_input.count == 1
            Severity: Major
            Found in modules/auxiliary/scanner/http/canon_wireless.rb - About 45 mins to fix

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

                def enum_user(user='administrator', pass='pass')
                  vprint_status("#{rhost}:#{rport} - Trying username:'#{user}' password:'#{pass}'")
                  success = false
                  soapenv='http://schemas.xmlsoap.org/soap/envelope/'
                  xmlns='http://session.dsws.businessobjects.com/2007/06/01'
              Severity: Minor
              Found in modules/auxiliary/scanner/http/sap_businessobjects_user_brute.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 form_from_url has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def form_from_url( website, url )
                  url = URI( url.to_s ) if !url.is_a?( URI )
              
                  begin
                    # Scrub out the jsessionid appends
              Severity: Minor
              Found in modules/auxiliary/scanner/http/crawler.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