rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

Method initialize has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Kerberos Ticket Management',
Severity: Major
Found in modules/post/windows/manage/kerberos_tickets.rb - About 2 hrs to fix

    Method main has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def main
      filter  = 'All'
      filters = ['all','exploit','payload','post','nop','encoder','auxiliary']
      type    = 'CVE'
      db_path = nil
    Severity: Major
    Found in tools/modules/cve_xref.rb - About 2 hrs to fix

      Method get_parsed_options has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def get_parsed_options
          options = {}
      
          parser = OptionParser.new do |opt|
            opt.separator ''
      Severity: Major
      Found in tools/exploit/msu_finder.rb - About 2 hrs to fix

        Method cmd_ls has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def cmd_ls(*args)
            # Set defaults
            path = client.fs.dir.getwd
            search_term = nil
            sort = 'Name'
        Severity: Major
        Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb - About 2 hrs to fix

          Method initialize has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def initialize(client)
              super(client, 'stdapi')
          
              # Alias the following things on the client object so that they
              # can be directly referenced
          Severity: Major
          Found in lib/rex/post/meterpreter/extensions/stdapi/stdapi.rb - About 2 hrs to fix

            Method cmd_features has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def cmd_features(*args)
                args << 'print' if args.empty?
            
                action, *rest = args
                case action
            Severity: Major
            Found in lib/msf/ui/console/command_dispatcher/core.rb - About 2 hrs to fix

              Method execute_script has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def execute_script(script_name, *args)
                  post_module = legacy_script_to_post_module(script_name)
              
                  if post_module
                    print_warning("Meterpreter scripts are deprecated. Try #{post_module}.")
              Severity: Major
              Found in lib/msf/base/sessions/scriptable.rb - About 2 hrs to fix

                Method process_dr_search has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def process_dr_search(res, res_code, repo_name, fields=nil, mode='standard')
                    if res_code == 1 || res.nil? || !(res.instance_of?(Hash) && res.keys.include?('response') && res['response'].instance_of?(Hash))
                      vprint_error("Received unexpected reply when trying to dump table #{repo_name}: #{res}")
                      return nil
                    end
                Severity: Major
                Found in lib/msf/core/auxiliary/manage_engine_xnode/process.rb - About 2 hrs to fix

                  Method generate_sled has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def generate_sled
                      min   = reqs['MinNops'] || 0
                      space = reqs['Space']
                      pad_nops = reqs['PadNops']
                  
                  
                  Severity: Major
                  Found in lib/msf/core/encoded_payload.rb - About 2 hrs to fix

                    Method brocade_config_eater has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def brocade_config_eater(thost, tport, config)
                          # this is for brocade type devices.
                          # It is similar to cisco
                          # Docs: enable password-display -> http://wwwaem.brocade.com/content/html/en/command-reference-guide/fastiron-08040-commandref/GUID-169889CD-1A74-4A23-AC78-38796692374F.html
                    
                    
                    Severity: Major
                    Found in lib/msf/core/auxiliary/brocade.rb - About 2 hrs to fix

                      Method build_on_behalf_of has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def build_on_behalf_of(csr:, on_behalf_of:, cert:, key:, algorithm: 'SHA256')
                          # algorithm needs to be one that OpenSSL supports, but we also need the OID constants defined
                          digest = OpenSSL::Digest.new(algorithm)
                          unless [ digest.name, "RSAWith#{digest.name}" ].all? { |s| Rex::Proto::Kerberos::Model::OID.constants.include?(s.to_sym) }
                            raise ArgumentError, "Can not map digest algorithm #{digest.name} to the necessary OIDs."
                      Severity: Major
                      Found in lib/msf/core/exploit/remote/ms_icpr.rb - About 2 hrs to fix

                        Method parse has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def parse(value, datastore)
                              Enumerator.new do |results|
                                # extract the individual elements from the rhost string, ensuring that
                                # whitespace, strings, escape characters, etc are handled correctly.
                                values = Rex::Parser::Arguments.from_s(value)
                        Severity: Major
                        Found in lib/msf/core/rhosts_walker.rb - About 2 hrs to fix

                          Method handle_x86_bsd_opts has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def handle_x86_bsd_opts(pre, app)
                              if (datastore['PrependSetresuid'])
                                # setresuid(0, 0, 0)
                                pre << "\x31\xc0"             + #   xorl    %eax,%eax                  #
                                       "\x50"                 + #   pushl   %eax                       #
                          Severity: Major
                          Found in lib/msf/core/payload/bsd/x86.rb - About 2 hrs to fix

                            Method initialize has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def initialize(info = {})
                                ret = super(info)
                            
                                register_advanced_options(
                                  [
                            Severity: Major
                            Found in lib/msf/core/payload/bsd.rb - About 2 hrs to fix

                              Method attempt_login has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      def attempt_login(credential)
                                        result_options = {
                                            credential: credential,
                                            host: host,
                                            port: port,
                              Severity: Major
                              Found in lib/metasploit/framework/login_scanner/postgres.rb - About 2 hrs to fix

                                Method attempt_login has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        def attempt_login(credential)
                                          self.ssh_socket = nil
                                          opt_hash = ssh_client_defaults.merge({
                                            :port            => port,
                                            :verbose         => verbosity
                                Severity: Major
                                Found in lib/metasploit/framework/login_scanner/ssh.rb - About 2 hrs to fix

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      if (target == targets[0])
                                  
                                        lzh << generate_seh_record(target.ret)
                                        lzh << make_nops(8)
                                        lzh << payload.encoded
                                  Severity: Major
                                  Found in modules/exploits/windows/lotus/lotusnotes_lzh.rb and 1 other location - About 2 hrs to fix
                                  modules/exploits/windows/fileformat/lotusnotes_lzh.rb on lines 83..118

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 82.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      if (target == targets[0])
                                  
                                        lzh << generate_seh_record(target.ret)
                                        lzh << make_nops(8)
                                        lzh << payload.encoded
                                  Severity: Major
                                  Found in modules/exploits/windows/fileformat/lotusnotes_lzh.rb and 1 other location - About 2 hrs to fix
                                  modules/exploits/windows/lotus/lotusnotes_lzh.rb on lines 97..132

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 82.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                    def initialize(info = {})
                                      super(update_info(info,
                                        'Name'           => 'Apple TV Video Remote Control',
                                        'Description'    => %q(
                                          This module plays a video on an AppleTV device. Note that
                                  Severity: Major
                                  Found in modules/auxiliary/admin/appletv/appletv_display_video.rb and 1 other location - About 2 hrs to fix
                                  modules/auxiliary/admin/appletv/appletv_display_image.rb on lines 9..50

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 82.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                    def exploit
                                      if is_system?
                                        fail_with(Failure::None, 'Session is already elevated')
                                      end
                                  
                                  
                                  modules/exploits/windows/local/cve_2022_3699_lenovo_diagnostics_driver.rb on lines 89..113

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 82.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language