예제 #1
0
	def __data_from_userprofile(self, zipname, directories_to_search):
		''' Retrieves data from userprofile. Creates a zip archive containing windows from the directories given in parameters. '''
		userprofiles = get_userprofiles_from_reg()
		# File mode is write and truncate for the first iteration, append after
		file_mode = 'w'
		for userprofile in userprofiles:
			for directory_to_search in directories_to_search:
				full_path = userprofile + '\\' + directory_to_search
				# construct the list of windows in the directory_to_search for the zip function
				list_directories = look_for_files(full_path)
				for directory in list_directories:
					list_files = self.__enum_directory(directory)
					zip_archive(list_files, self.output_dir, zipname, self.logger, file_mode)
					file_mode = 'a'
예제 #2
0
파일: fs.py 프로젝트: he0x/FastResponder
 def __data_from_userprofile(self, zipname, directories_to_search):
     ''' Retrieves data from userprofile. Creates a zip archive containing windows from the directories given in parameters. '''
     userprofiles = get_userprofiles_from_reg()
     # File mode is write and truncate for the first iteration, append after
     file_mode = 'w'
     for userprofile in userprofiles:
         for directory_to_search in directories_to_search:
             full_path = userprofile + '\\' + directory_to_search
             # construct the list of windows in the directory_to_search for the zip function
             list_directories = look_for_files(full_path)
             for directory in list_directories:
                 list_files = self.__enum_directory(directory)
                 zip_archive(list_files, self.output_dir, zipname,
                             self.logger, file_mode)
                 file_mode = 'a'
예제 #3
0
	def _list_windows_prefetch(self):
		''' Outputs windows prefetch files in a csv '''
		''' See http://www.forensicswiki.org/wiki/Windows_Prefetch_File_Format '''
		prefetch_path =self.systemroot + '\Prefetch\*.pf'
		list_prefetch_files = look_for_files(prefetch_path)
		
		for prefetch_file in list_prefetch_files:
			content = ''
			with open(prefetch_file, 'rb') as file_input:
				content = file_input.read()
			try:
				format_version = content[:4]
				format_version = get_int_from_reversed_string(format_version)
				#scca_sig = content[0x4:][:4]
				unknown_values = content[0x0008:0x0008+4]
				unknown_values = ' '.join(c.encode('hex') for c in unknown_values)
				file_size = content[0x000c:0x000c+4]
				file_size = get_int_from_reversed_string(file_size)
				exec_name = content[0x0010:0x0010+60]
				for i in range(30): # 60 / 2
					if 2*i+1 < len(exec_name):
						if exec_name[2*i]=='\x00' and exec_name[2*i+1]=='\x00':
							exec_name = exec_name[:2*(i+1)].decode('utf-16-le')
				'''prefetch_hash = content[:4]
				content = content[4:]
				unknown_flag = content[:4]
				content = content[4:]'''
				prefetch_hash = content[0x004c:0x004c+4]
				tc=os.path.getctime(prefetch_file)
				tm=os.path.getmtime(prefetch_file)
				
				section_a = get_int_from_reversed_string(content[0x0054:0x0054+4])
				num_entries_a = get_int_from_reversed_string(content[0x0058:0x0058+4])
				section_b = get_int_from_reversed_string(content[0x005c:0x005c+4])
				num_entries_b = get_int_from_reversed_string(content[0x0060:0x0060+4])
				section_c = get_int_from_reversed_string(content[0x0064:0x0064+4])
				length_c = get_int_from_reversed_string(content[0x0068:0x0068+4])
				section_d = get_int_from_reversed_string(content[0x006c:0x006c+4])
				num_entries_d = get_int_from_reversed_string(content[0x0070:0x0070+4])
				length_d = get_int_from_reversed_string(content[0x0074:0x0074+4])
				
				if format_version == 17:
					latest_exec_date = content[0x0078:0x0078+8]
					exec_count = get_int_from_reversed_string(content[0x0090:0x0090+4])
					
					# section a
				elif format_version == 23:
					latest_exec_date = content[0x0080:0x0080+8]
					exec_count = get_int_from_reversed_string(content[0x0098:0x0098+4])
				else:
					# format version 26
					latest_exec_date = []
					for i in range(8):
						latest_exec_date.append(content[0x0088+i*8:0x0088+(i+1)*8])
					exec_count = get_int_from_reversed_string(content[0x00D0:0x00D0+4])
				
				hash_table_a = self.__decode_section_a(format_version, content, section_a)
				
				list_str_c = self.__decode_section_c(content, section_c, length_c)
				yield prefetch_file,format_version,file_size, exec_name, datetime.datetime.fromtimestamp(tc),datetime.datetime.fromtimestamp(tm), exec_count, hash_table_a, list_str_c
			except:
				logging.error(traceback.format_exc())
예제 #4
0
	def _list_named_pipes(self):
		for p in look_for_files('\\\\.\\pipe\\*'):
			yield p
예제 #5
0
파일: fs.py 프로젝트: he0x/FastResponder
    def _list_windows_prefetch(self):
        ''' Outputs windows prefetch files in a csv '''
        ''' See http://www.forensicswiki.org/wiki/Windows_Prefetch_File_Format '''
        prefetch_path = self.systemroot + '\Prefetch\*.pf'
        list_prefetch_files = look_for_files(prefetch_path)

        for prefetch_file in list_prefetch_files:
            content = ''
            with open(prefetch_file, 'rb') as file_input:
                content = file_input.read()
            try:
                format_version = content[:4]
                format_version = get_int_from_reversed_string(format_version)
                #scca_sig = content[0x4:][:4]
                unknown_values = content[0x0008:0x0008 + 4]
                unknown_values = ' '.join(
                    c.encode('hex') for c in unknown_values)
                file_size = content[0x000c:0x000c + 4]
                file_size = get_int_from_reversed_string(file_size)
                exec_name = content[0x0010:0x0010 + 60]
                for i in range(30):  # 60 / 2
                    if 2 * i + 1 < len(exec_name):
                        if exec_name[2 *
                                     i] == '\x00' and exec_name[2 * i +
                                                                1] == '\x00':
                            exec_name = exec_name[:2 *
                                                  (i + 1)].decode('utf-16-le')
                '''prefetch_hash = content[:4]
				content = content[4:]
				unknown_flag = content[:4]
				content = content[4:]'''
                prefetch_hash = content[0x004c:0x004c + 4]
                tc = os.path.getctime(prefetch_file)
                tm = os.path.getmtime(prefetch_file)

                section_a = get_int_from_reversed_string(
                    content[0x0054:0x0054 + 4])
                num_entries_a = get_int_from_reversed_string(
                    content[0x0058:0x0058 + 4])
                section_b = get_int_from_reversed_string(
                    content[0x005c:0x005c + 4])
                num_entries_b = get_int_from_reversed_string(
                    content[0x0060:0x0060 + 4])
                section_c = get_int_from_reversed_string(
                    content[0x0064:0x0064 + 4])
                length_c = get_int_from_reversed_string(content[0x0068:0x0068 +
                                                                4])
                section_d = get_int_from_reversed_string(
                    content[0x006c:0x006c + 4])
                num_entries_d = get_int_from_reversed_string(
                    content[0x0070:0x0070 + 4])
                length_d = get_int_from_reversed_string(content[0x0074:0x0074 +
                                                                4])

                if format_version == 17:
                    latest_exec_date = content[0x0078:0x0078 + 8]
                    exec_count = get_int_from_reversed_string(
                        content[0x0090:0x0090 + 4])

                    # section a
                elif format_version == 23:
                    latest_exec_date = content[0x0080:0x0080 + 8]
                    exec_count = get_int_from_reversed_string(
                        content[0x0098:0x0098 + 4])
                else:
                    # format version 26
                    latest_exec_date = []
                    for i in range(8):
                        latest_exec_date.append(content[0x0088 + i * 8:0x0088 +
                                                        (i + 1) * 8])
                    exec_count = get_int_from_reversed_string(
                        content[0x00D0:0x00D0 + 4])

                hash_table_a = self.__decode_section_a(format_version, content,
                                                       section_a)

                list_str_c = self.__decode_section_c(content, section_c,
                                                     length_c)
                yield prefetch_file, format_version, file_size, exec_name, datetime.datetime.fromtimestamp(
                    tc), datetime.datetime.fromtimestamp(
                        tm), exec_count, hash_table_a, list_str_c
            except:
                logging.error(traceback.format_exc())
예제 #6
0
파일: fs.py 프로젝트: he0x/FastResponder
 def _list_named_pipes(self):
     for p in look_for_files('\\\\.\\pipe\\*'):
         yield p