rapid7/metasploit-framework

View on GitHub

Showing 15,831 of 21,886 total issues

Method cmd_transport has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

  def cmd_transport(*args)
    if ( args.length == 0 or args.include?("-h") )
      cmd_transport_help
      return
    end
Severity: Minor
Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/core.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 monitor_socket has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

  def monitor_socket

    # Skip if we are using a passive dispatcher
    return if self.passive_service

Severity: Minor
Found in lib/rex/post/meterpreter/packet_dispatcher.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 command_string has 247 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def command_string
    if (datastore['JOBNAME'] == "DUMMY") && !datastore['FTPUSER'].nil?
      datastore['JOBNAME'] = (datastore['FTPUSER'] + "1").strip.upcase
    end
    lhost = Rex::Socket.resolv_nbo(datastore['LHOST'])
Severity: Major
Found in modules/payloads/singles/cmd/mainframe/bind_shell_jcl.rb - About 1 day to fix

    Method osx_capture_media has 247 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def osx_capture_media(opts)
        capture_code = <<-EOS
    #{osx_ruby_dl_header}
    
    options = {
    Severity: Major
    Found in lib/msf/core/post/osx/ruby_dl.rb - About 1 day to fix

      Method mssql_login has 246 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def mssql_login(user='sa', pass='', db='', domain_name='')
                prelogin_data = mssql_prelogin
                if auth == Msf::Exploit::Remote::AuthOption::KERBEROS
                  idx = 0
                  pkt = ''
      Severity: Major
      Found in lib/rex/proto/mssql/client.rb - About 1 day to fix

        Method get_registry has 245 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def get_registry(outlook_ver)
            # Determine if saved accounts exist within Outlook.  Ignore the Address Book and Personal Folder registry entries.
            outlook_exists = 0
            saved_accounts = 0
        
        
        Severity: Major
        Found in modules/post/windows/gather/credentials/outlook.rb - About 1 day to fix

          File protocol.rb has 575 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "socket"
          require "timeout"
          require "digest/sha1"
          require "stringio"
          
          
          Severity: Major
          Found in lib/rbmysql/protocol.rb - About 1 day to fix

            Method run has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
            Open

              def run
                def check_results(passwords, results, hash_type, method)
                  passwords.each do |password_line|
                    password_line.chomp!
                    next if password_line.blank?
            Severity: Minor
            Found in modules/auxiliary/analyze/crack_osx.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 enum_instance has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
            Open

              def enum_instance(rhost)
                print_status("#{rhost}:#{rport} [SAP] Connecting to SAP Management Console SOAP Interface")
                success = false
                soapenv='http://schemas.xmlsoap.org/soap/envelope/'
                xsi='http://www.w3.org/2001/XMLSchema-instance'
            Severity: Minor
            Found in modules/auxiliary/scanner/sap/sap_mgmt_con_instanceproperties.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 cmd_execute_bof has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
            Open

                      def cmd_execute_bof(*args)
                        if args.empty?
                          cmd_execute_bof_help
                          return false
                        end
            Severity: Minor
            Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/bofloader.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 assemble_buffer has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
            Open

              def assemble_buffer(direction, function, args, arch)
                layout = {} # paramName => BufferItem
                blob = ""
                #puts " building buffer: #{direction}"
                function.params.each_with_index do |param_desc, param_idx|
            Severity: Minor
            Found in lib/rex/post/meterpreter/extensions/stdapi/railgun/library_helper.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_sessionsetup has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
            Open

              def parse_sessionsetup(pkt, s)
                payload = pkt.payload.dup
                ntlmpayload = payload[/NTLMSSP\x00.*/m]
                if ntlmpayload
                  ntlmmessagetype = ntlmpayload[8,4].unpack("V")[0]
            Severity: Minor
            Found in data/exploits/psnuffle/smb.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 run has 241 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def run
                vprint_status("#{peer} - Checking ")
                # since we will check res to see if auth was a success, make sure to capture the return
                res = send_request_cgi(
                  'uri' => normalize_uri(target_uri.path),
            Severity: Major
            Found in modules/auxiliary/gather/prometheus_node_exporter_gather.rb - About 1 day to fix

              Method run_host has 240 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def run_host(ip)
                  # Force http verb to be upper-case, because otherwise some web servers such as
                  # Apache might throw you a 501
                  http_method = datastore['METHOD'].upcase
              
              
              Severity: Major
              Found in modules/auxiliary/scanner/http/blind_sql_query.rb - About 1 day to fix

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

                require 'postgres_msf'
                require 'postgres/buffer'
                require 'rex/io/stream'
                
                # Monkeypatch to preserve original code intent
                Severity: Major
                Found in lib/postgres/postgres-pr/message.rb - About 1 day to fix

                  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 run has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def run
                      def check_results(passwords, results, hash_type, method)
                        passwords.each do |password_line|
                          password_line.chomp!
                          next if password_line.blank?
                  Severity: Minor
                  Found in modules/auxiliary/analyze/crack_aix.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 escalate_or_deescalate_privs has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def escalate_or_deescalate_privs(deescalate: false)
                      # Establish some variables based on if we need to escalate or deescalate privileges
                      if deescalate
                        use_filesystem = @role_to_add != 'ROLE_FILESYSTEM_EDITOR'
                        mode = 'cleanup'
                  Severity: Minor
                  Found in modules/exploits/linux/http/opennms_horizon_authenticated_rce.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 run has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def run
                      print_status("Upgrading session ID: #{datastore['SESSION']}")
                  
                      # Try hard to find a valid LHOST value in order to
                      # make running 'sessions -u' as robust as possible.
                  Severity: Minor
                  Found in modules/post/multi/manage/shell_to_meterpreter.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 cmd_search has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
                  Open

                            def cmd_search(*args)
                              match        = ''
                              row_filter  = nil
                              output_file  = nil
                              cached       = false
                  Severity: Minor
                  Found in lib/msf/ui/console/command_dispatcher/modules.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

                  Severity
                  Category
                  Status
                  Source
                  Language