rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

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

        def attempt_login(credential)
          begin
            connect
          rescue ::Rex::ConnectionError => e
            result = Result.new(
Severity: Major
Found in lib/metasploit/framework/login_scanner/smb.rb - About 3 hrs to fix

    Method exploit has 89 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def exploit
        if @exploit_method.nil? # this means the user has disabled autocheck so we should try the default exploit method
          @exploit_method = 'default'
        elsif @exploit_method == 'cve_2021_42847' && datastore['PAYLOAD'] =~ /meterpreter/
          print_warning('Exploitation is possible only via CVE-2021-42847. This attack vector may fail in combination with a meterpreter payload.')

      Method build_javascript has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def build_javascript(my_target)
      
          p = get_payload(my_target)
          js_code = Rex::Text.to_unescape(p, Rex::Arch.endian(my_target.arch))
          js_nops = Rex::Text.to_unescape("\x0c"*4, Rex::Arch.endian(my_target.arch))
      Severity: Major
      Found in modules/exploits/windows/browser/ms10_002_ie_object.rb - About 3 hrs to fix

        Method run has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def run
            return unless load_kiwi
        
            user = datastore['USER']
            domain = datastore['DOMAIN']
        Severity: Major
        Found in modules/post/windows/escalate/golden_ticket.rb - About 3 hrs to fix

          Method list has 89 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def list
              tbl = Rex::Text::Table.new(
                'Header' => 'Device Information',
                'Indent' => 1,
                'Columns' =>
          Severity: Major
          Found in modules/post/windows/gather/enum_devices.rb - About 3 hrs to fix

            Method run has 89 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def run
                fail_with(Failure::BadConfig, 'Root privileges are required') unless is_root?
                user_data = get_user_names_and_hashes
                fail_with(Failure::UnexpectedReply, 'Failed to retrieve user information') if user_data.empty?
                password_data = configure_passwords(user_data)
            Severity: Major
            Found in modules/post/linux/gather/mimipenguin.rb - About 3 hrs to fix

              Method decode_reply has 89 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def self.decode_reply(data)
                    res = {}
                    r_magic = data[0,4]
                    r_ptype = data[4,2].unpack("n").first
                    r_plen  = data[6,2].unpack("n").first
              Severity: Major
              Found in lib/rex/proto/addp.rb - About 3 hrs to fix

                Method end_element has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def end_element(name=nil)
                      block = @block
                      case name
                      when "Scan"
                        # Clears most of the @state out, we're done with this web site.
                Severity: Major
                Found in lib/rex/parser/acunetix_document.rb - About 3 hrs to fix

                  Method cmd_dump_contacts has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def cmd_dump_contacts(*args)
                      path   = "contacts_dump_#{::Time.new.strftime('%Y%m%d%H%M%S')}"
                      format = :text
                  
                      dump_contacts_opts = Rex::Parser::Arguments.new(
                  Severity: Major
                  Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/android.rb - About 3 hrs to fix

                    Method download_file has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def File.download_file(dest_file, src_file, opts = {}, &stat)
                        stat ||= lambda { |a,b,c| }
                    
                        adaptive = opts["adaptive"]
                        block_size = opts["block_size"] || 1024 * 1024
                    Severity: Major
                    Found in lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb - About 3 hrs to fix

                      Method to_win32pe has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def self.to_win32pe(framework, code, opts = {})
                      
                          # For backward compatibility, this is roughly equivalent to 'exe-small' fmt
                          if opts[:sub_method]
                            if opts[:inject]
                      Severity: Major
                      Found in lib/msf/util/exe.rb - About 3 hrs to fix

                        Method juniper_screenos_config_eater has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def juniper_screenos_config_eater(thost, tport, config)
                              # this is for the netscreen OS, which came on SSG (ie SSG5) type devices.
                              # It is similar to cisco, however it doesn't always put all fields we care
                              # about on one line.
                              # Docs: snmp -> https://kb.juniper.net/InfoCenter/index?page=content&id=KB4223
                        Severity: Major
                        Found in lib/msf/core/auxiliary/juniper.rb - About 3 hrs to fix

                          Method asm_reverse_tcp has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def asm_reverse_tcp(opts={})
                              # TODO: reliability is coming
                              retry_count  = opts[:retry_count]
                              reliable     = opts[:reliable]
                              encoded_port = "%.8x" % [opts[:port].to_i,2].pack("vn").unpack("N").first
                          Severity: Major
                          Found in lib/msf/core/payload/linux/x64/reverse_tcp_x64.rb - About 3 hrs to fix

                            Method generate_reverse_tcp has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def generate_reverse_tcp(opts={})
                                encoded_port = "%.8x" % [datastore['LPORT'].to_i,2].pack("vv").unpack("N").first
                                encoded_host = "%.8x" % Rex::Socket.addr_aton(datastore['LHOST']||"127.127.127.127").unpack("V").first
                                retry_count = datastore['StagerRetryCount']
                                seconds = datastore['StagerRetryWait']
                            Severity: Major
                            Found in lib/msf/core/payload/osx/x64/reverse_tcp_x64.rb - About 3 hrs to fix

                              Method run has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def run
                                  open_pcap({'SNAPLEN' => 68, 'FILTER' => "arp[6:2] == 0x0002"})
                                  @netifaces = true
                                  if not netifaces_implemented?
                                    print_error("WARNING : Pcaprub is not up-to-date, some functionality will not be available")
                              Severity: Major
                              Found in modules/auxiliary/spoof/arp/arp_poisoning.rb - About 3 hrs to fix

                                Method hash_dump has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def hash_dump(config_uri, cookie)
                                    random_filename = Rex::Text::rand_text_alpha(8)
                                    command = 'cp /etc/passwd /www/' + random_filename
                                    inject = '|' + "#{command}" + ' ||'
                                    clean_inject = CGI.unescapeHTML(inject.to_s)
                                Severity: Major
                                Found in modules/auxiliary/scanner/http/epmp1000_dump_hashes.rb - About 3 hrs to fix

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

                                    def run_host(ip)
                                      conn = true
                                      ecode = nil
                                      emesg = nil
                                  
                                  
                                  Severity: Major
                                  Found in modules/auxiliary/scanner/http/copy_of_file.rb - About 3 hrs to fix

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

                                      def run_host(ip)
                                        cred_collection = build_credential_collection(
                                          realm: datastore['DOMAIN'],
                                          username: datastore['USERNAME'],
                                          password: datastore['PASSWORD']
                                    Severity: Major
                                    Found in modules/auxiliary/scanner/winrm/winrm_login.rb - About 3 hrs to fix

                                      Method execute_payload has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        def execute_payload
                                          # Drop table if it exists
                                          query = "DROP TABLE IF EXISTS #{tablename.inspect};"
                                          drop_query = postgres_query(query)
                                          case drop_query.keys[0]

                                        Method get_pidgin_creds has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                          def get_pidgin_creds(paths)
                                            case paths
                                            when /#{@user}\\(.*)\\/
                                              sys_user = ::Regexp.last_match(1)
                                            when %r{home/(.*)/}
                                        Severity: Major
                                        Found in modules/post/multi/gather/pidgin_cred.rb - About 3 hrs to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language