(self,
                           hive: RegistryHive,
                           node_path: Sequence[objects.StructType] = None,
                           recurse: bool = False)
Method that wraps the more generic key_iterator, to provide output
        for printkey specifically.

        Args:
            hive: The registry hive to walk
            node_path: The list of nodes that make up the
            recurse: Traverse down the node tree or stay only on the same level

        Yields:
            The depth, and a tuple of results (last write time, hive offset, type, path, name, data and volatile)
Method that wraps the more generic key_iterator, to provide output
        for printkey specifically.
Method that wraps the more generic key_iterator to provide output for printkey specifically .
def _printkey_iterator(self,
                           hive: RegistryHive,
                           node_path: Sequence[objects.StructType] = None,
                           recurse: bool = False):
        """Method that wraps the more generic key_iterator, to provide output
        for printkey specifically.

        Args:
            hive: The registry hive to walk
            node_path: The list of nodes that make up the
            recurse: Traverse down the node tree or stay only on the same level

        Yields:
            The depth, and a tuple of results (last write time, hive offset, type, path, name, data and volatile)
        """
        for depth, is_key, last_write_time, key_path, volatile, node in self.key_iterator(hive, node_path, recurse):
            if is_key:
                try:
                    key_node_name = node.get_name()
                except (exceptions.InvalidAddressException, RegistryFormatException) as excp:
                    vollog.debug(excp)
                    key_node_name = renderers.UnreadableValue()

                yield (depth, (last_write_time, renderers.format_hints.Hex(hive.hive_offset), "Key", key_path,
                               key_node_name, renderers.NotApplicableValue(), volatile))
            else:
                try:
                    value_node_name = node.get_name() or "(Default)"
                except (exceptions.InvalidAddressException, RegistryFormatException) as excp:
                    vollog.debug(excp)
                    value_node_name = renderers.UnreadableValue()

                try:
                    value_type = RegValueTypes.get(node.Type).name
                except (exceptions.InvalidAddressException, RegistryFormatException) as excp:
                    vollog.debug(excp)
                    value_type = renderers.UnreadableValue()

                if isinstance(value_type, renderers.UnreadableValue):
                    vollog.debug("Couldn't read registry value type, so data is unreadable")
                    value_data = renderers.UnreadableValue()  # type: Union[interfaces.renderers.BaseAbsentValue, bytes]
                else:
                    try:
                        value_data = node.decode_data()

                        if isinstance(value_data, int):
                            value_data = format_hints.MultiTypeData(value_data, encoding = 'utf-8')
                        elif RegValueTypes.get(node.Type) == RegValueTypes.REG_BINARY:
                            value_data = format_hints.MultiTypeData(value_data, show_hex = True)
                        elif RegValueTypes.get(node.Type) == RegValueTypes.REG_MULTI_SZ:
                            value_data = format_hints.MultiTypeData(value_data,
                                                                    encoding = 'utf-16-le',
                                                                    split_nulls = True)
                        else:
                            value_data = format_hints.MultiTypeData(value_data, encoding = 'utf-16-le')
                    except (ValueError, exceptions.InvalidAddressException, RegistryFormatException) as excp:
                        vollog.debug(excp)
                        value_data = renderers.UnreadableValue()

                result = (depth, (last_write_time, renderers.format_hints.Hex(hive.hive_offset), value_type, key_path,
                                  value_node_name, value_data, volatile))
                yield result
def _printkey_iterator ( self , hive : RegistryHive , node_path : Sequence [ objects . StructType ] = None , recurse : bool = False ) : for depth , is_key , last_write_time , key_path , volatile , node in self . key_iterator ( hive , node_path , recurse ) : if is_key : try : key_node_name = node . get_name ( ) except ( exceptions . InvalidAddressException , RegistryFormatException ) as excp : vollog . debug ( excp ) key_node_name = renderers . UnreadableValue ( ) yield ( depth , ( last_write_time , renderers . format_hints . Hex ( hive . hive_offset ) , "Key" , key_path , key_node_name , renderers . NotApplicableValue ( ) , volatile ) ) else : try : value_node_name = node . get_name ( ) or "(Default)" except ( exceptions . InvalidAddressException , RegistryFormatException ) as excp : vollog . debug ( excp ) value_node_name = renderers . UnreadableValue ( ) try : value_type = RegValueTypes . get ( node . Type ) . name except ( exceptions . InvalidAddressException , RegistryFormatException ) as excp : vollog . debug ( excp ) value_type = renderers . UnreadableValue ( ) if isinstance ( value_type , renderers . UnreadableValue ) : vollog . debug ( "Couldn't read registry value type, so data is unreadable" ) value_data = renderers . UnreadableValue ( ) # type: Union[interfaces.renderers.BaseAbsentValue, bytes] else : try : value_data = node . decode_data ( ) if isinstance ( value_data , int ) : value_data = format_hints . MultiTypeData ( value_data , encoding = 'utf-8' ) elif RegValueTypes . get ( node . Type ) == RegValueTypes . REG_BINARY : value_data = format_hints . MultiTypeData ( value_data , show_hex = True ) elif RegValueTypes . get ( node . Type ) == RegValueTypes . REG_MULTI_SZ : value_data = format_hints . MultiTypeData ( value_data , encoding = 'utf-16-le' , split_nulls = True ) else : value_data = format_hints . MultiTypeData ( value_data , encoding = 'utf-16-le' ) except ( ValueError , exceptions . InvalidAddressException , RegistryFormatException ) as excp : vollog . debug ( excp ) value_data = renderers . UnreadableValue ( ) result = ( depth , ( last_write_time , renderers . format_hints . Hex ( hive . hive_offset ) , value_type , key_path , value_node_name , value_data , volatile ) ) yield result