<s> import sys <EOL> from mixbox . binding_utils import * <EOL> from . import cybox_common <EOL> from . import win_handle_object <EOL> class RegistryValueType ( GeneratedsSuper ) : <EOL> """<STR_LIT>""" <EOL> subclass = None <EOL> superclass = None <EOL> def __init__ ( self , Name = None , Data = None , Datatype = None , Byte_Runs = None ) : <EOL> self . Name = Name <EOL> self . Data = Data <EOL> self . Datatype = Datatype <EOL> self . Byte_Runs = Byte_Runs <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if RegistryValueType . subclass : <EOL> return RegistryValueType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return RegistryValueType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Name ( self ) : return self . Name <EOL> def set_Name ( self , Name ) : self . Name = Name <EOL> def validate_StringObjectPropertyType ( self , value ) : <EOL> pass <EOL> def get_Data ( self ) : return self . Data <EOL> def set_Data ( self , Data ) : self . Data = Data <EOL> def get_Datatype ( self ) : return self . Datatype <EOL> def set_Datatype ( self , Datatype ) : self . Datatype = Datatype <EOL> def validate_RegistryDatatypeType ( self , value ) : <EOL> pass <EOL> def get_Byte_Runs ( self ) : return self . Byte_Runs <EOL> def set_Byte_Runs ( self , Byte_Runs ) : self . Byte_Runs = Byte_Runs <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Name is not None or <EOL> self . Data is not None or <EOL> self . Datatype is not None or <EOL> self . Byte_Runs is not None <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' , namespacedef_ = '<STR_LIT>' , pretty_print = True ) : <EOL> if pretty_print : <EOL> eol_ = '<STR_LIT:\n>' <EOL> else : <EOL> eol_ = '<STR_LIT>' <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( namespace_ , name_ , namespacedef_ and '<STR_LIT:U+0020>' + namespacedef_ or '<STR_LIT>' , ) ) <EOL> already_processed = set ( ) <EOL> self . exportAttributes ( lwrite , level , already_processed , namespace_ , name_ = '<STR_LIT>' ) <EOL> if self . hasContent_ ( ) : <EOL> lwrite ( '<STR_LIT>' % ( eol_ , ) ) <EOL> self . exportChildren ( lwrite , level + <NUM_LIT:1> , namespace_ , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( namespace_ , name_ , eol_ ) ) <EOL> else : <EOL> lwrite ( '<STR_LIT>' % ( eol_ , ) ) <EOL> def exportAttributes ( self , lwrite , level , already_processed , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' ) : <EOL> pass <EOL> def exportChildren ( self , lwrite , level , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' , fromsubclass_ = False , pretty_print = True ) : <EOL> if pretty_print : <EOL> eol_ = '<STR_LIT:\n>' <EOL> else : <EOL> eol_ = '<STR_LIT>' <EOL> if self . Name is not None : <EOL> self . Name . export ( lwrite , level , '<STR_LIT>' , name_ = '<STR_LIT:Name>' , pretty_print = pretty_print ) <EOL> if self . Data is not None : <EOL> self . Data . export ( lwrite , level , '<STR_LIT>' , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Datatype is not None : <EOL> self . Datatype . export ( lwrite , level , '<STR_LIT>' , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Byte_Runs is not None : <EOL> self . Byte_Runs . export ( lwrite , level , '<STR_LIT>' , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> def build ( self , node ) : <EOL> already_processed = set ( ) <EOL> self . buildAttributes ( node , node . attrib , already_processed ) <EOL> for child in node : <EOL> nodeName_ = Tag_pattern_ . match ( child . tag ) . groups ( ) [ - <NUM_LIT:1> ] <EOL> self . buildChildren ( child , node , nodeName_ ) <EOL> def buildAttributes ( self , node , attrs , already_processed ) : <EOL> pass <EOL> def buildChildren ( self , child_ , node , nodeName_ , fromsubclass_ = False ) : <EOL> if nodeName_ == '<STR_LIT:Name>' : <EOL> obj_ = cybox_common . StringObjectPropertyType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Name ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = cybox_common . StringObjectPropertyType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Data ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = RegistryDatatypeType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Datatype ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = cybox_common . ByteRunsType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Byte_Runs ( obj_ ) <EOL> class RegistryValuesType ( GeneratedsSuper ) : <EOL> """<STR_LIT>""" <EOL> subclass = None <EOL> superclass = None <EOL> def __init__ ( self , Value = None ) : <EOL> if Value is None : <EOL> self . Value = [ ] <EOL> else : <EOL> self . Value = Value <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if RegistryValuesType . subclass : <EOL> return RegistryValuesType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return RegistryValuesType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Value ( self ) : return self . Value <EOL> def set_Value ( self , Value ) : self . Value = Value <EOL> def add_Value ( self , value ) : self . Value . append ( value ) <EOL> def insert_Value ( self , index , value ) : self . Value [ index ] = value <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Value <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' , namespacedef_ = '<STR_LIT>' , pretty_print = True ) : <EOL> if pretty_print : <EOL> eol_ = '<STR_LIT:\n>' <EOL> else : <EOL> eol_ = '<STR_LIT>' <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( namespace_ , name_ , namespacedef_ and '<STR_LIT:U+0020>' + namespacedef_ or '<STR_LIT>' , ) ) <EOL> already_processed = set ( ) <EOL> self . exportAttributes ( lwrite , level , already_processed , namespace_ , name_ = '<STR_LIT>' ) <EOL> if self . hasContent_ ( ) : <EOL> lwrite ( '<STR_LIT>' % ( eol_ , ) ) <EOL> self . exportChildren ( lwrite , level + <NUM_LIT:1> , namespace_ , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( namespace_ , name_ , eol_ ) ) <EOL> else : <EOL> lwrite ( '<STR_LIT>' % ( eol_ , ) ) <EOL> def exportAttributes ( self , lwrite , level , already_processed , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' ) : <EOL> pass <EOL> def exportChildren ( self , lwrite , level , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' , fromsubclass_ = False , pretty_print = True ) : <EOL> if pretty_print : <EOL> eol_ = '<STR_LIT:\n>' <EOL> else : <EOL> eol_ = '<STR_LIT>' <EOL> for Value_ in self . Value : <EOL> Value_ . export ( lwrite , level , '<STR_LIT>' , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> def build ( self , node ) : <EOL> already_processed = set ( ) <EOL> self . buildAttributes ( node , node . attrib , already_processed ) <EOL> for child in node : <EOL> nodeName_ = Tag_pattern_ . match ( child . tag ) . groups ( ) [ - <NUM_LIT:1> ] <EOL> self . buildChildren ( child , node , nodeName_ ) <EOL> def buildAttributes ( self , node , attrs , already_processed ) : <EOL> pass <EOL> def buildChildren ( self , child_ , node , nodeName_ , fromsubclass_ = False ) : <EOL> if nodeName_ == '<STR_LIT>' : <EOL> obj_ = RegistryValueType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . Value . append ( obj_ ) <EOL> class RegistrySubkeysType ( GeneratedsSuper ) : <EOL> """<STR_LIT>""" <EOL> subclass = None <EOL> superclass = None <EOL> def __init__ ( self , Subkey = None ) : <EOL> if Subkey is None : <EOL> self . Subkey = [ ] <EOL> else : <EOL> self . Subkey = Subkey <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if RegistrySubkeysType . subclass : <EOL> return RegistrySubkeysType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return RegistrySubkeysType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Subkey ( self ) : return self . Subkey <EOL> def set_Subkey ( self , Subkey ) : self . Subkey = Subkey <EOL> def add_Subkey ( self , value ) : self . Subkey . append ( value ) <EOL> def insert_Subkey ( self , index , value ) : self . Subkey [ index ] = value <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Subkey <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' , namespacedef_ = '<STR_LIT>' , pretty_print = True ) : <EOL> if pretty_print : <EOL> eol_ = '<STR_LIT:\n>' <EOL> else : <EOL> eol_ = '<STR_LIT>' <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( namespace_ , name_ , namespacedef_ and '<STR_LIT:U+0020>' + namespacedef_ or '<STR_LIT>' , ) ) <EOL> already_processed = set ( ) <EOL> self . exportAttributes ( lwrite , level , already_processed , namespace_ , name_ = '<STR_LIT>' ) <EOL> if self . hasContent_ ( ) : <EOL> lwrite ( '<STR_LIT>' % ( eol_ , ) ) <EOL> self . exportChildren ( lwrite , level + <NUM_LIT:1> , namespace_ , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( namespace_ , name_ , eol_ ) ) <EOL> else : <EOL> lwrite ( '<STR_LIT>' % ( eol_ , ) ) <EOL> def exportAttributes ( self , lwrite , level , already_processed , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' ) : <EOL> pass <EOL> def exportChildren ( self , lwrite , level , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' , fromsubclass_ = False , pretty_print = True ) : <EOL> if pretty_print : <EOL> eol_ = '<STR_LIT:\n>' <EOL> else : <EOL> eol_ = '<STR_LIT>' <EOL> for Subkey_ in self . Subkey : <EOL> Subkey_ . export ( lwrite , level , '<STR_LIT>' , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> def build ( self , node ) : <EOL> already_processed = set ( ) <EOL> self . buildAttributes ( node , node . attrib , already_processed ) <EOL> for child in node : <EOL> nodeName_ = Tag_pattern_ . match ( child . tag ) . groups ( ) [ - <NUM_LIT:1> ] <EOL> self . buildChildren ( child , node , nodeName_ ) <EOL> def buildAttributes ( self , node , attrs , already_processed ) : <EOL> pass <EOL> def buildChildren ( self , child_ , node , nodeName_ , fromsubclass_ = False ) : <EOL> if nodeName_ == '<STR_LIT>' : <EOL> obj_ = WindowsRegistryKeyObjectType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . Subkey . append ( obj_ ) <EOL> class RegistryHiveType ( cybox_common . BaseObjectPropertyType ) : <EOL> """<STR_LIT>""" <EOL> subclass = None <EOL> superclass = cybox_common . BaseObjectPropertyType <EOL> def __init__ ( self , obfuscation_algorithm_ref = None , refanging_transform_type = None , has_changed = None , delimiter = '<STR_LIT>' , pattern_type = None , datatype = '<STR_LIT:string>' , refanging_transform = None , is_case_sensitive = True , bit_mask = None , appears_random = None , observed_encoding = None , defanging_algorithm_ref = None , is_obfuscated = None , regex_syntax = None , apply_condition = '<STR_LIT>' , trend = None , idref = None , is_defanged = None , id = None , condition = None , valueOf_ = None ) : <EOL> super ( RegistryHiveType , self ) . __init__ ( obfuscation_algorithm_ref , refanging_transform_type , has_changed , delimiter , pattern_type , datatype , refanging_transform , is_case_sensitive , bit_mask , appears_random , observed_encoding , defanging_algorithm_ref , is_obfuscated , regex_syntax , apply_condition , trend , idref , is_defanged , id , condition , valueOf_ ) <EOL> self . datatype = _cast ( None , datatype ) <EOL> self . valueOf_ = valueOf_ <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if RegistryHiveType . subclass : <EOL> return RegistryHiveType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return RegistryHiveType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_datatype ( self ) : return self . datatype <EOL> def set_datatype ( self , datatype ) : self . datatype = datatype <EOL> def get_valueOf_ ( self ) : return self . valueOf_ <EOL> def set_valueOf_ ( self , valueOf_ ) : self . valueOf_ = valueOf_ <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . valueOf_ or <EOL> super ( RegistryHiveType , self ) . hasContent_ ( ) <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' , namespacedef_ = '<STR_LIT>' , pretty_print = True ) : <EOL> if pretty_print : <EOL> eol_ = '<STR_LIT:\n>' <EOL> else : <EOL> eol_ = '<STR_LIT>' <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( namespace_ , name_ , namespacedef_ and '<STR_LIT:U+0020>' + namespacedef_ or '<STR_LIT>' , ) ) <EOL> already_processed = set ( ) <EOL> self . exportAttributes ( lwrite , level , already_processed , namespace_ , name_ = '<STR_LIT>' ) <EOL> if self . hasContent_ ( ) : <EOL> lwrite ( '<STR_LIT:>>' ) <EOL> lwrite ( quote_xml ( self . valueOf_ ) ) <EOL> self . exportChildren ( lwrite , level + <NUM_LIT:1> , namespace_ , name_ , pretty_print = pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( namespace_ , name_ , eol_ ) ) <EOL> else : <EOL> lwrite ( '<STR_LIT>' % ( eol_ , ) ) <EOL> def exportAttributes ( self , lwrite , level , already_processed , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' ) : <EOL> super ( RegistryHiveType , self ) . exportAttributes ( lwrite , level , already_processed , namespace_ , name_ = '<STR_LIT>' ) <EOL> if self . datatype is not None : <EOL> lwrite ( '<STR_LIT>' % ( quote_attrib ( self . datatype ) , ) ) <EOL> def exportChildren ( self , lwrite , level , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' , fromsubclass_ = False , pretty_print = True ) : <EOL> super ( RegistryHiveType , self ) . exportChildren ( lwrite , level , '<STR_LIT>' , name_ , True , pretty_print = pretty_print ) <EOL> pass <EOL> def build ( self , node ) : <EOL> already_processed = set ( ) <EOL> self . buildAttributes ( node , node . attrib , already_processed ) <EOL> self . valueOf_ = get_all_text_ ( node ) <EOL> for child in node : <EOL> nodeName_ = Tag_pattern_ . match ( child . tag ) . groups ( ) [ - <NUM_LIT:1> ] <EOL> self . buildChildren ( child , node , nodeName_ ) <EOL> def buildAttributes ( self , node , attrs , already_processed ) : <EOL> value = find_attr_value_ ( '<STR_LIT>' , node ) <EOL> if value is not None : <EOL> self . datatype = value <EOL> super ( RegistryHiveType , self ) . buildAttributes ( node , attrs , already_processed ) <EOL> def buildChildren ( self , child_ , node , nodeName_ , fromsubclass_ = False ) : <EOL> pass <EOL> class RegistryDatatypeType ( cybox_common . BaseObjectPropertyType ) : <EOL> """<STR_LIT>""" <EOL> subclass = None <EOL> superclass = cybox_common . BaseObjectPropertyType <EOL> def __init__ ( self , obfuscation_algorithm_ref = None , refanging_transform_type = None , has_changed = None , delimiter = '<STR_LIT>' , pattern_type = None , datatype = '<STR_LIT:string>' , refanging_transform = None , is_case_sensitive = True , bit_mask = None , appears_random = None , observed_encoding = None , defanging_algorithm_ref = None , is_obfuscated = None , regex_syntax = None , apply_condition = '<STR_LIT>' , trend = None , idref = None , is_defanged = None , id = None , condition = None , valueOf_ = None ) : <EOL> super ( RegistryDatatypeType , self ) . __init__ ( obfuscation_algorithm_ref , refanging_transform_type , has_changed , delimiter , pattern_type , datatype , refanging_transform , is_case_sensitive , bit_mask , appears_random , observed_encoding , defanging_algorithm_ref , is_obfuscated , regex_syntax , apply_condition , trend , idref , is_defanged , id , condition , valueOf_ ) <EOL> self . datatype = _cast ( None , datatype ) <EOL> self . valueOf_ = valueOf_ <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if RegistryDatatypeType . subclass : <EOL> return RegistryDatatypeType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return RegistryDatatypeType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_datatype ( self ) : return self . datatype <EOL> def set_datatype ( self , datatype ) : self . datatype = datatype <EOL> def get_valueOf_ ( self ) : return self . valueOf_ <EOL> def set_valueOf_ ( self , valueOf_ ) : self . valueOf_ = valueOf_ <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . valueOf_ or <EOL> super ( RegistryDatatypeType , self ) . hasContent_ ( ) <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' , namespacedef_ = '<STR_LIT>' , pretty_print = True ) : <EOL> if pretty_print : <EOL> eol_ = '<STR_LIT:\n>' <EOL> else : <EOL> eol_ = '<STR_LIT>' <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( namespace_ , name_ , namespacedef_ and '<STR_LIT:U+0020>' + namespacedef_ or '<STR_LIT>' , ) ) <EOL> already_processed = set ( ) <EOL> self . exportAttributes ( lwrite , level , already_processed , namespace_ , name_ = '<STR_LIT>' ) <EOL> if self . hasContent_ ( ) : <EOL> lwrite ( '<STR_LIT:>>' ) <EOL> lwrite ( quote_xml ( self . valueOf_ ) ) <EOL> self . exportChildren ( lwrite , level + <NUM_LIT:1> , namespace_ , name_ , pretty_print = pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( namespace_ , name_ , eol_ ) ) <EOL> else : <EOL> lwrite ( '<STR_LIT>' % ( eol_ , ) ) <EOL> def exportAttributes ( self , lwrite , level , already_processed , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' ) : <EOL> super ( RegistryDatatypeType , self ) . exportAttributes ( lwrite , level , already_processed , namespace_ , name_ = '<STR_LIT>' ) <EOL> if self . datatype is not None : <EOL> lwrite ( '<STR_LIT>' % ( quote_attrib ( self . datatype ) , ) ) <EOL> def exportChildren ( self , lwrite , level , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' , fromsubclass_ = False , pretty_print = True ) : <EOL> super ( RegistryDatatypeType , self ) . exportChildren ( lwrite , level , '<STR_LIT>' , name_ , True , pretty_print = pretty_print ) <EOL> pass <EOL> def build ( self , node ) : <EOL> already_processed = set ( ) <EOL> self . buildAttributes ( node , node . attrib , already_processed ) <EOL> self . valueOf_ = get_all_text_ ( node ) <EOL> for child in node : <EOL> nodeName_ = Tag_pattern_ . match ( child . tag ) . groups ( ) [ - <NUM_LIT:1> ] <EOL> self . buildChildren ( child , node , nodeName_ ) <EOL> def buildAttributes ( self , node , attrs , already_processed ) : <EOL> value = find_attr_value_ ( '<STR_LIT>' , node ) <EOL> if value is not None : <EOL> self . datatype = value <EOL> super ( RegistryDatatypeType , self ) . buildAttributes ( node , attrs , already_processed ) <EOL> def buildChildren ( self , child_ , node , nodeName_ , fromsubclass_ = False ) : <EOL> pass <EOL> class WindowsRegistryKeyObjectType ( cybox_common . ObjectPropertiesType ) : <EOL> """<STR_LIT>""" <EOL> subclass = None <EOL> superclass = cybox_common . ObjectPropertiesType <EOL> def __init__ ( self , object_reference = None , Custom_Properties = None , xsi_type = None , Key = None , Hive = None , Number_Values = None , Values = None , Modified_Time = None , Creator_Username = None , Handle_List = None , Number_Subkeys = None , Subkeys = None , Byte_Runs = None ) : <EOL> super ( WindowsRegistryKeyObjectType , self ) . __init__ ( object_reference , Custom_Properties , xsi_type ) <EOL> self . Key = Key <EOL> self . Hive = Hive <EOL> self . Number_Values = Number_Values <EOL> self . Values = Values <EOL> self . Modified_Time = Modified_Time <EOL> self . Creator_Username = Creator_Username <EOL> self . Handle_List = Handle_List <EOL> self . Number_Subkeys = Number_Subkeys <EOL> self . Subkeys = Subkeys <EOL> self . Byte_Runs = Byte_Runs <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if WindowsRegistryKeyObjectType . subclass : <EOL> return WindowsRegistryKeyObjectType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return WindowsRegistryKeyObjectType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Key ( self ) : return self . Key <EOL> def set_Key ( self , Key ) : self . Key = Key <EOL> def validate_StringObjectPropertyType ( self , value ) : <EOL> pass <EOL> def get_Hive ( self ) : return self . Hive <EOL> def set_Hive ( self , Hive ) : self . Hive = Hive <EOL> def validate_RegistryHiveType ( self , value ) : <EOL> pass <EOL> def get_Number_Values ( self ) : return self . Number_Values <EOL> def set_Number_Values ( self , Number_Values ) : self . Number_Values = Number_Values <EOL> def validate_UnsignedIntegerObjectPropertyType ( self , value ) : <EOL> pass <EOL> def get_Values ( self ) : return self . Values <EOL> def set_Values ( self , Values ) : self . Values = Values <EOL> def get_Modified_Time ( self ) : return self . Modified_Time <EOL> def set_Modified_Time ( self , Modified_Time ) : self . Modified_Time = Modified_Time <EOL> def validate_DateTimeObjectPropertyType ( self , value ) : <EOL> pass <EOL> def get_Creator_Username ( self ) : return self . Creator_Username <EOL> def set_Creator_Username ( self , Creator_Username ) : self . Creator_Username = Creator_Username <EOL> def get_Handle_List ( self ) : return self . Handle_List <EOL> def set_Handle_List ( self , Handle_List ) : self . Handle_List = Handle_List <EOL> def get_Number_Subkeys ( self ) : return self . Number_Subkeys <EOL> def set_Number_Subkeys ( self , Number_Subkeys ) : self . Number_Subkeys = Number_Subkeys <EOL> def get_Subkeys ( self ) : return self . Subkeys <EOL> def set_Subkeys ( self , Subkeys ) : self . Subkeys = Subkeys <EOL> def get_Byte_Runs ( self ) : return self . Byte_Runs <EOL> def set_Byte_Runs ( self , Byte_Runs ) : self . Byte_Runs = Byte_Runs <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Key is not None or <EOL> self . Hive is not None or <EOL> self . Number_Values is not None or <EOL> self . Values is not None or <EOL> self . Modified_Time is not None or <EOL> self . Creator_Username is not None or <EOL> self . Handle_List is not None or <EOL> self . Number_Subkeys is not None or <EOL> self . Subkeys is not None or <EOL> self . Byte_Runs is not None or <EOL> super ( WindowsRegistryKeyObjectType , self ) . hasContent_ ( ) <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' , namespacedef_ = '<STR_LIT>' , pretty_print = True ) : <EOL> if pretty_print : <EOL> eol_ = '<STR_LIT:\n>' <EOL> else : <EOL> eol_ = '<STR_LIT>' <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( namespace_ , name_ , namespacedef_ and '<STR_LIT:U+0020>' + namespacedef_ or '<STR_LIT>' , ) ) <EOL> already_processed = set ( ) <EOL> self . exportAttributes ( lwrite , level , already_processed , namespace_ , name_ = '<STR_LIT>' ) <EOL> if self . hasContent_ ( ) : <EOL> lwrite ( '<STR_LIT>' % ( eol_ , ) ) <EOL> self . exportChildren ( lwrite , level + <NUM_LIT:1> , namespace_ , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( namespace_ , name_ , eol_ ) ) <EOL> else : <EOL> lwrite ( '<STR_LIT>' % ( eol_ , ) ) <EOL> def exportAttributes ( self , lwrite , level , already_processed , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' ) : <EOL> super ( WindowsRegistryKeyObjectType , self ) . exportAttributes ( lwrite , level , already_processed , namespace_ , name_ = '<STR_LIT>' ) <EOL> def exportChildren ( self , lwrite , level , namespace_ = '<STR_LIT>' , name_ = '<STR_LIT>' , fromsubclass_ = False , pretty_print = True ) : <EOL> super ( WindowsRegistryKeyObjectType , self ) . exportChildren ( lwrite , level , '<STR_LIT>' , name_ , True , pretty_print = pretty_print ) <EOL> if pretty_print : <EOL> eol_ = '<STR_LIT:\n>' <EOL> else : <EOL> eol_ = '<STR_LIT>' <EOL> if self . Key is not None : <EOL> self . Key . export ( lwrite , level , '<STR_LIT>' , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Hive is not None : <EOL> self . Hive . export ( lwrite , level , '<STR_LIT>' , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Number_Values is not None : <EOL> self . Number_Values . export ( lwrite , level , '<STR_LIT>' , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Values is not None : <EOL> self . Values . export ( lwrite , level , '<STR_LIT>' , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Modified_Time is not None : <EOL> self . Modified_Time . export ( lwrite , level , '<STR_LIT>' , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Creator_Username is not None : <EOL> self . Creator_Username . export ( lwrite , level , '<STR_LIT>' , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Handle_List is not None : <EOL> self . Handle_List . export ( lwrite , level , '<STR_LIT>' , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Number_Subkeys is not None : <EOL> self . Number_Subkeys . export ( lwrite , level , '<STR_LIT>' , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Subkeys is not None : <EOL> self . Subkeys . export ( lwrite , level , '<STR_LIT>' , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Byte_Runs is not None : <EOL> self . Byte_Runs . export ( lwrite , level , '<STR_LIT>' , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> def build ( self , node ) : <EOL> already_processed = set ( ) <EOL> self . buildAttributes ( node , node . attrib , already_processed ) <EOL> for child in node : <EOL> nodeName_ = Tag_pattern_ . match ( child . tag ) . groups ( ) [ - <NUM_LIT:1> ] <EOL> self . buildChildren ( child , node , nodeName_ ) <EOL> def buildAttributes ( self , node , attrs , already_processed ) : <EOL> super ( WindowsRegistryKeyObjectType , self ) . buildAttributes ( node , attrs , already_processed ) <EOL> def buildChildren ( self , child_ , node , nodeName_ , fromsubclass_ = False ) : <EOL> if nodeName_ == '<STR_LIT>' : <EOL> obj_ = cybox_common . StringObjectPropertyType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Key ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = RegistryHiveType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Hive ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = cybox_common . UnsignedIntegerObjectPropertyType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Number_Values ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = RegistryValuesType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Values ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = cybox_common . DateTimeObjectPropertyType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Modified_Time ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = cybox_common . StringObjectPropertyType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Creator_Username ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = win_handle_object . WindowsHandleListType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Handle_List ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = cybox_common . UnsignedIntegerObjectPropertyType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Number_Subkeys ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = RegistrySubkeysType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Subkeys ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = cybox_common . ByteRunsType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Byte_Runs ( obj_ ) <EOL> super ( WindowsRegistryKeyObjectType , self ) . buildChildren ( child_ , node , nodeName_ , True ) <EOL> GDSClassesMapping = { <EOL> '<STR_LIT>' : cybox_common . BuildUtilityType , <EOL> '<STR_LIT>' : cybox_common . ErrorsType , <EOL> '<STR_LIT>' : cybox_common . TimeType , <EOL> '<STR_LIT>' : cybox_common . StringObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . MetadataType , <EOL> '<STR_LIT>' : cybox_common . HashType , <EOL> '<STR_LIT>' : cybox_common . ControlledVocabularyStringType , <EOL> '<STR_LIT>' : cybox_common . UnsignedIntegerObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . HashValueType , <EOL> '<STR_LIT>' : cybox_common . InternalStringsType , <EOL> '<STR_LIT>' : cybox_common . FuzzyHashStructureType , <EOL> '<STR_LIT>' : cybox_common . ByteRunsType , <EOL> '<STR_LIT>' : cybox_common . MetadataType , <EOL> '<STR_LIT>' : cybox_common . HashListType , <EOL> '<STR_LIT>' : cybox_common . DigitalSignatureInfoType , <EOL> '<STR_LIT>' : cybox_common . CodeSnippetsType , <EOL> '<STR_LIT>' : cybox_common . StringObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . IntegerObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . ControlledVocabularyStringType , <EOL> '<STR_LIT>' : cybox_common . InternationalizationSettingsType , <EOL> '<STR_LIT>' : cybox_common . ToolConfigurationType , <EOL> '<STR_LIT>' : cybox_common . UnsignedLongObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . CompilerType , <EOL> '<STR_LIT>' : cybox_common . FunctionsType , <EOL> '<STR_LIT>' : cybox_common . StringObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . UnsignedLongObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . PlatformSpecificationType , <EOL> '<STR_LIT>' : cybox_common . CompilerInformalDescriptionType , <EOL> '<STR_LIT>' : cybox_common . ObjectPropertiesType , <EOL> '<STR_LIT>' : cybox_common . PlatformSpecificationType , <EOL> '<STR_LIT>' : cybox_common . UsageContextAssumptionsType , <EOL> '<STR_LIT>' : win_handle_object . HandleType , <EOL> '<STR_LIT>' : cybox_common . CompilersType , <EOL> '<STR_LIT>' : cybox_common . ControlledVocabularyStringType , <EOL> '<STR_LIT>' : cybox_common . ExtractedStringType , <EOL> '<STR_LIT>' : cybox_common . ToolInformationType , <EOL> '<STR_LIT>' : cybox_common . BuildInformationType , <EOL> '<STR_LIT>' : cybox_common . StringObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . ErrorInstancesType , <EOL> '<STR_LIT>' : cybox_common . StringObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . StringObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . PropertyType , <EOL> '<STR_LIT>' : cybox_common . ExtractedStringsType , <EOL> '<STR_LIT>' : cybox_common . IntegerObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . StructuredTextType , <EOL> '<STR_LIT>' : cybox_common . ObjectPropertiesType , <EOL> '<STR_LIT>' : cybox_common . ConfigurationSettingsType , <EOL> '<STR_LIT>' : cybox_common . SimpleHashValueType , <EOL> '<STR_LIT>' : cybox_common . HexBinaryObjectPropertyType , <EOL> '<STR_LIT>' : win_handle_object . WindowsHandleListType , <EOL> '<STR_LIT>' : cybox_common . ObjectPropertiesType , <EOL> '<STR_LIT>' : cybox_common . StringObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . UnsignedLongObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . PlatformIdentifierType , <EOL> '<STR_LIT>' : cybox_common . ToolSpecificDataType , <EOL> '<STR_LIT>' : cybox_common . ExecutionEnvironmentType , <EOL> '<STR_LIT>' : cybox_common . IntegerObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . DependenciesType , <EOL> '<STR_LIT>' : cybox_common . IntegerObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . IntegerObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . DateRangeType , <EOL> '<STR_LIT>' : cybox_common . HashListType , <EOL> '<STR_LIT>' : cybox_common . StringObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . HashSegmentsType , <EOL> '<STR_LIT>' : cybox_common . StringObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . StructuredTextType , <EOL> '<STR_LIT>' : cybox_common . FuzzyHashBlockType , <EOL> '<STR_LIT>' : cybox_common . DependencyType , <EOL> '<STR_LIT>' : cybox_common . ErrorType , <EOL> '<STR_LIT>' : cybox_common . UnsignedIntegerObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . HexBinaryObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . EnvironmentVariableType , <EOL> '<STR_LIT>' : cybox_common . ByteRunType , <EOL> '<STR_LIT>' : cybox_common . PersonnelType , <EOL> '<STR_LIT>' : cybox_common . IntegerObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . ImportsType , <EOL> '<STR_LIT>' : cybox_common . LibraryType , <EOL> '<STR_LIT>' : cybox_common . ToolReferencesType , <EOL> '<STR_LIT>' : win_handle_object . WindowsHandleObjectType , <EOL> '<STR_LIT>' : cybox_common . HashValueType , <EOL> '<STR_LIT>' : cybox_common . ConfigurationSettingType , <EOL> '<STR_LIT>' : cybox_common . DateTimeObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . UnsignedIntegerObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . LibrariesType , <EOL> '<STR_LIT>' : cybox_common . StringObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . StringObjectPropertyType , <EOL> '<STR_LIT>' : win_handle_object . WindowsHandleObjectType , <EOL> '<STR_LIT>' : cybox_common . StructuredTextType , <EOL> '<STR_LIT>' : cybox_common . ObjectPropertiesType , <EOL> '<STR_LIT>' : cybox_common . BuildConfigurationType , <EOL> '<STR_LIT>' : cybox_common . HexBinaryObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . IntegerObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . HashSegmentType , <EOL> '<STR_LIT>' : cybox_common . StringObjectPropertyType , <EOL> '<STR_LIT:Name>' : cybox_common . StringObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . StringObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . IntegerObjectPropertyType , <EOL> '<STR_LIT>' : cybox_common . PlatformSpecificationType , <EOL> '<STR_LIT>' : cybox_common . FuzzyHashValueType , <EOL> '<STR_LIT>' : cybox_common . DataSizeType , <EOL> '<STR_LIT>' : cybox_common . StructuredTextType , <EOL> '<STR_LIT>' : cybox_common . ContributorType , <EOL> '<STR_LIT>' : cybox_common . ToolsInformationType , <EOL> '<STR_LIT>' : cybox_common . CustomPropertiesType , <EOL> } <EOL> USAGE_TEXT = """<STR_LIT>""" <EOL> def usage ( ) : <EOL> print ( USAGE_TEXT ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> def get_root_tag ( node ) : <EOL> tag = Tag_pattern_ . match ( node . tag ) . groups ( ) [ - <NUM_LIT:1> ] <EOL> rootClass = GDSClassesMapping . get ( tag ) <EOL> if rootClass is None : <EOL> rootClass = globals ( ) . get ( tag ) <EOL> return tag , rootClass <EOL> def parse ( inFileName ) : <EOL> doc = parsexml_ ( inFileName ) <EOL> rootNode = doc . getroot ( ) <EOL> rootTag , rootClass = get_root_tag ( rootNode ) <EOL> if rootClass is None : <EOL> rootTag = '<STR_LIT>' <EOL> rootClass = WindowsRegistryKeyObjectType <EOL> rootObj = rootClass . factory ( ) <EOL> rootObj . build ( rootNode ) <EOL> doc = None <EOL> return rootObj <EOL> def parseEtree ( inFileName ) : <EOL> doc = parsexml_ ( inFileName ) <EOL> rootNode = doc . getroot ( ) <EOL> rootTag , rootClass = get_root_tag ( rootNode ) <EOL> if rootClass is None : <EOL> rootTag = '<STR_LIT>' <EOL> rootClass = WindowsRegistryKeyObjectType <EOL> rootObj = rootClass . factory ( ) <EOL> rootObj . build ( rootNode ) <EOL> doc = None <EOL> rootElement = rootObj . to_etree ( None , name_ = rootTag ) <EOL> content = etree_ . tostring ( rootElement , pretty_print = True , <EOL> xml_declaration = True , encoding = "<STR_LIT:utf-8>" ) <EOL> sys . stdout . write ( content ) <EOL> sys . stdout . write ( '<STR_LIT:\n>' ) <EOL> return rootObj , rootElement <EOL> def parseString ( inString ) : <EOL> from mixbox . vendor . six import StringIO <EOL> doc = parsexml_ ( StringIO ( inString ) ) <EOL> rootNode = doc . getroot ( ) <EOL> rootTag , rootClass = get_root_tag ( rootNode ) <EOL> if rootClass is None : <EOL> rootTag = '<STR_LIT>' <EOL> rootClass = WindowsRegistryKeyObjectType <EOL> rootObj = rootClass . factory ( ) <EOL> rootObj . build ( rootNode ) <EOL> doc = None <EOL> return rootObj <EOL> def main ( ) : <EOL> args = sys . argv [ <NUM_LIT:1> : ] <EOL> if len ( args ) == <NUM_LIT:1> : <EOL> parse ( args [ <NUM_LIT:0> ] ) <EOL> else : <EOL> usage ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) <EOL> __all__ = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] </s>
