Example #1
0
    def create_from_dict(cls, uri_attributes):
        uriobject = cybox_uri_object.URIObjectType()
        uriobject.set_anyAttributes_({'xsi:type': 'URIObj:URIObjectType'})

        for key, value in uri_attributes.items():
            if key == 'type' and common_methods.test_value(value):
                uriobject.set_type(value)
            elif key == 'value' and common_methods.test_value(value):
                uriobject.set_Value(
                    cybox_common.AnyURIObjectAttributeType(
                        datatype='AnyURI',
                        valueOf_=cybox_common.quote_xml(value)))

        return uriobject
Example #2
0
 def create_from_dict(cls, uri_attributes):
     uriobject = cybox_uri_object.URIObjectType()
     uriobject.set_anyAttributes_({'xsi:type' : 'URIObj:URIObjectType'})
     
     for key, value in uri_attributes.items():
         if key == 'type' and common_methods.test_value(value):
             uriobject.set_type(value)
         elif key == 'value' and common_methods.test_value(value):
             uriobject.set_Value(cybox_common.AnyURIObjectAttributeType(datatype='AnyURI', valueOf_=cybox_common.quote_xml(value)))
     
     return uriobject
Example #3
0
 def create_from_dict(cls, address_attributes):
     addrobject = cybox_address_object.AddressObjectType()
     addrobject.set_anyAttributes_({'xsi:type' : 'AddressObj:AddressObjectType'})
     
     for key, value in address_attributes.items():
         if key == 'category' and common_methods.test_value(value):
             addrobject.set_category(value)
         elif key == 'ext_category' and common_methods.test_value(value):
             addrobject.set_Ext_Category(value)
         elif key == 'vlan_name' and common_methods.test_value(value):
             addrobject.set_VLAN_Name(cybox_common.StringObjectAttributeType(datatype='String', valueOf_=cybox_common.quote_xml(value)))
         elif key == 'vlan_num' and common_methods.test_value(value):
             addrobject.set_VLAN_Num(cybox_common.IntegerObjectAttributeType(datatype='Integer', valueOf_=cybox_common.quote_xml(value)))
         elif key == 'is_source' and common_methods.test_value(value):
             addrobject.set_is_source(value)
         elif key == 'is_destination' and common_methods.test_value(value):
             addrobject.set_is_destination(value)
         elif key == 'address_value' and common_methods.test_value(value):
             addrobject.set_Address_Value(cybox_common.StringObjectAttributeType(datatype='String', valueOf_=cybox_common.quote_xml(value)))
     return addrobject