<s> import sys <EOL> import cybox . bindings . cybox_core as cybox_core_binding <EOL> from mixbox . binding_utils import * <EOL> from stix . bindings import lookup_extension , register_extension <EOL> import stix . bindings . stix_common as stix_common_binding <EOL> import stix . bindings . data_marking as data_marking_binding <EOL> XML_NS = "<STR_LIT>" <EOL> class AttackPatternType ( GeneratedsSuper ) : <EOL> """<STR_LIT>""" <EOL> subclass = None <EOL> superclass = None <EOL> def __init__ ( self , idref = None , capec_id = None , id = None , Title = None , Description = None , Short_Description = None ) : <EOL> self . idref = _cast ( None , idref ) <EOL> self . capec_id = _cast ( None , capec_id ) <EOL> self . id = _cast ( None , id ) <EOL> self . Title = Title <EOL> if Description is None : <EOL> self . Description = [ ] <EOL> else : <EOL> self . Description = Description <EOL> if Short_Description is None : <EOL> self . Short_Description = [ ] <EOL> else : <EOL> self . Short_Description = Short_Description <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if AttackPatternType . subclass : <EOL> return AttackPatternType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return AttackPatternType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Title ( self ) : return self . Title <EOL> def set_Title ( self , Title ) : self . Title = Title <EOL> def insert_Description ( self , index , value ) : self . Description [ index ] = value <EOL> def add_Description ( self , Description ) : self . Description . append ( Description ) <EOL> def get_Description ( self ) : return self . Description <EOL> def set_Description ( self , Description ) : self . Description = Description <EOL> def insert_Short_Description ( self , index , value ) : self . Short_Description [ index ] = value <EOL> def add_Short_Description ( self , Short_Description ) : self . Short_Description . append ( Short_Description ) <EOL> def get_Short_Description ( self ) : return self . Short_Description <EOL> def set_Short_Description ( self , Short_Description ) : self . Short_Description = Short_Description <EOL> def get_idref ( self ) : return self . idref <EOL> def set_idref ( self , idref ) : self . idref = idref <EOL> def get_capec_id ( self ) : return self . capec_id <EOL> def set_capec_id ( self , capec_id ) : self . capec_id = capec_id <EOL> def get_id ( self ) : return self . id <EOL> def set_id ( self , id ) : self . id = id <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Title is not None or <EOL> self . Description or <EOL> self . Short_Description <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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>' % ( nsmap [ 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> , nsmap , XML_NS , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ 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> if self . idref is not None and '<STR_LIT>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT>' ) <EOL> lwrite ( '<STR_LIT>' % ( quote_attrib ( self . idref ) , ) ) <EOL> if self . capec_id is not None and '<STR_LIT>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT>' ) <EOL> lwrite ( '<STR_LIT>' % ( quote_attrib ( self . capec_id ) , ) ) <EOL> if self . id is not None and '<STR_LIT:id>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT:id>' ) <EOL> lwrite ( '<STR_LIT>' % ( quote_attrib ( self . id ) , ) ) <EOL> def exportChildren ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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 . Title is not None : <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ namespace_ ] , quote_xml ( self . Title ) , nsmap [ namespace_ ] , eol_ ) ) <EOL> for Description in self . Description : <EOL> Description . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> for Short_Description in self . Short_Description : <EOL> Short_Description . export ( lwrite , level , nsmap , namespace_ , 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> value = find_attr_value_ ( '<STR_LIT>' , node ) <EOL> if value is not None and '<STR_LIT>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT>' ) <EOL> self . idref = value <EOL> value = find_attr_value_ ( '<STR_LIT>' , node ) <EOL> if value is not None and '<STR_LIT>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT>' ) <EOL> self . capec_id = value <EOL> value = find_attr_value_ ( '<STR_LIT:id>' , node ) <EOL> if value is not None and '<STR_LIT:id>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT:id>' ) <EOL> self . id = value <EOL> def buildChildren ( self , child_ , node , nodeName_ , fromsubclass_ = False ) : <EOL> if nodeName_ == '<STR_LIT>' : <EOL> Title_ = child_ . text <EOL> Title_ = self . gds_validate_string ( Title_ , node , '<STR_LIT>' ) <EOL> self . Title = Title_ <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . StructuredTextType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . add_Description ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . StructuredTextType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . add_Short_Description ( obj_ ) <EOL> class MalwareInstanceType ( GeneratedsSuper ) : <EOL> """<STR_LIT>""" <EOL> subclass = None <EOL> superclass = None <EOL> def __init__ ( self , idref = None , id = None , Type = None , Name = None , Title = None , Description = None , Short_Description = None ) : <EOL> self . idref = _cast ( None , idref ) <EOL> self . id = _cast ( None , id ) <EOL> if Type is None : <EOL> self . Type = [ ] <EOL> else : <EOL> self . Type = Type <EOL> if Name is None : <EOL> self . Name = [ ] <EOL> else : <EOL> self . Name = Name <EOL> self . Title = Title <EOL> if Description is None : <EOL> self . Description = [ ] <EOL> else : <EOL> self . Description = Description <EOL> if Short_Description is None : <EOL> self . Short_Description = [ ] <EOL> else : <EOL> self . Short_Description = Short_Description <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if MalwareInstanceType . subclass : <EOL> return MalwareInstanceType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return MalwareInstanceType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Type ( self ) : return self . Type <EOL> def set_Type ( self , Type ) : self . Type = Type <EOL> def add_Type ( self , value ) : self . Type . append ( value ) <EOL> def insert_Type ( self , index , value ) : self . Type [ index ] = value <EOL> def get_Name ( self ) : return self . Name <EOL> def set_Name ( self , Name ) : self . Name = Name <EOL> def add_Name ( self , value ) : self . Name . append ( value ) <EOL> def insert_Name ( self , index , value ) : self . Name [ index ] = value <EOL> def get_Title ( self ) : return self . Title <EOL> def set_Title ( self , Title ) : self . Title = Title <EOL> def insert_Description ( self , index , value ) : self . Description [ index ] = value <EOL> def add_Description ( self , Description ) : self . Description . append ( Description ) <EOL> def get_Description ( self ) : return self . Description <EOL> def set_Description ( self , Description ) : self . Description = Description <EOL> def insert_Short_Description ( self , index , value ) : self . Short_Description [ index ] = value <EOL> def add_Short_Description ( self , Short_Description ) : self . Short_Description . append ( Short_Description ) <EOL> def get_Short_Description ( self ) : return self . Short_Description <EOL> def set_Short_Description ( self , Short_Description ) : self . Short_Description = Short_Description <EOL> def get_idref ( self ) : return self . idref <EOL> def set_idref ( self , idref ) : self . idref = idref <EOL> def get_id ( self ) : return self . id <EOL> def set_id ( self , id ) : self . id = id <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Type or <EOL> self . Name or <EOL> self . Title is not None or <EOL> self . Description or <EOL> self . Short_Description <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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>' % ( nsmap [ 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> , nsmap , XML_NS , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ 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> if self . idref is not None and '<STR_LIT>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT>' ) <EOL> lwrite ( '<STR_LIT>' % ( quote_attrib ( self . idref ) , ) ) <EOL> if self . id is not None and '<STR_LIT:id>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT:id>' ) <EOL> lwrite ( '<STR_LIT>' % ( quote_attrib ( self . id ) , ) ) <EOL> def exportChildren ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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 Type_ in self . Type : <EOL> Type_ . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> for Name_ in self . Name : <EOL> Name_ . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT:Name>' , pretty_print = pretty_print ) <EOL> if self . Title is not None : <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ namespace_ ] , quote_xml ( self . Title ) , nsmap [ namespace_ ] , eol_ ) ) <EOL> for Description in self . Description : <EOL> Description . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> for Short_Description in self . Short_Description : <EOL> Short_Description . export ( lwrite , level , nsmap , namespace_ , 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> value = find_attr_value_ ( '<STR_LIT>' , node ) <EOL> if value is not None and '<STR_LIT>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT>' ) <EOL> self . idref = value <EOL> value = find_attr_value_ ( '<STR_LIT:id>' , node ) <EOL> if value is not None and '<STR_LIT:id>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT:id>' ) <EOL> self . id = value <EOL> def buildChildren ( self , child_ , node , nodeName_ , fromsubclass_ = False ) : <EOL> if nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . ControlledVocabularyStringType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . Type . append ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT:Name>' : <EOL> obj_ = stix_common_binding . ControlledVocabularyStringType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . Name . append ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> Title_ = child_ . text <EOL> Title_ = self . gds_validate_string ( Title_ , node , '<STR_LIT>' ) <EOL> self . Title = Title_ <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . StructuredTextType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . add_Description ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . StructuredTextType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . add_Short_Description ( obj_ ) <EOL> class ExploitType ( GeneratedsSuper ) : <EOL> """<STR_LIT>""" <EOL> subclass = None <EOL> superclass = None <EOL> def __init__ ( self , idref = None , id = None , Title = None , Description = None , Short_Description = None ) : <EOL> self . idref = _cast ( None , idref ) <EOL> self . id = _cast ( None , id ) <EOL> self . Title = Title <EOL> if Description is None : <EOL> self . Description = [ ] <EOL> else : <EOL> self . Description = Description <EOL> if Short_Description is None : <EOL> self . Short_Description = [ ] <EOL> else : <EOL> self . Short_Description = Short_Description <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if ExploitType . subclass : <EOL> return ExploitType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return ExploitType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Title ( self ) : return self . Title <EOL> def set_Title ( self , Title ) : self . Title = Title <EOL> def insert_Description ( self , index , value ) : self . Description [ index ] = value <EOL> def add_Description ( self , Description ) : self . Description . append ( Description ) <EOL> def get_Description ( self ) : return self . Description <EOL> def set_Description ( self , Description ) : self . Description = Description <EOL> def insert_Short_Description ( self , index , value ) : self . Short_Description [ index ] = value <EOL> def add_Short_Description ( self , Short_Description ) : self . Short_Description . append ( Short_Description ) <EOL> def get_Short_Description ( self ) : return self . Short_Description <EOL> def set_Short_Description ( self , Short_Description ) : self . Short_Description = Short_Description <EOL> def get_idref ( self ) : return self . idref <EOL> def set_idref ( self , idref ) : self . idref = idref <EOL> def get_id ( self ) : return self . id <EOL> def set_id ( self , id ) : self . id = id <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Title is not None or <EOL> self . Description or <EOL> self . Short_Description <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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>' % ( nsmap [ 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> , nsmap , XML_NS , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ 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> if self . idref is not None and '<STR_LIT>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT>' ) <EOL> lwrite ( '<STR_LIT>' % ( quote_attrib ( self . idref ) , ) ) <EOL> if self . id is not None and '<STR_LIT:id>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT:id>' ) <EOL> lwrite ( '<STR_LIT>' % ( quote_attrib ( self . id ) , ) ) <EOL> def exportChildren ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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 . Title is not None : <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ namespace_ ] , quote_xml ( self . Title ) , nsmap [ namespace_ ] , eol_ ) ) <EOL> for Description in self . Description : <EOL> Description . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> for Short_Description in self . Short_Description : <EOL> Short_Description . export ( lwrite , level , nsmap , namespace_ , 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> value = find_attr_value_ ( '<STR_LIT>' , node ) <EOL> if value is not None and '<STR_LIT>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT>' ) <EOL> self . idref = value <EOL> value = find_attr_value_ ( '<STR_LIT:id>' , node ) <EOL> if value is not None and '<STR_LIT:id>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT:id>' ) <EOL> self . id = value <EOL> def buildChildren ( self , child_ , node , nodeName_ , fromsubclass_ = False ) : <EOL> if nodeName_ == '<STR_LIT>' : <EOL> Title_ = child_ . text <EOL> Title_ = self . gds_validate_string ( Title_ , node , '<STR_LIT>' ) <EOL> self . Title = Title_ <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . StructuredTextType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . add_Description ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . StructuredTextType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . add_Short_Description ( obj_ ) <EOL> class InfrastructureType ( GeneratedsSuper ) : <EOL> """<STR_LIT>""" <EOL> subclass = None <EOL> superclass = None <EOL> def __init__ ( self , idref = None , id = None , Title = None , Type = None , Description = None , Short_Description = None , Observable_Characterization = None ) : <EOL> self . idref = _cast ( None , idref ) <EOL> self . id = _cast ( None , id ) <EOL> self . Title = Title <EOL> if Type is None : <EOL> self . Type = [ ] <EOL> else : <EOL> self . Type = Type <EOL> if Description is None : <EOL> self . Description = [ ] <EOL> else : <EOL> self . Description = Description <EOL> if Short_Description is None : <EOL> self . Short_Description = [ ] <EOL> else : <EOL> self . Short_Description = Short_Description <EOL> self . Observable_Characterization = Observable_Characterization <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if InfrastructureType . subclass : <EOL> return InfrastructureType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return InfrastructureType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Title ( self ) : return self . Title <EOL> def set_Title ( self , Title ) : self . Title = Title <EOL> def get_Type ( self ) : return self . Type <EOL> def set_Type ( self , Type ) : self . Type = Type <EOL> def add_Type ( self , value ) : self . Type . append ( value ) <EOL> def insert_Type ( self , index , value ) : self . Type [ index ] = value <EOL> def insert_Description ( self , index , value ) : self . Description [ index ] = value <EOL> def add_Description ( self , Description ) : self . Description . append ( Description ) <EOL> def get_Description ( self ) : return self . Description <EOL> def set_Description ( self , Description ) : self . Description = Description <EOL> def insert_Short_Description ( self , index , value ) : self . Short_Description [ index ] = value <EOL> def add_Short_Description ( self , Short_Description ) : self . Short_Description . append ( Short_Description ) <EOL> def get_Short_Description ( self ) : return self . Short_Description <EOL> def set_Short_Description ( self , Short_Description ) : self . Short_Description = Short_Description <EOL> def get_Observable_Characterization ( self ) : return self . Observable_Characterization <EOL> def set_Observable_Characterization ( self , Observable_Characterization ) : self . Observable_Characterization = Observable_Characterization <EOL> def get_idref ( self ) : return self . idref <EOL> def set_idref ( self , idref ) : self . idref = idref <EOL> def get_id ( self ) : return self . id <EOL> def set_id ( self , id ) : self . id = id <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Title is not None or <EOL> self . Type or <EOL> self . Description is not None or <EOL> self . Short_Description is not None or <EOL> self . Observable_Characterization is not None <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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>' % ( nsmap [ 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> , nsmap , XML_NS , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ 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> if self . idref is not None and '<STR_LIT>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT>' ) <EOL> lwrite ( '<STR_LIT>' % ( quote_attrib ( self . idref ) , ) ) <EOL> if self . id is not None and '<STR_LIT:id>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT:id>' ) <EOL> lwrite ( '<STR_LIT>' % ( quote_attrib ( self . id ) , ) ) <EOL> def exportChildren ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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 . Title is not None : <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ namespace_ ] , quote_xml ( self . Title ) , nsmap [ namespace_ ] , eol_ ) ) <EOL> for Type_ in self . Type : <EOL> Type_ . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> for Description in self . Description : <EOL> Description . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> for Short_Description in self . Short_Description : <EOL> Short_Description . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Observable_Characterization is not None : <EOL> self . Observable_Characterization . export ( lwrite , level , "<STR_LIT>" % ( nsmap [ namespace_ ] ) , 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> value = find_attr_value_ ( '<STR_LIT>' , node ) <EOL> if value is not None and '<STR_LIT>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT>' ) <EOL> self . idref = value <EOL> value = find_attr_value_ ( '<STR_LIT:id>' , node ) <EOL> if value is not None and '<STR_LIT:id>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT:id>' ) <EOL> self . id = value <EOL> def buildChildren ( self , child_ , node , nodeName_ , fromsubclass_ = False ) : <EOL> if nodeName_ == '<STR_LIT>' : <EOL> Title_ = child_ . text <EOL> Title_ = self . gds_validate_string ( Title_ , node , '<STR_LIT>' ) <EOL> self . Title = Title_ <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . ControlledVocabularyStringType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . Type . append ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . StructuredTextType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . add_Description ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . StructuredTextType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . add_Short_Description ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = cybox_core_binding . ObservablesType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Observable_Characterization ( obj_ ) <EOL> class ToolsType ( GeneratedsSuper ) : <EOL> subclass = None <EOL> superclass = None <EOL> def __init__ ( self , Tool = None ) : <EOL> if Tool is None : <EOL> self . Tool = [ ] <EOL> else : <EOL> self . Tool = Tool <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if ToolsType . subclass : <EOL> return ToolsType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return ToolsType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Tool ( self ) : return self . Tool <EOL> def set_Tool ( self , Tool ) : self . Tool = Tool <EOL> def add_Tool ( self , value ) : self . Tool . append ( value ) <EOL> def insert_Tool ( self , index , value ) : self . Tool [ index ] = value <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Tool <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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>' % ( nsmap [ 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> , nsmap , XML_NS , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ 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 , nsmap , namespace_ = XML_NS , 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 Tool_ in self . Tool : <EOL> Tool_ . export ( lwrite , level , nsmap , namespace_ , 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_ = stix_common_binding . ToolInformationType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . Tool . append ( obj_ ) <EOL> class ExploitsType ( GeneratedsSuper ) : <EOL> subclass = None <EOL> superclass = None <EOL> def __init__ ( self , Exploit = None ) : <EOL> if Exploit is None : <EOL> self . Exploit = [ ] <EOL> else : <EOL> self . Exploit = Exploit <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if ExploitsType . subclass : <EOL> return ExploitsType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return ExploitsType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Exploit ( self ) : return self . Exploit <EOL> def set_Exploit ( self , Exploit ) : self . Exploit = Exploit <EOL> def add_Exploit ( self , value ) : self . Exploit . append ( value ) <EOL> def insert_Exploit ( self , index , value ) : self . Exploit [ index ] = value <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Exploit <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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>' % ( nsmap [ 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> , nsmap , XML_NS , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ 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 , nsmap , namespace_ = XML_NS , 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 Exploit_ in self . Exploit : <EOL> Exploit_ . export ( lwrite , level , nsmap , namespace_ , 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_ = ExploitType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . Exploit . append ( obj_ ) <EOL> class MalwareType ( GeneratedsSuper ) : <EOL> subclass = None <EOL> superclass = None <EOL> def __init__ ( self , Malware_Instance = None ) : <EOL> if Malware_Instance is None : <EOL> self . Malware_Instance = [ ] <EOL> else : <EOL> self . Malware_Instance = Malware_Instance <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if MalwareType . subclass : <EOL> return MalwareType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return MalwareType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Malware_Instance ( self ) : return self . Malware_Instance <EOL> def set_Malware_Instance ( self , Malware_Instance ) : self . Malware_Instance = Malware_Instance <EOL> def add_Malware_Instance ( self , value ) : self . Malware_Instance . append ( value ) <EOL> def insert_Malware_Instance ( self , index , value ) : self . Malware_Instance [ index ] = value <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Malware_Instance <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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>' % ( nsmap [ 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> , nsmap , XML_NS , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ 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 , nsmap , namespace_ = XML_NS , 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 Malware_Instance_ in self . Malware_Instance : <EOL> Malware_Instance_ . export ( lwrite , level , nsmap , namespace_ , 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> from . extensions . malware import maec_4_1 <EOL> obj_ = lookup_extension ( child_ , MalwareInstanceType ) . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . Malware_Instance . append ( obj_ ) <EOL> class AttackPatternsType ( GeneratedsSuper ) : <EOL> subclass = None <EOL> superclass = None <EOL> def __init__ ( self , Attack_Pattern = None ) : <EOL> if Attack_Pattern is None : <EOL> self . Attack_Pattern = [ ] <EOL> else : <EOL> self . Attack_Pattern = Attack_Pattern <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if AttackPatternsType . subclass : <EOL> return AttackPatternsType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return AttackPatternsType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Attack_Pattern ( self ) : return self . Attack_Pattern <EOL> def set_Attack_Pattern ( self , Attack_Pattern ) : self . Attack_Pattern = Attack_Pattern <EOL> def add_Attack_Pattern ( self , value ) : self . Attack_Pattern . append ( value ) <EOL> def insert_Attack_Pattern ( self , index , value ) : self . Attack_Pattern [ index ] = value <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Attack_Pattern <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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>' % ( nsmap [ 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> , nsmap , XML_NS , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ 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 , nsmap , namespace_ = XML_NS , 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 Attack_Pattern_ in self . Attack_Pattern : <EOL> Attack_Pattern_ . export ( lwrite , level , nsmap , namespace_ , 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> from . extensions . attack_pattern import capec_2_7 <EOL> obj_ = lookup_extension ( child_ , AttackPatternType ) . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . Attack_Pattern . append ( obj_ ) <EOL> class ResourceType ( GeneratedsSuper ) : <EOL> subclass = None <EOL> superclass = None <EOL> def __init__ ( self , Tools = None , Infrastructure = None , Personas = None ) : <EOL> self . Tools = Tools <EOL> self . Infrastructure = Infrastructure <EOL> self . Personas = Personas <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if ResourceType . subclass : <EOL> return ResourceType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return ResourceType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Tools ( self ) : return self . Tools <EOL> def set_Tools ( self , Tools ) : self . Tools = Tools <EOL> def get_Infrastructure ( self ) : return self . Infrastructure <EOL> def set_Infrastructure ( self , Infrastructure ) : self . Infrastructure = Infrastructure <EOL> def get_Personas ( self ) : return self . Personas <EOL> def set_Personas ( self , Personas ) : self . Personas = Personas <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Tools is not None or <EOL> self . Infrastructure is not None or <EOL> self . Personas is not None <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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>' % ( nsmap [ 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> , nsmap , XML_NS , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ 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 , nsmap , namespace_ = XML_NS , 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 . Tools is not None : <EOL> self . Tools . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Infrastructure is not None : <EOL> self . Infrastructure . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Personas is not None : <EOL> self . Personas . export ( lwrite , level , nsmap , namespace_ , 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_ = ToolsType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Tools ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = InfrastructureType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Infrastructure ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = PersonasType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Personas ( obj_ ) <EOL> class PersonasType ( GeneratedsSuper ) : <EOL> subclass = None <EOL> superclass = None <EOL> def __init__ ( self , Persona = None ) : <EOL> if Persona is None : <EOL> self . Persona = [ ] <EOL> else : <EOL> self . Persona = Persona <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if PersonasType . subclass : <EOL> return PersonasType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return PersonasType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Persona ( self ) : return self . Persona <EOL> def set_Persona ( self , Persona ) : self . Persona = Persona <EOL> def add_Persona ( self , value ) : self . Persona . append ( value ) <EOL> def insert_Persona ( self , index , value ) : self . Persona [ index ] = value <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Persona <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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>' % ( nsmap [ 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> , nsmap , XML_NS , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ 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 , nsmap , namespace_ = XML_NS , 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 Persona_ in self . Persona : <EOL> Persona_ . export ( lwrite , level , nsmap , namespace_ , 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> from . extensions . identity import ciq_identity_3_0 <EOL> obj_ = lookup_extension ( child_ , stix_common_binding . IdentityType ) . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . Persona . append ( obj_ ) <EOL> class BehaviorType ( GeneratedsSuper ) : <EOL> subclass = None <EOL> superclass = None <EOL> def __init__ ( self , Attack_Patterns = None , Malware = None , Exploits = None ) : <EOL> self . Attack_Patterns = Attack_Patterns <EOL> self . Malware = Malware <EOL> self . Exploits = Exploits <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if BehaviorType . subclass : <EOL> return BehaviorType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return BehaviorType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Attack_Patterns ( self ) : return self . Attack_Patterns <EOL> def set_Attack_Patterns ( self , Attack_Patterns ) : self . Attack_Patterns = Attack_Patterns <EOL> def get_Malware ( self ) : return self . Malware <EOL> def set_Malware ( self , Malware ) : self . Malware = Malware <EOL> def get_Exploits ( self ) : return self . Exploits <EOL> def set_Exploits ( self , Exploits ) : self . Exploits = Exploits <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Attack_Patterns is not None or <EOL> self . Malware is not None or <EOL> self . Exploits is not None <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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>' % ( nsmap [ 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> , nsmap , XML_NS , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ 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 , nsmap , namespace_ = XML_NS , 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 . Attack_Patterns is not None : <EOL> self . Attack_Patterns . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Malware is not None : <EOL> self . Malware . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Exploits is not None : <EOL> self . Exploits . export ( lwrite , level , nsmap , namespace_ , 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_ = AttackPatternsType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Attack_Patterns ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = MalwareType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Malware ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = ExploitsType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Exploits ( obj_ ) <EOL> class VictimTargetingType ( GeneratedsSuper ) : <EOL> subclass = None <EOL> superclass = None <EOL> def __init__ ( self , Identity = None , Targeted_Systems = None , Targeted_Information = None , Targeted_Technical_Details = None ) : <EOL> self . Identity = Identity <EOL> if Targeted_Systems is None : <EOL> self . Targeted_Systems = [ ] <EOL> else : <EOL> self . Targeted_Systems = Targeted_Systems <EOL> if Targeted_Information is None : <EOL> self . Targeted_Information = [ ] <EOL> else : <EOL> self . Targeted_Information = Targeted_Information <EOL> self . Targeted_Technical_Details = Targeted_Technical_Details <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if VictimTargetingType . subclass : <EOL> return VictimTargetingType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return VictimTargetingType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Identity ( self ) : return self . Identity <EOL> def set_Identity ( self , Identity ) : self . Identity = Identity <EOL> def get_Targeted_Systems ( self ) : return self . Targeted_Systems <EOL> def set_Targeted_Systems ( self , Targeted_Systems ) : self . Targeted_Systems = Targeted_Systems <EOL> def add_Targeted_Systems ( self , value ) : self . Targeted_Systems . append ( value ) <EOL> def insert_Targeted_Systems ( self , index , value ) : self . Targeted_Systems [ index ] = value <EOL> def get_Targeted_Information ( self ) : return self . Targeted_Information <EOL> def set_Targeted_Information ( self , Targeted_Information ) : self . Targeted_Information = Targeted_Information <EOL> def add_Targeted_Information ( self , value ) : self . Targeted_Information . append ( value ) <EOL> def insert_Targeted_Information ( self , index , value ) : self . Targeted_Information [ index ] = value <EOL> def get_Targeted_Technical_Details ( self ) : return self . Targeted_Technical_Details <EOL> def set_Targeted_Technical_Details ( self , Targeted_Technical_Details ) : self . Targeted_Technical_Details = Targeted_Technical_Details <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Identity is not None or <EOL> self . Targeted_Systems or <EOL> self . Targeted_Information or <EOL> self . Targeted_Technical_Details is not None <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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>' % ( nsmap [ 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> , nsmap , XML_NS , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ 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 , nsmap , namespace_ = XML_NS , 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 . Identity is not None : <EOL> self . Identity . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> for Targeted_Systems_ in self . Targeted_Systems : <EOL> Targeted_Systems_ . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> for Targeted_Information_ in self . Targeted_Information : <EOL> Targeted_Information_ . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Targeted_Technical_Details is not None : <EOL> self . Targeted_Technical_Details . export ( lwrite , level , "<STR_LIT>" % ( nsmap [ namespace_ ] ) , 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> from . extensions . identity import ciq_identity_3_0 <EOL> obj_ = lookup_extension ( child_ , stix_common_binding . IdentityType ) . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Identity ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . ControlledVocabularyStringType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . Targeted_Systems . append ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . ControlledVocabularyStringType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . Targeted_Information . append ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = cybox_core_binding . ObservablesType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Targeted_Technical_Details ( obj_ ) <EOL> class RelatedTTPsType ( stix_common_binding . GenericRelationshipListType ) : <EOL> subclass = None <EOL> superclass = stix_common_binding . GenericRelationshipListType <EOL> def __init__ ( self , scope = '<STR_LIT>' , Related_TTP = None ) : <EOL> super ( RelatedTTPsType , self ) . __init__ ( scope = scope ) <EOL> if Related_TTP is None : <EOL> self . Related_TTP = [ ] <EOL> else : <EOL> self . Related_TTP = Related_TTP <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if RelatedTTPsType . subclass : <EOL> return RelatedTTPsType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return RelatedTTPsType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Related_TTP ( self ) : return self . Related_TTP <EOL> def set_Related_TTP ( self , Related_TTP ) : self . Related_TTP = Related_TTP <EOL> def add_Related_TTP ( self , value ) : self . Related_TTP . append ( value ) <EOL> def insert_Related_TTP ( self , index , value ) : self . Related_TTP [ index ] = value <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Related_TTP or <EOL> super ( RelatedTTPsType , self ) . hasContent_ ( ) <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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>' % ( nsmap [ 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> , nsmap , XML_NS , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ 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 ( RelatedTTPsType , self ) . exportAttributes ( lwrite , level , already_processed , namespace_ , name_ = '<STR_LIT>' ) <EOL> def exportChildren ( self , lwrite , level , nsmap , namespace_ = XML_NS , name_ = '<STR_LIT>' , fromsubclass_ = False , pretty_print = True ) : <EOL> super ( RelatedTTPsType , self ) . exportChildren ( lwrite , level , nsmap , namespace_ , name_ , True , pretty_print = pretty_print ) <EOL> if pretty_print : <EOL> eol_ = '<STR_LIT:\n>' <EOL> else : <EOL> eol_ = '<STR_LIT>' <EOL> for Related_TTP_ in self . Related_TTP : <EOL> Related_TTP_ . export ( lwrite , level , nsmap , namespace_ , 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 ( RelatedTTPsType , self ) . buildAttributes ( node , attrs , already_processed ) <EOL> def buildChildren ( self , child_ , node , nodeName_ , fromsubclass_ = False ) : <EOL> if nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . RelatedTTPType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . Related_TTP . append ( obj_ ) <EOL> super ( RelatedTTPsType , self ) . buildChildren ( child_ , node , nodeName_ , True ) <EOL> @ register_extension <EOL> class TTPType ( stix_common_binding . TTPBaseType ) : <EOL> """<STR_LIT>""" <EOL> subclass = None <EOL> superclass = stix_common_binding . TTPBaseType <EOL> xmlns = "<STR_LIT>" <EOL> xmlns_prefix = "<STR_LIT>" <EOL> xml_type = "<STR_LIT>" <EOL> def __init__ ( self , idref = None , id = None , timestamp = None , version = None , Title = None , Description = None , Short_Description = None , Intended_Effect = None , Behavior = None , Resources = None , Victim_Targeting = None , Exploit_Targets = None , Related_TTPs = None , Kill_Chain_Phases = None , Information_Source = None , Kill_Chains = None , Handling = None , Related_Packages = None ) : <EOL> super ( TTPType , self ) . __init__ ( idref = idref , id = id , timestamp = timestamp ) <EOL> self . version = _cast ( None , version ) <EOL> self . Title = Title <EOL> if Description is None : <EOL> self . Description = [ ] <EOL> else : <EOL> self . Description = Description <EOL> if Short_Description is None : <EOL> self . Short_Description = [ ] <EOL> else : <EOL> self . Short_Description = Short_Description <EOL> if Intended_Effect is None : <EOL> self . Intended_Effect = [ ] <EOL> else : <EOL> self . Intended_Effect = Intended_Effect <EOL> self . Behavior = Behavior <EOL> self . Resources = Resources <EOL> self . Victim_Targeting = Victim_Targeting <EOL> self . Exploit_Targets = Exploit_Targets <EOL> self . Related_TTPs = Related_TTPs <EOL> self . Kill_Chain_Phases = Kill_Chain_Phases <EOL> self . Information_Source = Information_Source <EOL> self . Kill_Chains = Kill_Chains <EOL> self . Handling = Handling <EOL> self . Related_Packages = Related_Packages <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if TTPType . subclass : <EOL> return TTPType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return TTPType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Title ( self ) : return self . Title <EOL> def set_Title ( self , Title ) : self . Title = Title <EOL> def insert_Description ( self , index , value ) : self . Description [ index ] = value <EOL> def add_Description ( self , Description ) : self . Description . append ( Description ) <EOL> def get_Description ( self ) : return self . Description <EOL> def set_Description ( self , Description ) : self . Description = Description <EOL> def insert_Short_Description ( self , index , value ) : self . Short_Description [ index ] = value <EOL> def add_Short_Description ( self , Short_Description ) : self . Short_Description . append ( Short_Description ) <EOL> def get_Short_Description ( self ) : return self . Short_Description <EOL> def set_Short_Description ( self , Short_Description ) : self . Short_Description = Short_Description <EOL> def get_Intended_Effect ( self ) : return self . Intended_Effect <EOL> def set_Intended_Effect ( self , Intended_Effect ) : self . Intended_Effect = Intended_Effect <EOL> def add_Intended_Effect ( self , value ) : self . Intended_Effect . append ( value ) <EOL> def insert_Intended_Effect ( self , index , value ) : self . Intended_Effect [ index ] = value <EOL> def get_Behavior ( self ) : return self . Behavior <EOL> def set_Behavior ( self , Behavior ) : self . Behavior = Behavior <EOL> def get_Resources ( self ) : return self . Resources <EOL> def set_Resources ( self , Resources ) : self . Resources = Resources <EOL> def get_Victim_Targeting ( self ) : return self . Victim_Targeting <EOL> def set_Victim_Targeting ( self , Victim_Targeting ) : self . Victim_Targeting = Victim_Targeting <EOL> def get_Exploit_Targets ( self ) : return self . Exploit_Targets <EOL> def set_Exploit_Targets ( self , Exploit_Targets ) : self . Exploit_Targets = Exploit_Targets <EOL> def get_Related_TTPs ( self ) : return self . Related_TTPs <EOL> def set_Related_TTPs ( self , Related_TTPs ) : self . Related_TTPs = Related_TTPs <EOL> def get_Kill_Chain_Phases ( self ) : return self . Kill_Chain_Phases <EOL> def set_Kill_Chain_Phases ( self , Kill_Chain_Phases ) : self . Kill_Chain_Phases = Kill_Chain_Phases <EOL> def get_Information_Source ( self ) : return self . Information_Source <EOL> def set_Information_Source ( self , Information_Source ) : self . Information_Source = Information_Source <EOL> def get_Kill_Chains ( self ) : return self . Kill_Chains <EOL> def set_Kill_Chains ( self , Kill_Chains ) : self . Kill_Chains = Kill_Chains <EOL> def get_Handling ( self ) : return self . Handling <EOL> def set_Handling ( self , Handling ) : self . Handling = Handling <EOL> def get_Related_Packages ( self ) : return self . Related_Packages <EOL> def set_Related_Packages ( self , Related_Packages ) : self . Related_Packages = Related_Packages <EOL> def get_version ( self ) : return self . version <EOL> def set_version ( self , version ) : self . version = version <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Title is not None or <EOL> self . Description or <EOL> self . Short_Description or <EOL> self . Intended_Effect or <EOL> self . Behavior is not None or <EOL> self . Resources is not None or <EOL> self . Victim_Targeting is not None or <EOL> self . Exploit_Targets is not None or <EOL> self . Related_TTPs is not None or <EOL> self . Kill_Chain_Phases is not None or <EOL> self . Information_Source is not None or <EOL> self . Kill_Chains is not None or <EOL> self . Handling is not None or <EOL> self . Related_Packages is not None or <EOL> super ( TTPType , self ) . hasContent_ ( ) <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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>' % ( nsmap [ 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> , nsmap , XML_NS , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ 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 ( TTPType , self ) . exportAttributes ( lwrite , level , already_processed , namespace_ , name_ = '<STR_LIT>' ) <EOL> if '<STR_LIT>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT>' ) <EOL> xsi_type = "<STR_LIT>" % ( self . xmlns_prefix , self . xml_type ) <EOL> lwrite ( xsi_type ) <EOL> if self . version is not None and '<STR_LIT:version>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT:version>' ) <EOL> lwrite ( '<STR_LIT>' % ( quote_attrib ( self . version ) , ) ) <EOL> def exportChildren ( self , lwrite , level , nsmap , namespace_ = XML_NS , name_ = '<STR_LIT>' , fromsubclass_ = False , pretty_print = True ) : <EOL> super ( TTPType , self ) . exportChildren ( lwrite , level , nsmap , namespace_ , name_ , True , pretty_print = pretty_print ) <EOL> if pretty_print : <EOL> eol_ = '<STR_LIT:\n>' <EOL> else : <EOL> eol_ = '<STR_LIT>' <EOL> if self . Title is not None : <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ namespace_ ] , quote_xml ( self . Title ) , nsmap [ namespace_ ] , eol_ ) ) <EOL> for Description in self . Description : <EOL> Description . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> for Short_Description in self . Short_Description : <EOL> Short_Description . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> for Intended_Effect_ in self . Intended_Effect : <EOL> Intended_Effect_ . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Behavior is not None : <EOL> self . Behavior . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Resources is not None : <EOL> self . Resources . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Victim_Targeting is not None : <EOL> self . Victim_Targeting . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Exploit_Targets is not None : <EOL> self . Exploit_Targets . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Related_TTPs is not None : <EOL> self . Related_TTPs . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Kill_Chain_Phases is not None : <EOL> self . Kill_Chain_Phases . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Information_Source is not None : <EOL> self . Information_Source . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Kill_Chains is not None : <EOL> self . Kill_Chains . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Handling is not None : <EOL> self . Handling . export ( lwrite , level , nsmap , namespace_ , name_ = '<STR_LIT>' , pretty_print = pretty_print ) <EOL> if self . Related_Packages is not None : <EOL> self . Related_Packages . export ( lwrite , level , nsmap , namespace_ , 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> value = find_attr_value_ ( '<STR_LIT:version>' , node ) <EOL> if value is not None and '<STR_LIT:version>' not in already_processed : <EOL> already_processed . add ( '<STR_LIT:version>' ) <EOL> self . version = value <EOL> super ( TTPType , self ) . buildAttributes ( node , attrs , already_processed ) <EOL> def buildChildren ( self , child_ , node , nodeName_ , fromsubclass_ = False ) : <EOL> if nodeName_ == '<STR_LIT>' : <EOL> Title_ = child_ . text <EOL> Title_ = self . gds_validate_string ( Title_ , node , '<STR_LIT>' ) <EOL> self . Title = Title_ <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . StructuredTextType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . add_Description ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . StructuredTextType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . add_Short_Description ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . StatementType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . Intended_Effect . append ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = BehaviorType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Behavior ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = ResourceType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Resources ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = VictimTargetingType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Victim_Targeting ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = ExploitTargetsType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Exploit_Targets ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = RelatedTTPsType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Related_TTPs ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . KillChainPhasesReferenceType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Kill_Chain_Phases ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . InformationSourceType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Information_Source ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . KillChainsType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Kill_Chains ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = data_marking_binding . MarkingType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Handling ( obj_ ) <EOL> elif nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . RelatedPackageRefsType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . set_Related_Packages ( obj_ ) <EOL> super ( TTPType , self ) . buildChildren ( child_ , node , nodeName_ , True ) <EOL> class ExploitTargetsType ( stix_common_binding . GenericRelationshipListType ) : <EOL> subclass = None <EOL> superclass = stix_common_binding . GenericRelationshipListType <EOL> def __init__ ( self , Exploit_Target = None , scope = None ) : <EOL> super ( ExploitTargetsType , self ) . __init__ ( scope = scope ) <EOL> if Exploit_Target is None : <EOL> self . Exploit_Target = [ ] <EOL> else : <EOL> self . Exploit_Target = Exploit_Target <EOL> def factory ( * args_ , ** kwargs_ ) : <EOL> if ExploitTargetsType . subclass : <EOL> return ExploitTargetsType . subclass ( * args_ , ** kwargs_ ) <EOL> else : <EOL> return ExploitTargetsType ( * args_ , ** kwargs_ ) <EOL> factory = staticmethod ( factory ) <EOL> def get_Exploit_Target ( self ) : return self . Exploit_Target <EOL> def set_Exploit_Target ( self , Exploit_Target ) : self . Exploit_Target = Exploit_Target <EOL> def add_Exploit_Target ( self , value ) : self . Exploit_Target . append ( value ) <EOL> def insert_Exploit_Target ( self , index , value ) : self . Exploit_Target [ index ] = value <EOL> def hasContent_ ( self ) : <EOL> if ( <EOL> self . Exploit_Target or <EOL> super ( ExploitTargetsType , self ) . hasContent ( ) <EOL> ) : <EOL> return True <EOL> else : <EOL> return False <EOL> def export ( self , lwrite , level , nsmap , namespace_ = XML_NS , 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>' % ( nsmap [ 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> , nsmap , XML_NS , name_ , pretty_print = pretty_print ) <EOL> showIndent ( lwrite , level , pretty_print ) <EOL> lwrite ( '<STR_LIT>' % ( nsmap [ 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 ( ExploitTargetsType , self ) . exportAttributes ( lwrite , level , already_processed , namespace_ , name_ ) <EOL> pass <EOL> def exportChildren ( self , lwrite , level , nsmap , namespace_ = XML_NS , name_ = '<STR_LIT>' , fromsubclass_ = False , pretty_print = True ) : <EOL> super ( ExploitTargetsType , self ) . exportChildren ( lwrite , level , nsmap , namespace_ , name_ , fromsubclass_ = True , pretty_print = pretty_print ) <EOL> if pretty_print : <EOL> eol_ = '<STR_LIT:\n>' <EOL> else : <EOL> eol_ = '<STR_LIT>' <EOL> for Exploit_Target_ in self . Exploit_Target : <EOL> Exploit_Target_ . export ( lwrite , level , nsmap , namespace_ , 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 ( ExploitTargetsType , self ) . buildAttributes ( node , attrs , already_processed ) <EOL> pass <EOL> def buildChildren ( self , child_ , node , nodeName_ , fromsubclass_ = False ) : <EOL> if nodeName_ == '<STR_LIT>' : <EOL> obj_ = stix_common_binding . RelatedExploitTargetType . factory ( ) <EOL> obj_ . build ( child_ ) <EOL> self . Exploit_Target . append ( obj_ ) <EOL> GDSClassesMapping = { } <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 = TTPType <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 = TTPType <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 StringIO 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 = TTPType <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> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] </s>
