def testDebugPrintDestListEntry(self): """Tests the _DebugPrintDestListEntry function.""" output_writer = test_lib.TestOutputWriter() test_file = jump_list.AutomaticDestinationsFile(output_writer=output_writer) test_file._format_version = 3 uuid_value = uuid.UUID('{97d57d7f-24e9-4de7-9306-b40d93442fbb}') data_type_map = test_file._GetDataTypeMap('dest_list_entry_v3') dest_list_entry = data_type_map.CreateStructureValues( unknown1=1, droid_volume_identifier=uuid_value, droid_file_identifier=uuid_value, birth_droid_volume_identifier=uuid_value, birth_droid_file_identifier=uuid_value, hostname='myhost', entry_number=2, unknown2=3, unknown3=4.0, last_modification_time=5, pin_status=6, unknown4=7, unknown5=8, unknown6=9, path_size=6, path='mypath', unknown7=10) test_file._DebugPrintDestListEntry(dest_list_entry)
def testReadFileObjectOnV3File(self): """Tests the ReadFileObject function on a format version 3 file.""" output_writer = test_lib.TestOutputWriter() test_file = jump_list.AutomaticDestinationsFile(output_writer=output_writer) test_file_path = self._GetTestFilePath([ '9d1f905ce5044aee.automaticDestinations-ms']) test_file.Open(test_file_path)
def testReadFileObjectOnV1File(self): """Tests the ReadFileObject function on a format version 1 file.""" output_writer = test_lib.TestOutputWriter() test_file = jump_list.AutomaticDestinationsFile(output_writer=output_writer) test_file_path = self._GetTestFilePath([ '1b4dd67f29cb1962.automaticDestinations-ms']) test_file.Open(test_file_path)
def testReadDestList(self): """Tests the _ReadDestList function.""" output_writer = test_lib.TestOutputWriter() test_file = jump_list.AutomaticDestinationsFile(output_writer=output_writer) test_file_path = self._GetTestFilePath([ '1b4dd67f29cb1962.automaticDestinations-ms']) with open(test_file_path, 'rb') as file_object: olecf_file = pyolecf.file() olecf_file.open_file_object(file_object) try: test_file._ReadDestList(olecf_file) finally: olecf_file.close()
def testDebugPrintDestListHeader(self): """Tests the _DebugPrintDestListHeader function.""" output_writer = test_lib.TestOutputWriter() test_file = jump_list.AutomaticDestinationsFile(output_writer=output_writer) test_file._format_version = 3 data_type_map = test_file._GetDataTypeMap('dest_list_header') dest_list_header = data_type_map.CreateStructureValues( format_version=1, last_entry_number=5, last_revision_number=7, number_of_entries=2, number_of_pinned_entries=3, unknown1=4.0, unknown2=6, unknown3=8) test_file._DebugPrintDestListHeader(dest_list_header)
def Main(): """The main program function. Returns: bool: True if successful or False if not. """ argument_parser = argparse.ArgumentParser(description=( 'Extracts information from Windows Jump List files.')) argument_parser.add_argument( '-d', '--debug', dest='debug', action='store_true', default=False, help='enable debug output.') argument_parser.add_argument( 'source', nargs='?', action='store', metavar='PATH', default=None, help='path of the Windows Jump List file.') options = argument_parser.parse_args() if not options.source: print('Source file missing.') print('') argument_parser.print_help() print('') return False logging.basicConfig( level=logging.INFO, format='[%(levelname)s] %(message)s') output_writer = output_writers.StdoutWriter() try: output_writer.Open() except IOError as exception: print('Unable to open output writer with error: {0!s}'.format(exception)) print('') return False if pyolecf.check_file_signature(options.source): jump_list_file = jump_list.AutomaticDestinationsFile( debug=options.debug, output_writer=output_writer) else: jump_list_file = jump_list.CustomDestinationsFile( debug=options.debug, output_writer=output_writer) jump_list_file.Open(options.source) print('Windows Jump List information:') print('Number of entries:\t\t{0:d}'.format(len(jump_list_file.entries))) print('Number of recovered entries:\t{0:d}'.format( len(jump_list_file.recovered_entries))) print('') for lnk_file_entry in jump_list_file.entries: print('LNK file entry: {0:s}'.format(lnk_file_entry.identifier)) for shell_item in lnk_file_entry.GetShellItems(): print('Shell item: 0x{0:02x}'.format(shell_item.class_type)) print('') jump_list_file.Close() output_writer.Close() return True