diff --git a/cybox/__init__.py b/cybox/__init__.py index 4bab20a6..7c11ead8 100644 --- a/cybox/__init__.py +++ b/cybox/__init__.py @@ -4,7 +4,8 @@ import collections import inspect import json -from StringIO import StringIO + +from .compat import StringIO, basestring, str import cybox.bindings as bindings import cybox.utils.idgen @@ -131,13 +132,13 @@ def to_obj(self, return_obj=None, ns_info=None): entity_obj = self._binding_class() - vars = {} + members = {} for klass in self.__class__.__mro__: if klass is Entity: break - vars.update(klass.__dict__.iteritems()) + members.update(vars(klass)) - for name, field in vars.iteritems(): + for name, field in members.items(): if isinstance(field, TypedField): val = getattr(self, field.attr_name) @@ -170,13 +171,13 @@ def to_dict(self): Python dict with keys set from this Entity. """ entity_dict = {} - vars = {} + members = {} for klass in self.__class__.__mro__: if klass is Entity: break - vars.update(klass.__dict__.iteritems()) + members.update(vars(klass)) - for name, field in vars.iteritems(): + for name, field in members.items(): if isinstance(field, TypedField): val = getattr(self, field.attr_name) @@ -299,7 +300,7 @@ def to_xml(self, include_namespaces=True, namespace_dict=None, pretty_print=pretty ) - s = unicode(sio.getvalue()).strip() + s = str(sio.getvalue()).strip() if encoding: return s.encode(encoding) @@ -368,7 +369,12 @@ def _get_namespaces(self, recurse=True): def _get_children(self): #TODO: eventually everything should be in _fields, not the top level # of vars() - for k, v in vars(self).items() + self._fields.items(): + + members = {} + members.update(vars(self)) + members.update(self._fields) + + for k, v in members.items(): if isinstance(v, Entity): yield v elif isinstance(v, list): @@ -411,7 +417,7 @@ def value(self): @value.setter def value(self, value): - self._value = unicode(value) + self._value = str(value) def to_obj(self, return_obj=None, ns_info=None): self._collect_ns_info(ns_info) diff --git a/cybox/bindings/__init__.py b/cybox/bindings/__init__.py index 4e7da4f0..0b2cd388 100644 --- a/cybox/bindings/__init__.py +++ b/cybox/bindings/__init__.py @@ -9,6 +9,8 @@ from xml.sax import saxutils from lxml import etree as etree_ +from cybox.compat import basestring, str + CDATA_START = "" @@ -86,7 +88,7 @@ def gds_validate_integer_list(self, input_data, node, input_name=''): for value in values: try: fvalue = float(value) - except (TypeError, ValueError), exp: + except (TypeError, ValueError) as exp: raise_parse_error(node, 'Requires sequence of integers') return input_data @@ -104,7 +106,7 @@ def gds_validate_float_list(self, input_data, node, input_name=''): for value in values: try: fvalue = float(value) - except (TypeError, ValueError), exp: + except (TypeError, ValueError) as exp: raise_parse_error(node, 'Requires sequence of floats') return input_data @@ -122,7 +124,7 @@ def gds_validate_double_list(self, input_data, node, input_name=''): for value in values: try: fvalue = float(value) - except (TypeError, ValueError), exp: + except (TypeError, ValueError) as exp: raise_parse_error(node, 'Requires sequence of doubles') return input_data @@ -271,17 +273,33 @@ def showIndent(lwrite, level, pretty_print=True): lwrite(' ' * level) -def quote_xml(text): +def _coerce_unicode(text): + # Convert `text` to Unicode string. + if text is None: - return u'' + text = "" + + if isinstance(text, str): + return text - # Convert `text` to unicode string. This is mainly a catch-all for non + # This is mainly a catch-all for non # string/unicode types like bool and int. try: - text = unicode(text) + text = str(text) except UnicodeDecodeError: text = text.decode(ExternalEncoding) + return text + + +def quote_xml(text): + """Format a value for display as an XML text node. + + Returns: + Unicode string (str on Python 3, unicode on Python 2) + """ + text = _coerce_unicode(text) + # If it's a CDATA block, return the text as is. if text.startswith(CDATA_START): return text @@ -292,15 +310,12 @@ def quote_xml(text): def quote_attrib(text): - if text is None: - return u'""' + """Format a value for display as an XML attribute. - # Convert `text` to unicode string. This is mainly a catch-all for non - # string/unicode types like bool and int. - try: - text = unicode(text) - except UnicodeDecodeError: - text = text.decode(ExternalEncoding) + Returns: + Unicode string (str on Python 3, unicode on Python 2) + """ + text = _coerce_unicode(text) # Return the escaped the value of text. # Note: This wraps the escaped text in quotation marks. diff --git a/cybox/bindings/account_object.py b/cybox/bindings/account_object.py index 3d009080..4578cd5d 100644 --- a/cybox/bindings/account_object.py +++ b/cybox/bindings/account_object.py @@ -4,7 +4,7 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class AuthenticationType(GeneratedsSuper): @@ -426,7 +426,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -472,7 +472,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/address_object.py b/cybox/bindings/address_object.py index df69bdd2..2846b4af 100644 --- a/cybox/bindings/address_object.py +++ b/cybox/bindings/address_object.py @@ -4,7 +4,7 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class AddressObjectType(cybox_common.ObjectPropertiesType): @@ -13,7 +13,7 @@ class AddressObjectType(cybox_common.ObjectPropertiesType): is being defined. The is_source field specifies if this is a "Source" addressThe is_destination field specifies if this is a "Destination" address""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, category='ipv4-addr', is_source=None, is_destination=None, is_spoofed=None, Address_Value=None, VLAN_Name=None, VLAN_Num=None): @@ -259,7 +259,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -305,7 +305,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/api_object.py b/cybox/bindings/api_object.py index 217988ef..51e88148 100644 --- a/cybox/bindings/api_object.py +++ b/cybox/bindings/api_object.py @@ -4,13 +4,13 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class APIObjectType(cybox_common.ObjectPropertiesType): """The APIObjectType type is intended to characterize a specific Application Programming Interface.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Description=None, Function_Name=None, Normalized_Function_Name=None, Platform=None, Address=None): @@ -220,7 +220,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -266,7 +266,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/archive_file_object.py b/cybox/bindings/archive_file_object.py index 8d5db73e..afe32da4 100644 --- a/cybox/bindings/archive_file_object.py +++ b/cybox/bindings/archive_file_object.py @@ -4,9 +4,8 @@ import sys from cybox.bindings import * -import cybox_common - -import file_object +from . import cybox_common +from . import file_object class ArchiveFileFormatType(cybox_common.BaseObjectPropertyType): @@ -363,7 +362,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -409,7 +408,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/arp_cache_object.py b/cybox/bindings/arp_cache_object.py index b3b6f2a3..a8ce5edf 100644 --- a/cybox/bindings/arp_cache_object.py +++ b/cybox/bindings/arp_cache_object.py @@ -4,10 +4,9 @@ import sys from cybox.bindings import * -import cybox_common - -import address_object -import system_object +from . import cybox_common +from . import address_object +from . import system_object class ARPCacheEntryType(GeneratedsSuper): @@ -404,7 +403,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -450,7 +449,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/artifact_object.py b/cybox/bindings/artifact_object.py index c75dbfb4..cf32d345 100644 --- a/cybox/bindings/artifact_object.py +++ b/cybox/bindings/artifact_object.py @@ -4,13 +4,13 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class RawArtifactType(cybox_common.StringObjectPropertyType): """The RawArtifactType is intended to convey, with minimal characterization, the content of the Raw Artifact itself.""" - + subclass = None superclass = None def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, byte_order=None, valueOf_=None): @@ -79,7 +79,7 @@ class PackagingType(GeneratedsSuper): whether the Raw_Artifact content is protected/encrypted.The is_compressed field is optional and specifies whether the Raw_Artifact content is compressed.""" - + subclass = None superclass = None def __init__(self, is_compressed=None, is_encrypted=None, Compression=None, Encryption=None, Encoding=None): @@ -210,7 +210,7 @@ class CompressionType(GeneratedsSuper): optional and conveys a reference to a description of the compression algorithm utilized to protect the Raw_Artifact content.""" - + subclass = None superclass = None def __init__(self, compression_mechanism=None, compression_mechanism_ref=None): @@ -289,7 +289,7 @@ class EncryptionType(GeneratedsSuper): Raw_Artifact content. The encryption_key_ref field is optional and specifies a reference to a remote specification of the password for unprotecting/decrypting the Raw_Artifact content.""" - + subclass = None superclass = None def __init__(self, encryption_mechanism=None, encryption_key_ref=None, encryption_key=None, encryption_mechanism_ref=None): @@ -385,7 +385,7 @@ class EncodingType(GeneratedsSuper): custom_character_set_ref field is optional and conveys a reference to a specification of the custom character set used to encode the Raw_Artifact.""" - + subclass = None superclass = None def __init__(self, custom_character_set_ref=None, character_set=None, algorithm='Base64'): @@ -473,7 +473,7 @@ class ArtifactObjectType(cybox_common.ObjectPropertiesType): Defined Object.The suspected_malicious field is optional and conveys whether the content of the Raw_Artifact is believed to be malicoius.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, suspected_malicious=None, content_type_version=None, type_=None, content_type=None, Hashes=None, Packaging=None, Raw_Artifact=None, Raw_Artifact_Reference=None): @@ -716,7 +716,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -762,7 +762,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/as_object.py b/cybox/bindings/as_object.py index 88398777..95ef7412 100644 --- a/cybox/bindings/as_object.py +++ b/cybox/bindings/as_object.py @@ -4,7 +4,7 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class ASObjectType(cybox_common.ObjectPropertiesType): @@ -224,7 +224,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -270,7 +270,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/code_object.py b/cybox/bindings/code_object.py index 28a65a37..ea932c86 100644 --- a/cybox/bindings/code_object.py +++ b/cybox/bindings/code_object.py @@ -4,7 +4,7 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class CodeSegmentXORType(cybox_common.StringObjectPropertyType): @@ -15,7 +15,7 @@ class CodeSegmentXORType(cybox_common.StringObjectPropertyType): field should be XORed with in order to recover the actual code. The default value is 55AA55AA55AA55BB, as specified by IETF RFC 5901.""" - + subclass = None superclass = cybox_common.StringObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, xor_pattern='55AA55AA55AA55BB', valueOf_=None): @@ -83,7 +83,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class TargetedPlatformsType(GeneratedsSuper): """A list of targeted platforms""" - + subclass = None superclass = None def __init__(self, Targeted_Platform=None): @@ -155,7 +155,7 @@ class ProcessorTypeType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -228,7 +228,7 @@ class CodeLanguageType(cybox_common.BaseObjectPropertyType): complex (i.e. regular-expression based) specifications.This field is optional and specifies the expected type for the value of the specified field.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -301,7 +301,7 @@ class CodePurposeType(cybox_common.BaseObjectPropertyType): complex (i.e. regular-expression based) specifications.This field is optional and specifies the expected type for the value of the specified field.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -374,7 +374,7 @@ class CodeTypeType(cybox_common.BaseObjectPropertyType): (i.e. regular-expression based) specifications.This field is optional and specifies the expected type for the value of the specified field.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -443,7 +443,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class CodeObjectType(cybox_common.ObjectPropertiesType): """The CodeObjectType type is intended to characterize a body of computer code.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Description=None, Type=None, Purpose=None, Code_Language=None, Targeted_Platforms=None, Processor_Family=None, Discovery_Method=None, Start_Address=None, Code_Segment=None, Code_Segment_XOR=None, Digital_Signatures=None, Extracted_Features=None): @@ -743,7 +743,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -789,7 +789,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/custom_object.py b/cybox/bindings/custom_object.py index 2bc2b5ea..c13e5273 100644 --- a/cybox/bindings/custom_object.py +++ b/cybox/bindings/custom_object.py @@ -4,7 +4,7 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class CustomObjectType(cybox_common.ObjectPropertiesType): @@ -194,7 +194,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -240,7 +240,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/cybox_common.py b/cybox/bindings/cybox_common.py index 72ddaac4..fcf01009 100644 --- a/cybox/bindings/cybox_common.py +++ b/cybox/bindings/cybox_common.py @@ -392,7 +392,7 @@ def buildAttributes(self, node, attrs, already_processed): try: self.sighting_count = int(value) - except ValueError, exp: + except ValueError as exp: raise_parse_error(node, 'Bad integer attribute: %s' % exp) if self.sighting_count <= 0: raise_parse_error(node, 'Invalid PositiveInteger') @@ -435,13 +435,13 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): type_name_ = type_names_[0] else: type_name_ = type_names_[1] - + if type_name_ == "CIQAddress3.0InstanceType": import cybox.bindings.extensions.location.ciq_address_3_0 as ciq_address_binding obj_ = ciq_address_binding.CIQAddress3_0InstanceType.factory() else: - obj_ = LocationType.factory() - + obj_ = LocationType.factory() + obj_.build(child_) self.set_Observation_Location(obj_) elif nodeName_ == 'Tools': @@ -498,13 +498,13 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): type_name_ = type_names_[0] else: type_name_ = type_names_[1] - + if type_name_ == "CIQAddress3.0InstanceType": import cybox.bindings.extensions.location.ciq_address_3_0 as ciq_address_binding obj_ = ciq_address_binding.CIQAddress3_0InstanceType.factory() else: - obj_ = LocationType.factory() - + obj_ = LocationType.factory() + obj_.build(child_) self.set_Observable_Location(obj_) # end class MeasureSourceType @@ -512,7 +512,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ContributorType(GeneratedsSuper): """The ContributorType represents a description of an individual who contributed as a source of cyber observation data.""" - + subclass = None superclass = None def __init__(self, Role=None, Name=None, Email=None, Phone=None, Organization=None, Date=None, Contribution_Location=None): @@ -712,7 +712,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PersonnelType(GeneratedsSuper): """The PersonnelType is an abstracted data type to standardize the description of sets of personnel.""" - + subclass = None superclass = None def __init__(self, Contributor=None): @@ -873,7 +873,7 @@ class ToolSpecificDataType(GeneratedsSuper): CybOX schema enabling the inclusion of metadata for a specific type of tool through the use of a custom type defined as an extension of this base Abstract type.""" - + subclass = None superclass = None def __init__(self): @@ -925,7 +925,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ToolsInformationType(GeneratedsSuper): """The ToolsInformationType represents a description of a set of automated tools.""" - + subclass = None superclass = None def __init__(self, Tool=None): @@ -995,7 +995,7 @@ class ToolInformationType(GeneratedsSuper): automated tool.The id field specifies a unique ID for this Tool.The idref field specifies reference to a unique ID for this Tool.""" - + subclass = None superclass = None def __init__(self, idref=None, id=None, Name=None, Type=None, Description=None, References=None, Vendor=None, Version=None, Service_Pack=None, Tool_Specific_Data=None, Tool_Hashes=None, Tool_Configuration=None, Execution_Environment=None, Errors=None, Metadata=None, Compensation_Model=None): @@ -1234,7 +1234,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ToolReferencesType(GeneratedsSuper): """Used to indicate one or more references to tool instances and information""" - + subclass = None superclass = None def __init__(self, Reference=None): @@ -1303,7 +1303,7 @@ class ToolReferenceType(GeneratedsSuper): """Contains one reference to information or instances of a given toolIndicates the nature of the referenced material (documentation, source, executable, etc.)""" - + subclass = None superclass = None def __init__(self, reference_type=None, valueOf_=None): @@ -1470,7 +1470,7 @@ class ConfigurationSettingsType(GeneratedsSuper): """The ConfigurationSettingsType is a modularized data type used to provide a consistent approach to describing configuration settings for a tool, application or other cyber object""" - + subclass = None superclass = None def __init__(self, Configuration_Setting=None): @@ -1540,7 +1540,7 @@ class ConfigurationSettingType(GeneratedsSuper): provide a consistent approach to describing a particular configuration setting for a tool, application or other cyber object""" - + subclass = None superclass = None def __init__(self, Item_Name=None, Item_Value=None, Item_Type=None, Item_Description=None): @@ -1637,7 +1637,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class DependenciesType(GeneratedsSuper): """The DependenciesType contains information describing a set of dependencies for this tool.""" - + subclass = None superclass = None def __init__(self, Dependency=None): @@ -1705,7 +1705,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class DependencyType(GeneratedsSuper): """The DependencyType contains information describing a single dependency for this tool.""" - + subclass = None superclass = None def __init__(self, Dependency_Type=None, Dependency_Description=None): @@ -1779,7 +1779,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class UsageContextAssumptionsType(GeneratedsSuper): """The UsageContextAssumptionsType contains descriptions of the various relevant usage context assumptions for this tool""" - + subclass = None superclass = None def __init__(self, Usage_Context_Assumption=None): @@ -1847,7 +1847,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class InternationalizationSettingsType(GeneratedsSuper): """The InternationalizationSettingsType contains information describing relevant internationalization setting for this tool""" - + subclass = None superclass = None def __init__(self, Internal_Strings=None): @@ -1915,7 +1915,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class InternalStringsType(GeneratedsSuper): """The InternalStringsType contains a single internal string instance for this internationalization setting instance.""" - + subclass = None superclass = None def __init__(self, Key=None, Content=None): @@ -2158,7 +2158,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class BuildUtilityType(GeneratedsSuper): """The BuildUtilityType contains information identifying the utility used to build this application.""" - + subclass = None superclass = None def __init__(self, Build_Utility_Name=None, Build_Utility_Platform_Specification=None): @@ -2232,7 +2232,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class CompilersType(GeneratedsSuper): """The CompilersType describes the compilers utilized during this build of this application.""" - + subclass = None superclass = None def __init__(self, Compiler=None): @@ -2300,7 +2300,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class CompilerType(GeneratedsSuper): """The CompilerType describes a single compiler utilized during this build of this application.""" - + subclass = None superclass = None def __init__(self, Compiler_Informal_Description=None, Compiler_Platform_Specification=None): @@ -2373,7 +2373,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class CompilerInformalDescriptionType(GeneratedsSuper): """The CompilerInformalDescriptionType contains the informal description of this compiler instance.""" - + subclass = None superclass = None def __init__(self, Compiler_Name=None, Compiler_Version=None): @@ -2448,7 +2448,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class BuildConfigurationType(GeneratedsSuper): """The BuildConfigurationType describes how the build utility was configured for this build of this application.""" - + subclass = None superclass = None def __init__(self, Configuration_Setting_Description=None, Configuration_Settings=None): @@ -2522,7 +2522,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class LibrariesType(GeneratedsSuper): """The LibrariesType identifies the libraries incorporated into the build of the tool.""" - + subclass = None superclass = None def __init__(self, Library=None): @@ -2586,7 +2586,7 @@ class LibraryType(GeneratedsSuper): """The LibraryType identifies a single library incorporated into the build of the tool.This field identifies the name of the library.This field identifies the version of the library.""" - + subclass = None superclass = None def __init__(self, version=None, name=None): @@ -2777,7 +2777,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ErrorsType(GeneratedsSuper): """The ErrorsType captures any errors generated during the run of the tool.""" - + subclass = None superclass = None def __init__(self, Error=None): @@ -2845,7 +2845,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ErrorType(GeneratedsSuper): """The ErrorType captures a single error generated during the run of the tool.""" - + subclass = None superclass = None def __init__(self, Error_Type=None, Error_Count=None, Error_Instances=None): @@ -2921,7 +2921,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): sval_ = child_.text try: ival_ = int(sval_) - except (TypeError, ValueError), exp: + except (TypeError, ValueError) as exp: raise_parse_error(child_, 'requires integer: %s' % exp) ival_ = self.gds_validate_integer(ival_, node, 'Error_Count') self.Error_Count = ival_ @@ -2934,7 +2934,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ErrorInstancesType(GeneratedsSuper): """The ErrorInstancesType captures the actual error output for each instance of this type of error.""" - + subclass = None superclass = None def __init__(self, Error_Instance=None): @@ -3021,7 +3021,7 @@ class ObjectPropertiesType(GeneratedsSuper): location from which it is being referenced. Thus, this ID reference is intended to resolve to the Properties of the Object that it points to.""" - + subclass = None superclass = None def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None): @@ -3105,7 +3105,7 @@ class CustomPropertiesType(GeneratedsSuper): """The CustomPropertiesType enables the specification of a set of custom Object Properties that may not be defined in existing Properties schemas.""" - + subclass = None superclass = None def __init__(self, Property=None): @@ -5150,7 +5150,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ExtractedStringsType(GeneratedsSuper): """The ExtractedStringsType type is intended as container for strings extracted from CybOX objects.""" - + subclass = None superclass = None def __init__(self, String=None): @@ -5218,7 +5218,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ExtractedStringType(GeneratedsSuper): """The ExtractedStringType type is intended as container a single string extracted from a CybOX object.""" - + subclass = None superclass = None def __init__(self, Encoding=None, String_Value=None, Byte_String_Value=None, Hashes=None, Address=None, Length=None, Language=None, English_Translation=None): @@ -5360,7 +5360,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ImportsType(GeneratedsSuper): """The ImportsType is intended to represent an extracted list of imports specified within a CybOX object.""" - + subclass = None superclass = None def __init__(self, Import=None): @@ -5431,7 +5431,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class FunctionsType(GeneratedsSuper): """The FunctionsType is intended to represent an extracted list of functions leveraged within a CybOX object.""" - + subclass = None superclass = None def __init__(self, Function=None): @@ -5502,7 +5502,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class CodeSnippetsType(GeneratedsSuper): """The CodeSnippetsType is intended to represent an set of code snippets extracted from within a CybOX object.""" - + subclass = None superclass = None def __init__(self, Code_Snippet=None): @@ -5584,7 +5584,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ByteRunsType(GeneratedsSuper): """The ByteRunsType is used for representing a list of byte runs from within a raw object.""" - + subclass = None superclass = None def __init__(self, Byte_Run=None): @@ -5781,7 +5781,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class HashListType(GeneratedsSuper): """The HashListType type is used for representing a list of hash values.""" - + subclass = None superclass = None def __init__(self, Hash=None): @@ -5849,7 +5849,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class HashValueType(GeneratedsSuper): """The HashValueType is used for specifying the resulting value from a hash calculation.""" - + subclass = None superclass = None def __init__(self, Simple_Hash_Value=None, Fuzzy_Hash_Value=None): @@ -5923,7 +5923,7 @@ class SimpleHashValueType(HexBinaryObjectPropertyType): """The SimpleHashValueType is used for characterizing the output of basic cryptograhic hash functions outputing a single hexbinary hash value.""" - + subclass = None superclass = HexBinaryObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='hexBinary', 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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None, extensiontype_=None): @@ -5981,7 +5981,7 @@ class FuzzyHashValueType(StringObjectPropertyType): """The FuzzyHashValueType is used for characterizing the output of cryptograhic fuzzy hash functions outputing a single complex string based hash value.""" - + subclass = None superclass = StringObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None, extensiontype_=None): @@ -6038,7 +6038,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class FuzzyHashStructureType(GeneratedsSuper): """The FuzzyHashStructureType is used for characterizing the internal components of a cryptograhic fuzzy hash algorithmic calculation.""" - + subclass = None superclass = None def __init__(self, Block_Size=None, Block_Hash=None): @@ -6115,7 +6115,7 @@ class FuzzyHashBlockType(GeneratedsSuper): """The FuzzyHashBlockType is used for characterizing the internal components of a single block in a cryptograhic fuzzy hash algorithmic calculation.""" - + subclass = None superclass = None def __init__(self, Block_Hash_Value=None, Segment_Count=None, Segments=None): @@ -6202,7 +6202,7 @@ class HashSegmentsType(GeneratedsSuper): """The HashSegmentsType is used for characterizing the internal components of a set of trigger point-delimited segments in a cryptograhic fuzzy hash algorithmic calculation.""" - + subclass = None superclass = None def __init__(self, Segment=None): @@ -6271,7 +6271,7 @@ class HashSegmentType(GeneratedsSuper): """The HashSegmentType is used for characterizing the internal components of a single trigger point-delimited segment in a cryptograhic fuzzy hash algorithmic calculation.""" - + subclass = None superclass = None def __init__(self, Trigger_Point=None, Segment_Hash=None, Raw_Segment_Content=None): @@ -6357,7 +6357,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class HashType(GeneratedsSuper): """The HashType type is intended to characterize hash values.""" - + subclass = None superclass = None def __init__(self, Type=None, Simple_Hash_Value=None, Fuzzy_Hash_Value=None, Fuzzy_Hash_Structure=None): @@ -6464,7 +6464,7 @@ class StructuredTextType(GeneratedsSuper): interferring with XML validation of the CybOX document. If this attribute is absent, the implication is that no markup is being used.""" - + subclass = None superclass = None def __init__(self, structuring_format=None, valueOf_=None): @@ -6675,7 +6675,7 @@ class DataSizeType(StringObjectPropertyType): """The DataSizeType specifies the size of the data segment.This field represents the Units used in the object size element. Possible values are: Bytes, Kilobytes, Megabytes.""" - + subclass = None superclass = StringObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None, extensiontype_=None, units=None): @@ -6751,7 +6751,7 @@ class PlatformSpecificationType(GeneratedsSuper): CPE23PlatformSpecificationType in the http://cybox.mitre.org/extensions/platform#CPE2.3-1 namespace. This type is defined in the extensions/platform/cpe2.3.xsd file.""" - + subclass = None superclass = None def __init__(self, Description=None, Identifier=None): @@ -6837,7 +6837,7 @@ class PlatformIdentifierType(StringObjectPropertyType): system from which the indicated name was drawn.A reference to information about the naming system from which the indicated name was drawn.""" - + subclass = None superclass = StringObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None, extensiontype_=None, system_ref=None, system=None): @@ -6915,7 +6915,7 @@ class MetadataType(GeneratedsSuper): """The MetadataType is intended as mechanism to capture any non- context-specific metadataThis field specifies the type of name of a single metadata field.""" - + subclass = None superclass = None def __init__(self, type_=None, Value=None, SubDatum=None): @@ -7001,7 +7001,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class EnvironmentVariableListType(GeneratedsSuper): """The EnvironmentVariableListType type is used for representing a list of environment variables.""" - + subclass = None superclass = None def __init__(self, Environment_Variable=None): @@ -7069,7 +7069,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class EnvironmentVariableType(GeneratedsSuper): """The EnvironmentVariableType type is used for representing environment variables using a name/value pair.""" - + subclass = None superclass = None def __init__(self, Name=None, Value=None): @@ -7145,7 +7145,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class DigitalSignaturesType(GeneratedsSuper): """The DigitalSignaturesType is used for representing a list of digital signatures.""" - + subclass = None superclass = None def __init__(self, Digital_Signature=None): @@ -7215,7 +7215,7 @@ class DigitalSignatureInfoType(GeneratedsSuper): of the basic information about a digital signature.Specifies whether the digital signature exists.Specifies if the digital signature is verified.""" - + subclass = None superclass = None def __init__(self, signature_verified=None, signature_exists=None, Certificate_Issuer=None, Certificate_Subject=None, Signature_Description=None): @@ -7329,7 +7329,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PatternableFieldType(GeneratedsSuper): """The PatternableFieldType is a grouping of attributes applicable to defining patterns on a specific field.""" - + subclass = None superclass = None def __init__(self, pattern_type=None, has_changed=None, trend=None, apply_condition='ANY', bit_mask=None, regex_syntax=None, condition=None, is_case_sensitive=True, delimiter='##comma##', valueOf_=None, extensiontype_=None): @@ -7505,7 +7505,7 @@ class ControlledVocabularyStringType(PatternableFieldType): of the controlled vocabulary.The vocab_reference field specifies the URI to the location of where the controlled vocabulary is defined, e.g., in an externally located XML schema file.""" - + subclass = None superclass = PatternableFieldType def __init__(self, pattern_type=None, has_changed=None, trend=None, apply_condition='ANY', bit_mask=None, regex_syntax=None, condition=None, is_case_sensitive=True, delimiter='##comma##', vocab_reference=None, vocab_name=None, valueOf_=None, xsi_type=None): @@ -7794,7 +7794,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -7821,7 +7821,7 @@ def parse(inFileName): def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/cybox_core.py b/cybox/bindings/cybox_core.py index 7d2548f9..9954da06 100644 --- a/cybox/bindings/cybox_core.py +++ b/cybox/bindings/cybox_core.py @@ -4,9 +4,7 @@ import sys from cybox.bindings import * -import cybox_common - -from cybox_common import ControlledVocabularyStringType +from . import cybox_common #Object Imports from cybox.bindings.account_object import AccountObjectType @@ -227,7 +225,7 @@ class ObservableType(GeneratedsSuper): Observable defined elsewhere.The negate field, when set to true, indicates the absence (rather than the presence) of the given Observable in a CybOX pattern.""" - + subclass = None superclass = None def __init__(self, negate=False, idref=None, id=None, sighting_count=None, Title=None, Description=None, Keywords=None, Observable_Source=None, Object=None, Event=None, Observable_Composition=None, Pattern_Fidelity=None): @@ -238,10 +236,10 @@ def __init__(self, negate=False, idref=None, id=None, sighting_count=None, Title self.Title = Title self.Description = Description self.Keywords = Keywords - - if Observable_Source is None: + + if Observable_Source is None: self.Observable_Source = [] - else: + else: self.Observable_Source = Observable_Source self.Object = Object @@ -348,7 +346,7 @@ def exportChildren(self, lwrite, level, namespace_='cybox:', name_='ObservableTy self.Observable_Composition.export(lwrite, level, 'cybox:', name_='Observable_Composition', pretty_print=pretty_print) if self.Pattern_Fidelity is not None: self.Pattern_Fidelity.export(lwrite, level, 'cybox:', name_='Pattern_Fidelity', pretty_print=pretty_print) - + def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -378,7 +376,7 @@ def buildAttributes(self, node, attrs, already_processed): try: self.sighting_count = int(value) - except ValueError, exp: + except ValueError as exp: raise_parse_error(node, 'Bad integer attribute: %s' % exp) if self.sighting_count <= 0: raise_parse_error(node, 'Invalid PositiveInteger') @@ -426,7 +424,7 @@ class EventType(GeneratedsSuper): received).The id field specifies a unique id for this Event.The idref field specifies a unique id reference to an Event defined elsewhere.""" - + subclass = None superclass = None def __init__(self, idref=None, id=None, Type=None, Description=None, Observation_Method=None, Actions=None, Location=None, Frequency=None, Event=None): @@ -522,7 +520,7 @@ def exportChildren(self, lwrite, level, namespace_='cybox:', name_='EventType', self.Frequency.export(lwrite, level, 'cybox:', name_='Frequency', pretty_print=pretty_print) for Event_ in self.Event: Event_.export(lwrite, level, 'cybox:', name_='Event', pretty_print=pretty_print) - + def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -565,13 +563,13 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): type_name_ = type_names_[0] else: type_name_ = type_names_[1] - + if type_name_ == "CIQAddress3.0InstanceType": import cybox.bindings.extensions.location.ciq_address_3_0 as ciq_address_binding obj_ = ciq_address_binding.CIQAddress3_0InstanceType.factory() else: obj_ = cybox_common.LocationType.factory() # IdentityType is not abstract - + obj_.build(child_) self.set_Location(obj_) elif nodeName_ == 'Frequency': @@ -595,7 +593,7 @@ class FrequencyType(GeneratedsSuper): leveraged within an event or action pattern observable triggering on the matching of a specified trend in the frequency of an event or action.""" - + subclass = None superclass = None def __init__(self, units=None, trend=None, rate=None, scale=None): @@ -675,7 +673,7 @@ def buildAttributes(self, node, attrs, already_processed): try: self.rate = float(value) - except ValueError, exp: + except ValueError as exp: raise ValueError('Bad float/double attribute (rate): %s' % exp) value = find_attr_value_('scale', node) if value is not None: @@ -688,7 +686,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ActionsType(GeneratedsSuper): """The ActionsType is a complex type representing a set of cyber observable actions.""" - + subclass = None superclass = None def __init__(self, Action=None): @@ -765,7 +763,7 @@ class ActionType(GeneratedsSuper): operational context in which the Action is relevantThe timestamp field represents the local or relative time at which the action occurred or was observed.""" - + subclass = None superclass = None def __init__(self, timestamp_precision='second', timestamp=None, action_status=None, ordinal_position=None, context=None, idref=None, id=None, Type=None, Name=None, Description=None, Action_Aliases=None, Action_Arguments=None, Location=None, Discovery_Method=None, Associated_Objects=None, Relationships=None, Frequency=None): @@ -904,7 +902,7 @@ def exportChildren(self, lwrite, level, namespace_='cybox:', name_='ActionType', self.Relationships.export(lwrite, level, 'cybox:', name_='Relationships', pretty_print=pretty_print) if self.Frequency is not None: self.Frequency.export(lwrite, level, 'cybox:', name_='Frequency', pretty_print=pretty_print) - + def build(self, node): already_processed = set() self.buildAttributes(node, node.attrib, already_processed) @@ -917,7 +915,7 @@ def buildAttributes(self, node, attrs, already_processed): try: self.timestamp = self.gds_parse_datetime(value, node, 'timestamp') - except ValueError, exp: + except ValueError as exp: raise ValueError('Bad date-time attribute (timestamp): %s' % exp) value = find_attr_value_('action_status', node) if value is not None: @@ -928,7 +926,7 @@ def buildAttributes(self, node, attrs, already_processed): try: self.ordinal_position = int(value) - except ValueError, exp: + except ValueError as exp: raise_parse_error(node, 'Bad integer attribute: %s' % exp) if self.ordinal_position <= 0: raise_parse_error(node, 'Invalid PositiveInteger') @@ -975,13 +973,13 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): type_name_ = type_names_[0] else: type_name_ = type_names_[1] - + if type_name_ == "CIQAddress3.0InstanceType": import cybox.bindings.extensions.location.ciq_address_3_0 as ciq_address_binding obj_ = ciq_address_binding.CIQAddress3_0InstanceType.factory() else: obj_ = cybox_common.LocationType.factory() # IdentityType is not abstract - + obj_.build(child_) self.set_Location(obj_) elif nodeName_ == 'Discovery_Method': @@ -1005,7 +1003,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ActionAliasesType(GeneratedsSuper): """The ActionAliasesType enables identification of other potentially used names for this Action.""" - + subclass = None superclass = None def __init__(self, Action_Alias=None): @@ -1074,7 +1072,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ActionArgumentsType(GeneratedsSuper): """The ActionArgumentsType enables the specification of relevant arguments/parameters for this Action.""" - + subclass = None superclass = None def __init__(self, Action_Argument=None): @@ -1215,7 +1213,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class AssociatedObjectsType(GeneratedsSuper): """The AssociatedObjectsType enables the description/specification of cyber Objects relevant to an Action.""" - + subclass = None superclass = None def __init__(self, Associated_Object=None): @@ -1284,7 +1282,7 @@ class ActionPertinentObjectPropertiesType(GeneratedsSuper): """The ActionPertinentObjectPropertiesType identifies which of the Properties of this Object are specifically pertinent to this Action.""" - + subclass = None superclass = None def __init__(self, Property=None): @@ -1425,7 +1423,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ActionRelationshipsType(GeneratedsSuper): """The ActionRelationshipsType enables description of other cyber observable actions that are related to this Action.""" - + subclass = None superclass = None def __init__(self, Relationship=None): @@ -1572,7 +1570,7 @@ class ActionReferenceType(GeneratedsSuper): """ActionReferenceType is intended to serve as a method for linking to actions.The action_id field refers to the id of the action being referenced.""" - + subclass = None superclass = None def __init__(self, action_id=None): @@ -1826,13 +1824,13 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): type_name_ = type_names_[0] else: type_name_ = type_names_[1] - + if type_name_ == "CIQAddress3.0InstanceType": import cybox.bindings.extensions.location.ciq_address_3_0 as ciq_address_binding obj_ = ciq_address_binding.CIQAddress3_0InstanceType.factory() else: obj_ = cybox_common.LocationType.factory() # IdentityType is not abstract - + obj_.build(child_) self.set_Location(obj_) elif nodeName_ == 'Related_Objects': @@ -1871,7 +1869,7 @@ class DomainSpecificObjectPropertiesType(GeneratedsSuper): This enables domains utilizing CybOX such as malware analysis or forensics to incorporate non-generalized object metadata from their domains into CybOX objects.""" - + subclass = None superclass = None def __init__(self, xsi_type = None): @@ -1931,7 +1929,7 @@ class RelatedObjectsType(GeneratedsSuper): """The RelatedObjectsType enables the identification and/or specification of Objects with relevant relationships with this Object.""" - + subclass = None superclass = None def __init__(self, Related_Object=None): @@ -2000,7 +1998,7 @@ class RelatedObjectType(ObjectType): """The RelatedObjectType enables the identification and/or specification of an Object with a relevant relationship with this Object.""" - + subclass = None superclass = ObjectType def __init__(self, has_changed=None, idref=None, id=None, State=None, Description=None, Properties=None, Domain_Specific_Object_Properties=None, Location=None, Related_Objects=None, Defined_Effect=None, Discovery_Method=None, Relationship=None): @@ -2058,7 +2056,7 @@ def buildAttributes(self, node, attrs, already_processed): super(RelatedObjectType, self).buildAttributes(node, attrs, already_processed) def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): if nodeName_ == 'Relationship': - obj_ = ControlledVocabularyStringType.factory() + obj_ = cybox_common.ControlledVocabularyStringType.factory() obj_.build(child_) self.set_Relationship(obj_) super(RelatedObjectType, self).buildChildren(child_, node, nodeName_, True) @@ -2075,7 +2073,7 @@ class DefinedEffectType(GeneratedsSuper): DefinedEffectType) are maintained as part of the core CybOX schema.The effect_type field specifies the nature of the Defined Effect instantiated in the place of the Defined_Effect element.""" - + subclass = None superclass = None def __init__(self, effect_type=None, extensiontype_=None): @@ -2223,7 +2221,7 @@ class DataReadEffectType(DefinedEffectType): """The DataReadEffectType type is intended to characterize the effects of actions upon objects where some data is read, such as from a file or a pipe.""" - + subclass = None superclass = DefinedEffectType def __init__(self, effect_type=None, Data=None): @@ -2291,7 +2289,7 @@ class DataWrittenEffectType(DefinedEffectType): """The DataWrittenEffectType type is intended to characterize the effects of actions upon objects where some data is written, such as to a file or a pipe.""" - + subclass = None superclass = DefinedEffectType def __init__(self, effect_type=None, Data=None): @@ -2359,7 +2357,7 @@ class DataSentEffectType(DefinedEffectType): """The DataSentEffectType type is intended to characterize the effects of actions upon objects where some data is sent, such as a byte sequence on a socket.""" - + subclass = None superclass = DefinedEffectType def __init__(self, effect_type=None, Data=None): @@ -2427,7 +2425,7 @@ class DataReceivedEffectType(DefinedEffectType): """The DataReceivedEffectType type is intended to characterize the effects of actions upon objects where some data is received, such as a byte sequence on a socket.""" - + subclass = None superclass = DefinedEffectType def __init__(self, effect_type=None, Data=None): @@ -2575,7 +2573,7 @@ class PropertiesEnumeratedEffectType(DefinedEffectType): the effects of actions upon objects where some properties of the object are enumerated, such as the startup parameters for a process.""" - + subclass = None superclass = DefinedEffectType def __init__(self, effect_type=None, Properties=None): @@ -2642,7 +2640,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PropertiesType(GeneratedsSuper): """The PropertiesType specifies the properties that were enumerated as a result of the action on the object.""" - + subclass = None superclass = None def __init__(self, Property=None): @@ -2711,7 +2709,7 @@ class ValuesEnumeratedEffectType(DefinedEffectType): """The ValuesEnumeratedEffectType type is intended to characterize the effects of actions upon objects where some values of the object are enumerated, such as the values of a registry key.""" - + subclass = None superclass = DefinedEffectType def __init__(self, effect_type=None, Values=None): @@ -2778,7 +2776,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ValuesType(GeneratedsSuper): """The ValuesType specifies the values that were enumerated as a result of the action on the object.""" - + subclass = None superclass = None def __init__(self, Value=None): @@ -2850,7 +2848,7 @@ class SendControlCodeEffectType(DefinedEffectType): other control-oriented communication signal, is sent to the object. For example, an action may send a control code to change the running state of a process.""" - + subclass = None superclass = DefinedEffectType def __init__(self, effect_type=None, Control_Code=None): @@ -3098,7 +3096,7 @@ class EventPoolType(GeneratedsSuper): the pooled Event elements. This reduces redundancy caused when identical Events occur multiple times within a set of defined Observables.""" - + subclass = None superclass = None def __init__(self, Event=None): @@ -3170,7 +3168,7 @@ class ActionPoolType(GeneratedsSuper): the pooled Action elements. This reduces redundancy caused when identical Actions occur multiple times within a set of defined Observables.""" - + subclass = None superclass = None def __init__(self, Action=None): @@ -3242,7 +3240,7 @@ class ObjectPoolType(GeneratedsSuper): the pooled Object elements. This reduces redundancy caused when identical Objects occur multiple times within a set of defined Observables.""" - + subclass = None superclass = None def __init__(self, Object=None): @@ -3314,7 +3312,7 @@ class PropertyPoolType(GeneratedsSuper): the pooled Properties elements. This reduces redundancy caused when identical Properties occur multiple times within a set of defined Observables.""" - + subclass = None superclass = None def __init__(self, Property=None): @@ -3383,7 +3381,7 @@ class ObfuscationTechniquesType(GeneratedsSuper): """The ObfuscationTechniquesType enables the description of a set of potential techniques an attacker could leverage to obfuscate the observability of this Observable.""" - + subclass = None superclass = None def __init__(self, Obfuscation_Technique=None): @@ -3522,7 +3520,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): # end class ObfuscationTechniqueType class KeywordsType(GeneratedsSuper): - + subclass = None superclass = None def __init__(self, Keyword=None): @@ -3589,7 +3587,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): # end class KeywordsType class PatternFidelityType(GeneratedsSuper): - + subclass = None superclass = None def __init__(self, Noisiness=None, Ease_of_Evasion=None, Evasion_Techniques=None): @@ -3679,7 +3677,7 @@ class AssociatedObjectType(ObjectType): """The AssociatedObjectType is a complex type representing the characterization of a cyber observable Object associated with a given cyber observable Action.""" - + subclass = None superclass = ObjectType def __init__(self, has_changed=None, idref=None, id=None, State=None, Description=None, Properties=None, Domain_Specific_Object_Properties=None, Location=None, Related_Objects=None, Defined_Effect=None, Discovery_Method=None, Association_Type=None, Action_Pertinent_Object_Properties=None): @@ -3893,7 +3891,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -3939,7 +3937,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/device_object.py b/cybox/bindings/device_object.py index 899a5435..f47773d3 100644 --- a/cybox/bindings/device_object.py +++ b/cybox/bindings/device_object.py @@ -4,13 +4,13 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class DeviceObjectType(cybox_common.ObjectPropertiesType): """The DeviceObjectType type is intended to characterize a specific Device.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Description=None, Device_Type=None, Manufacturer=None, Model=None, Serial_Number=None, Firmware_Version=None, System_Details=None): @@ -253,7 +253,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -299,7 +299,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/disk_object.py b/cybox/bindings/disk_object.py index fb7d6457..f965c632 100644 --- a/cybox/bindings/disk_object.py +++ b/cybox/bindings/disk_object.py @@ -4,14 +4,13 @@ import sys from cybox.bindings import * -import cybox_common - -import disk_partition_object +from . import cybox_common +from . import disk_partition_object class PartitionListType(GeneratedsSuper): """The PartionListType type specifies a list of partitions.""" - + subclass = None superclass = None def __init__(self, Partition=None): @@ -83,7 +82,7 @@ class DiskType(cybox_common.BaseObjectPropertyType): expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -151,7 +150,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class DiskObjectType(cybox_common.ObjectPropertiesType): """The DiskObjectType type is intended to characterize disk drives.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Disk_Name=None, Disk_Size=None, Free_Space=None, Partition_List=None, Type=None): @@ -376,7 +375,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -422,7 +421,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/disk_partition_object.py b/cybox/bindings/disk_partition_object.py index 11be6a84..8ad781f7 100644 --- a/cybox/bindings/disk_partition_object.py +++ b/cybox/bindings/disk_partition_object.py @@ -4,7 +4,7 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class PartitionType(cybox_common.BaseObjectPropertyType): @@ -14,7 +14,7 @@ class PartitionType(cybox_common.BaseObjectPropertyType): complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -83,7 +83,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class DiskPartitionObjectType(cybox_common.ObjectPropertiesType): """The DiskPartitionType type is intended to characterize partitions of disk drives.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Created=None, Device_Name=None, Mount_Point=None, Partition_ID=None, Partition_Length=None, Partition_Offset=None, Space_Left=None, Space_Used=None, Total_Space=None, Type=None): @@ -362,7 +362,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -408,7 +408,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/dns_cache_object.py b/cybox/bindings/dns_cache_object.py index 5bbffbab..3659f328 100644 --- a/cybox/bindings/dns_cache_object.py +++ b/cybox/bindings/dns_cache_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import dns_record_object +from . import cybox_common +from . import dns_record_object class DNSCacheEntryType(GeneratedsSuper): """The DNSCacheEntryType type is intended to characterize a single entry in a system's DNS cache.""" - + subclass = None superclass = None def __init__(self, DNS_Entry=None, TTL=None): @@ -88,7 +87,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class DNSCacheObjectType(cybox_common.ObjectPropertiesType): """The DNSCacheObjectType type is intended to characterize entries in a system's DNS cache.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, DNS_Cache_Entry=None): @@ -266,7 +265,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -312,7 +311,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/dns_query_object.py b/cybox/bindings/dns_query_object.py index 28e6eefa..6b40595f 100644 --- a/cybox/bindings/dns_query_object.py +++ b/cybox/bindings/dns_query_object.py @@ -4,16 +4,15 @@ import sys from cybox.bindings import * -import cybox_common - -import dns_record_object -import uri_object +from . import cybox_common +from . import dns_record_object +from . import uri_object class DNSQuestionType(GeneratedsSuper): """The DNSQuestionType specifies the components of a DNS Question, including the domain name queried, type, and class.""" - + subclass = None superclass = None def __init__(self, QName=None, QType=None, QClass=None): @@ -102,7 +101,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class DNSResourceRecordsType(GeneratedsSuper): """The DNSAnswersType encompasses one or more resource records returned for a DNS query.""" - + subclass = None superclass = None def __init__(self, Resource_Record=None): @@ -174,7 +173,7 @@ class DNSRecordType(cybox_common.BaseObjectPropertyType): complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -244,7 +243,7 @@ class DNSQueryObjectType(cybox_common.ObjectPropertiesType): """The DNSQueryType is intended to characterize a single DNS query and its components.The successful field specifies whether or not the DNS Query was successful.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, successful=None, Transaction_ID=None, Question=None, Answer_Resource_Records=None, Authority_Resource_Records=None, Additional_Records=None, Date_Ran=None, Service_Used=None): @@ -504,7 +503,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -550,7 +549,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/dns_record_object.py b/cybox/bindings/dns_record_object.py index b738d103..ec706d2e 100644 --- a/cybox/bindings/dns_record_object.py +++ b/cybox/bindings/dns_record_object.py @@ -4,16 +4,15 @@ import sys from cybox.bindings import * -import cybox_common - -import address_object -import uri_object +from . import cybox_common +from . import address_object +from . import uri_object class DNSRecordObjectType(cybox_common.ObjectPropertiesType): """The DNSRecordObjectType type is intended to characterize an individual DNS record.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Description=None, Queried_Date=None, Domain_Name=None, IP_Address=None, Address_Class=None, Entry_Type=None, Record_Name=None, Record_Type=None, TTL=None, Flags=None, Data_Length=None, Record_Data=None): @@ -308,7 +307,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -354,7 +353,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/domain_name_object.py b/cybox/bindings/domain_name_object.py index 984304ae..e6d6f004 100644 --- a/cybox/bindings/domain_name_object.py +++ b/cybox/bindings/domain_name_object.py @@ -4,7 +4,7 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class DomainNameObjectType(cybox_common.ObjectPropertiesType): @@ -197,7 +197,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -243,7 +243,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/email_message_object.py b/cybox/bindings/email_message_object.py index 35940e8f..b22c3020 100644 --- a/cybox/bindings/email_message_object.py +++ b/cybox/bindings/email_message_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import address_object +from . import cybox_common +from . import address_object class AttachmentsType(GeneratedsSuper): """The AttachmenstType captures a list of attachments for an email message.""" - + subclass = None superclass = None def __init__(self, File=None): @@ -80,7 +79,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class EmailHeaderType(GeneratedsSuper): """The EmailHeaderType captures a representation of a standard email header.""" - + subclass = None superclass = None def __init__(self, Received_Lines=None, To=None, CC=None, BCC=None, From=None, Subject=None, In_Reply_To=None, Date=None, Message_ID=None, Sender=None, Reply_To=None, Errors_To=None, Boundary=None, Content_Type=None, MIME_Version=None, Precedence=None, User_Agent=None, X_Mailer=None, X_Originating_IP=None, X_Priority=None): @@ -342,7 +341,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class EmailRecipientsType(GeneratedsSuper): """The EmailRecipientsType captures a list of recipients for an email message.""" - + subclass = None superclass = None def __init__(self, Recipient=None): @@ -410,7 +409,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class LinksType(GeneratedsSuper): """The LinksType captures a list of URIs, representing the links contained in the message.""" - + subclass = None superclass = None def __init__(self, Link=None): @@ -603,7 +602,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class EmailReceivedLineListType(GeneratedsSuper): """The EmailReceivedLineListType captures a list of 'Received' lines in an email message header.""" - + subclass = None superclass = None def __init__(self, Received=None): @@ -675,7 +674,7 @@ class AttachmentReferenceType(GeneratedsSuper): field specifies a reference to an file-oriented (i.e., the File Object or one its derivations such as the Windows File Object) Object defined elsewhere in the document, via its id.""" - + subclass = None superclass = None def __init__(self, object_reference=None): @@ -738,7 +737,7 @@ class LinkReferenceType(GeneratedsSuper): embedded in the body of the email message.The object_reference field specifies a reference to a URI Object defined elsewhere in the document, via its id.""" - + subclass = None superclass = None def __init__(self, object_reference=None): @@ -798,7 +797,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class EmailMessageObjectType(cybox_common.ObjectPropertiesType): """The EmailMessageObjectType type is intended to characterize an individual email message.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Header=None, Email_Server=None, Raw_Body=None, Raw_Header=None, Attachments=None, Links=None): @@ -876,14 +875,14 @@ def exportChildren(self, lwrite, level, namespace_='EmailMessageObj:', name_='Em value = self.Raw_Body.get_valueOf_() if not value.startswith('' - self.Raw_Body.set_valueOf_(value) + self.Raw_Body.set_valueOf_(value) self.Raw_Body.export(lwrite, level, 'EmailMessageObj:', name_='Raw_Body', pretty_print=pretty_print) if self.Raw_Header is not None: if self.Raw_Header.get_valueOf_() is not None: value = self.Raw_Header.get_valueOf_() if not value.startswith('' - self.Raw_Header.set_valueOf_(value) + self.Raw_Header.set_valueOf_(value) self.Raw_Header.export(lwrite, level, 'EmailMessageObj:', name_='Raw_Header', pretty_print=pretty_print) if self.Attachments is not None: self.Attachments.export(lwrite, level, 'EmailMessageObj:', name_='Attachments', pretty_print=pretty_print) @@ -1050,7 +1049,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -1065,7 +1064,7 @@ def parse(inFileName): rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) if rootClass is None: - rootTag = 'Email_Message' + rootTag = 'email_message' rootClass = EmailMessageObjectType rootObj = rootClass.factory() rootObj.build(rootNode) @@ -1082,7 +1081,7 @@ def parseEtree(inFileName): rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) if rootClass is None: - rootTag = 'Email_Message' + rootTag = 'email_message' rootClass = EmailMessageObjectType rootObj = rootClass.factory() rootObj.build(rootNode) @@ -1096,19 +1095,19 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) if rootClass is None: - rootTag = 'Email_Message' + rootTag = 'email_message' rootClass = EmailMessageObjectType rootObj = rootClass.factory() rootObj.build(rootNode) # Enable Python to collect the space used by the DOM. doc = None # sys.stdout.write('\n') -# rootObj.export(sys.stdout.write, 0, name_="Email_Message", +# rootObj.export(sys.stdout.write, 0, name_="email_message", # namespacedef_='') return rootObj diff --git a/cybox/bindings/extensions/location/ciq_address_3_0.py b/cybox/bindings/extensions/location/ciq_address_3_0.py index afcf5bf8..e2470f03 100644 --- a/cybox/bindings/extensions/location/ciq_address_3_0.py +++ b/cybox/bindings/extensions/location/ciq_address_3_0.py @@ -201,7 +201,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -247,7 +247,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/file_object.py b/cybox/bindings/file_object.py index 5d4782f5..64ee2741 100644 --- a/cybox/bindings/file_object.py +++ b/cybox/bindings/file_object.py @@ -4,7 +4,7 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class FilePathType(cybox_common.StringObjectPropertyType): @@ -13,7 +13,7 @@ class FilePathType(cybox_common.StringObjectPropertyType): be specified via the 'fully_qualified' attribute.The fully_qualified field specifies whether the path is fully qualified.""" - + subclass = None superclass = None def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None, extensiontype_=None, fully_qualified=None): @@ -86,7 +86,7 @@ class FileAttributeType(GeneratedsSuper): """The FileAttributeType type specifies attribute(s) of a file. Since this Object property(ies) is platform-specific, it is defined here as an abstract type.""" - + subclass = None superclass = None def __init__(self, xsi_type = None): @@ -145,7 +145,7 @@ class FilePermissionsType(GeneratedsSuper): this is a platform-specific Object property, it is defined here as an abstract type and then implemented in any platform specific derived file objects.""" - + subclass = None superclass = None def __init__(self): @@ -196,7 +196,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PackerListType(GeneratedsSuper): """The PackerListType type specifies a list of file packers.""" - + subclass = None superclass = None def __init__(self, Packer=None): @@ -264,7 +264,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PackerType(GeneratedsSuper): """The PackerType specifies the fields that characterize a particular file packer, such as name and version.""" - + subclass = None superclass = None def __init__(self, Name=None, Version=None, Entry_Point=None, Signature=None, Type=None, Detected_Entrypoint_Signatures=None, EP_Jump_Codes=None): @@ -395,7 +395,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class EPJumpCodeType(GeneratedsSuper): """Specifies an entry-point jump code used by a packer.""" - + subclass = None superclass = None def __init__(self, Depth=None, Opcodes=None): @@ -473,7 +473,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class EntryPointSignatureType(GeneratedsSuper): """Specifies an entry point signature for a packer.""" - + subclass = None superclass = None def __init__(self, Name=None, Type=None): @@ -551,7 +551,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class EntryPointSignatureListType(GeneratedsSuper): """Species a list of entry point signatures for a packer.""" - + subclass = None superclass = None def __init__(self, Entry_Point_Signature=None): @@ -618,7 +618,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class SymLinksListType(GeneratedsSuper): """The SymLinksListType specifies a list of symbolic links.""" - + subclass = None superclass = None def __init__(self, Sym_Link=None): @@ -693,7 +693,7 @@ class PackerClassType(cybox_common.BaseObjectPropertyType): (i.e. regular-expression based) specifications.This field is optional and specifies the expected type for the value of the specified field.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, pattern_type=None, datatype='string', refanging_transform=None, bit_mask=None, appears_random=None, trend=None, defanging_algorithm_ref=None, is_obfuscated=None, regex_syntax=None, apply_condition='ANY', idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -763,7 +763,7 @@ class FileObjectType(cybox_common.ObjectPropertiesType): """The File_ObjectType type is intended to characterize generic files.The ispacked field is used to indicate whether the file is packed or not.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_packed=None, is_masqueraded=None, File_Name=None, File_Path=None, Device_Path=None, Full_Path=None, File_Extension=None, Size_In_Bytes=None, Magic_Number=None, File_Format=None, Hashes=None, Digital_Signatures=None, Modified_Time=None, Accessed_Time=None, Created_Time=None, File_Attributes_List=None, Permissions=None, User_Owner=None, Packer_List=None, Peak_Entropy=None, Sym_Links=None, Byte_Runs=None, Extracted_Features=None, Encryption_Algorithm=None, Decryption_Key=None, Compression_Method=None, Compression_Version=None, Compression_Comment=None): @@ -1269,7 +1269,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -1315,7 +1315,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/gui_dialogbox_object.py b/cybox/bindings/gui_dialogbox_object.py index 246a41c9..f3258c1f 100644 --- a/cybox/bindings/gui_dialogbox_object.py +++ b/cybox/bindings/gui_dialogbox_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import gui_object +from . import cybox_common +from . import gui_object class GUIDialogboxObjectType(gui_object.GUIObjectType): """The GUIDialogboxObjectType type is intended to characterize GUI dialog boxes.""" - + subclass = None superclass = gui_object.GUIObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Height=None, Width=None, Box_Caption=None, Box_Text=None): @@ -192,7 +191,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -238,7 +237,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/gui_object.py b/cybox/bindings/gui_object.py index 4c88793f..3ee6ab22 100644 --- a/cybox/bindings/gui_object.py +++ b/cybox/bindings/gui_object.py @@ -4,13 +4,13 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class GUIObjectType(cybox_common.ObjectPropertiesType): """The GUIObjectType type is intended to characterize generic GUI objects.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Height=None, Width=None): @@ -187,7 +187,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -233,7 +233,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/gui_window_object.py b/cybox/bindings/gui_window_object.py index 19b4a7a4..789c0f4b 100644 --- a/cybox/bindings/gui_window_object.py +++ b/cybox/bindings/gui_window_object.py @@ -4,14 +4,13 @@ import sys from cybox.bindings import * -import cybox_common - -import gui_object +from . import cybox_common +from . import gui_object class GUIWindowObjectType(gui_object.GUIObjectType): """The GUIWindowObjectType is intended to characterize GUI windows.""" - + subclass = None superclass = gui_object.GUIObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Height=None, Width=None, Owner_Window=None, Parent_Window=None, Window_Display_Name=None): @@ -202,7 +201,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -248,7 +247,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/hostname_object.py b/cybox/bindings/hostname_object.py index 0fdd10b3..4dccdf32 100644 --- a/cybox/bindings/hostname_object.py +++ b/cybox/bindings/hostname_object.py @@ -4,7 +4,7 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class HostnameObjectType(cybox_common.ObjectPropertiesType): @@ -214,7 +214,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -260,7 +260,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/http_session_object.py b/cybox/bindings/http_session_object.py index 14a89763..3bea34d9 100644 --- a/cybox/bindings/http_session_object.py +++ b/cybox/bindings/http_session_object.py @@ -4,11 +4,10 @@ import sys from cybox.bindings import * -import cybox_common - -import address_object -import port_object -import uri_object +from . import cybox_common +from . import address_object +from . import port_object +from . import uri_object class HTTPRequestResponseType(GeneratedsSuper): @@ -90,7 +89,7 @@ def buildAttributes(self, node, attrs, already_processed): try: self.ordinal_position = int(value) - except ValueError, exp: + except ValueError as exp: raise_parse_error(node, 'Bad integer attribute: %s' % exp) if self.ordinal_position < 0: raise_parse_error(node, 'Invalid NonNegativeInteger') @@ -111,7 +110,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class HTTPClientRequestType(GeneratedsSuper): """The HTTPClientRequestType field captures the details of an HTTP client request.""" - + subclass = None superclass = None def __init__(self, HTTP_Request_Line=None, HTTP_Request_Header=None, HTTP_Message_Body=None): @@ -194,7 +193,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class HTTPServerResponseType(GeneratedsSuper): """The HTTPServerResponseType captures the details of an HTTP server response.""" - + subclass = None superclass = None def __init__(self, HTTP_Status_Line=None, HTTP_Response_Header=None, HTTP_Message_Body=None): @@ -276,7 +275,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class HTTPRequestLineType(GeneratedsSuper): """The HTTPRequestLineType captures a single HTTP request line.""" - + subclass = None superclass = None def __init__(self, HTTP_Method=None, Value=None, Version=None): @@ -367,7 +366,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class HTTPRequestHeaderType(GeneratedsSuper): """The HTTPRequestHeaderType captures the raw or parsed header of an HTTP request.""" - + subclass = None superclass = None def __init__(self, Raw_Header=None, Parsed_Header=None): @@ -422,7 +421,7 @@ def exportChildren(self, lwrite, level, namespace_='HTTPSessionObj:', name_='HTT value = self.Raw_Header.get_valueOf_() if not value.startswith('' - self.Raw_Header.set_valueOf_(value) + self.Raw_Header.set_valueOf_(value) self.Raw_Header.export(lwrite, level, 'HTTPSessionObj:', name_='Raw_Header', pretty_print=pretty_print) if self.Parsed_Header is not None: self.Parsed_Header.export(lwrite, level, 'HTTPSessionObj:', name_='Parsed_Header', pretty_print=pretty_print) @@ -448,7 +447,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class HTTPRequestHeaderFieldsType(GeneratedsSuper): """The HTTPRequestHeaderFieldsType captures parsed HTTP request header fields.""" - + subclass = None superclass = None def __init__(self, Accept=None, Accept_Charset=None, Accept_Language=None, Accept_Datetime=None, Accept_Encoding=None, Authorization=None, Cache_Control=None, Connection=None, Cookie=None, Content_Length=None, Content_MD5=None, Content_Type=None, Date=None, Expect=None, From=None, Host=None, If_Match=None, If_Modified_Since=None, If_None_Match=None, If_Range=None, If_Unmodified_Since=None, Max_Forwards=None, Pragma=None, Proxy_Authorization=None, Range=None, Referer=None, TE=None, User_Agent=None, Via=None, Warning=None, DNT=None, X_Requested_With=None, X_Forwarded_For=None, X_Forwarded_Proto=None, X_ATT_DeviceId=None, X_Wap_Profile=None): @@ -870,7 +869,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class HTTPResponseHeaderType(GeneratedsSuper): """The HTTPResponseHeaderType captures the raw or parsed header of an HTTP response.""" - + subclass = None superclass = None def __init__(self, Raw_Header=None, Parsed_Header=None): @@ -925,7 +924,7 @@ def exportChildren(self, lwrite, level, namespace_='HTTPSessionObj:', name_='HTT value = self.Raw_Header.get_valueOf_() if not value.startswith('' - self.Raw_Header.set_valueOf_(value) + self.Raw_Header.set_valueOf_(value) self.Raw_Header.export(lwrite, level, 'HTTPSessionObj:', name_='Raw_Header', pretty_print=pretty_print) if self.Parsed_Header is not None: self.Parsed_Header.export(lwrite, level, 'HTTPSessionObj:', name_='Parsed_Header', pretty_print=pretty_print) @@ -951,7 +950,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class HTTPResponseHeaderFieldsType(GeneratedsSuper): """The HTTPRequestHeaderFieldsType captures parsed HTTP request header fields.""" - + subclass = None superclass = None def __init__(self, Access_Control_Allow_Origin=None, Accept_Ranges=None, Age=None, Cache_Control=None, Connection=None, Content_Encoding=None, Content_Language=None, Content_Length=None, Content_Location=None, Content_MD5=None, Content_Disposition=None, Content_Range=None, Content_Type=None, Date=None, ETag=None, Expires=None, Last_Modified=None, Link=None, Location=None, P3P=None, Pragma=None, Proxy_Authenticate=None, Refresh=None, Retry_After=None, Server=None, Set_Cookie=None, Strict_Transport_Security=None, Trailer=None, Transfer_Encoding=None, Vary=None, Via=None, Warning=None, WWW_Authenticate=None, X_Frame_Options=None, X_XSS_Protection=None, X_Content_Type_Options=None, X_Powered_By=None, X_UA_Compatible=None): @@ -1393,7 +1392,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class HTTPMessageType(GeneratedsSuper): """The HTTPMessageType captures a single HTTP message body and its length.""" - + subclass = None superclass = None def __init__(self, Length=None, Message_Body=None): @@ -1471,7 +1470,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class HTTPStatusLineType(GeneratedsSuper): """The HTTPStatusLineType captures a single HTTP response status line.""" - + subclass = None superclass = None def __init__(self, Version=None, Status_Code=None, Reason_Phrase=None): @@ -1560,7 +1559,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class HostFieldType(GeneratedsSuper): """The HostFieldType captures the details of the HTTP request Host header field.""" - + subclass = None superclass = None def __init__(self, Domain_Name=None, Port=None): @@ -1637,7 +1636,7 @@ class HTTPMethodType(cybox_common.BaseObjectPropertyType): (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -1706,7 +1705,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class HTTPSessionObjectType(cybox_common.ObjectPropertiesType): """The HTTPSessionObjectType is intended to capture the details of an HTTP session.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, HTTP_Request_Response=None): @@ -1949,7 +1948,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -1995,7 +1994,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/image_file_object.py b/cybox/bindings/image_file_object.py index 7cec5e69..054435cd 100644 --- a/cybox/bindings/image_file_object.py +++ b/cybox/bindings/image_file_object.py @@ -4,9 +4,8 @@ import sys from cybox.bindings import * -import cybox_common - -import file_object +from . import cybox_common +from . import file_object class ImageFileFormatType(cybox_common.BaseObjectPropertyType): @@ -355,7 +354,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -401,7 +400,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/library_object.py b/cybox/bindings/library_object.py index c417f0bd..56187583 100644 --- a/cybox/bindings/library_object.py +++ b/cybox/bindings/library_object.py @@ -4,7 +4,7 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class LibraryType(cybox_common.BaseObjectPropertyType): @@ -77,7 +77,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class LibraryObjectType(cybox_common.ObjectPropertiesType): """The LibraryObjectType type is intended to characterize software libraries.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Name=None, Path=None, Size=None, Type=None, Version=None, Base_Address=None, Extracted_Features=None): @@ -316,7 +316,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -362,7 +362,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/link_object.py b/cybox/bindings/link_object.py index 77fc6510..4caafec5 100644 --- a/cybox/bindings/link_object.py +++ b/cybox/bindings/link_object.py @@ -4,13 +4,12 @@ import sys from cybox.bindings import * -import cybox_common - -import uri_object +from . import cybox_common +from . import uri_object class URLLabelType(cybox_common.StringObjectPropertyType): - + subclass = None superclass = None def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, pattern_type=None, datatype='string', refanging_transform=None, bit_mask=None, appears_random=None, trend=None, defanging_algorithm_ref=None, is_obfuscated=None, regex_syntax=None, apply_condition='ANY', idref=None, is_defanged=None, id=None, condition=None, valueOf_=None, extensiontype_=None): @@ -144,7 +143,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -190,7 +189,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/linux_package_object.py b/cybox/bindings/linux_package_object.py index 4fa53a62..fe49040a 100644 --- a/cybox/bindings/linux_package_object.py +++ b/cybox/bindings/linux_package_object.py @@ -4,13 +4,13 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class LinuxPackageObjectType(cybox_common.ObjectPropertiesType): """The LinuxPackageObjectType type is intended to characterize Linux packages.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Architecture=None, Category=None, Description=None, Epoch=None, EVR=None, Name=None, Release=None, Vendor=None, Version=None): @@ -264,7 +264,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -310,7 +310,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/memory_object.py b/cybox/bindings/memory_object.py index ff5bc488..e7f866d1 100644 --- a/cybox/bindings/memory_object.py +++ b/cybox/bindings/memory_object.py @@ -4,7 +4,7 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class BlockType(cybox_common.BaseObjectPropertyType): @@ -396,7 +396,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -442,7 +442,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/mutex_object.py b/cybox/bindings/mutex_object.py index 144f65c8..bfed3e83 100644 --- a/cybox/bindings/mutex_object.py +++ b/cybox/bindings/mutex_object.py @@ -4,14 +4,14 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class MutexObjectType(cybox_common.ObjectPropertiesType): """The MutexObjectType type is intended to characterize generic mutual exclusion (mutex) objects.The named field specifies whether the Mutex is named.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, named=None, Name=None): @@ -191,7 +191,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -237,7 +237,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/network_connection_object.py b/cybox/bindings/network_connection_object.py index 1ea83832..97f504b6 100644 --- a/cybox/bindings/network_connection_object.py +++ b/cybox/bindings/network_connection_object.py @@ -4,18 +4,17 @@ import sys from cybox.bindings import * -import cybox_common - -import dns_query_object -import http_session_object -import socket_address_object +from . import cybox_common +from . import dns_query_object +from . import http_session_object +from . import socket_address_object class Layer7ConnectionsType(GeneratedsSuper): """The Layer7ConnectionsType specifies the different types of application (layer 7 in the OSI model) connections that may be initiated as part of the network connection.""" - + subclass = None superclass = None def __init__(self, HTTP_Session=None, DNS_Query=None): @@ -97,7 +96,7 @@ class Layer7ProtocolType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -170,7 +169,7 @@ class Layer3ProtocolType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -242,7 +241,7 @@ class NetworkConnectionObjectType(cybox_common.ObjectPropertiesType): connections.The tls_used field specifies whether or not Transport Layer Security (TLS) is used in the network connection.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, tls_used=None, Creation_Time=None, Layer3_Protocol=None, Layer4_Protocol=None, Layer7_Protocol=None, Source_Socket_Address=None, Source_TCP_State=None, Destination_Socket_Address=None, Destination_TCP_State=None, Layer7_Connections=None): @@ -613,7 +612,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -659,7 +658,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/network_flow_object.py b/cybox/bindings/network_flow_object.py index 6afdeefa..002a7e4c 100644 --- a/cybox/bindings/network_flow_object.py +++ b/cybox/bindings/network_flow_object.py @@ -4,17 +4,16 @@ import sys from cybox.bindings import * -import cybox_common - -import address_object -import network_packet_object -import socket_address_object +from . import cybox_common +from . import address_object +from . import network_packet_object +from . import socket_address_object class NetworkLayerInfoType(GeneratedsSuper): """Network layer information (relative to the OSI network model) which is typically captured in all types of network flow records.""" - + subclass = None superclass = None def __init__(self, Src_Socket_Address=None, Dest_Socket_Address=None, IP_Protocol=None, extensiontype_=None): @@ -117,7 +116,7 @@ class NetworkFlowLabelType(NetworkLayerInfoType): include it for organizational purposes. Because these fields are defined here, they are excluded from the fields associated directly with each different flow record format type.""" - + subclass = None superclass = NetworkLayerInfoType def __init__(self, Src_Socket_Address=None, Dest_Socket_Address=None, IP_Protocol=None, Ingress_Interface_Index=None, Egress_Interface_Index=None, IP_Type_Of_Service=None): @@ -209,7 +208,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class UnidirectionalRecordType(GeneratedsSuper): """Netflow record formats that capture traffic in one direction.""" - + subclass = None superclass = None def __init__(self, IPFIX_Message=None, NetflowV9_Export_Packet=None, NetflowV5_Packet=None, SiLK_Record=None): @@ -305,7 +304,7 @@ class BidirectionalRecordType(GeneratedsSuper): supports bidirectional flows, and as such, is usually used as an alternative to NetFlow v5 analysis via SiLK (http://www.qosient.com/argus/).""" - + subclass = None superclass = None def __init__(self, YAF_Record=None): @@ -368,7 +367,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class IPFIXMessageType(GeneratedsSuper): """The IPFIX protocol provides IP flow information. http://tools.ietf.org/html/rfc5101""" - + subclass = None superclass = None def __init__(self, Message_Header=None, Set=None): @@ -449,7 +448,7 @@ class IPFIXMessageHeaderType(GeneratedsSuper): 5101 (http://tools.ietf.org/html/rfc5101) under the heading, "Message Header Field Descriptions." Note that common elements are included in the Network_Flow_Label.""" - + subclass = None superclass = None def __init__(self, Version=None, Byte_Length=None, Export_Timestamp=None, Sequence_Number=None, Observation_Domain_ID=None): @@ -560,7 +559,7 @@ class IPFIXSetType(GeneratedsSuper): an IPFIX message. See RFC 5101 and look for the terms "Template Set", "Options Template Set", and "Data Set", for more information.""" - + subclass = None superclass = None def __init__(self, Template_Set=None, Options_Template_Set=None, Data_Set=None): @@ -645,7 +644,7 @@ class IPFIXTemplateSetType(GeneratedsSuper): the Set Header, the collection of Template Records, and the optional padding at the end of the Template Set. See RFC 5101 under Set Format, which is section 3.3.1, for more information.""" - + subclass = None superclass = None def __init__(self, Set_Header=None, Template_Record=None, Padding=None): @@ -739,7 +738,7 @@ class IPFIXOptionsTemplateSetType(GeneratedsSuper): Records, and the optional padding at the end of the Options Template Set. See RFC 5101 under Set Format, which is section 3.3.1, for more information.""" - + subclass = None superclass = None def __init__(self, Set_Header=None, Options_Template_Record=None, Padding=None): @@ -832,7 +831,7 @@ class IPFIXDataSetType(GeneratedsSuper): Set Header, the collection of Data Records, and the optional padding at the end of the Data Set. See RFC 5101 under Set Format, which is section 3.3.1, for more information.""" - + subclass = None superclass = None def __init__(self, Set_Header=None, Data_Record=None, Padding=None): @@ -922,7 +921,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class IPFIXSetHeaderType(GeneratedsSuper): """Defines the elements of the IPFIX set header.""" - + subclass = None superclass = None def __init__(self, Set_ID=None, Length=None): @@ -1000,7 +999,7 @@ class IPFIXTemplateRecordType(GeneratedsSuper): the Template Record Header, and the Field Specifiers. See RFC 5101 under Template Record Format, section 3.4.1, for more information.""" - + subclass = None superclass = None def __init__(self, Template_Record_Header=None, Field_Specifier=None): @@ -1078,7 +1077,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class IPFIXTemplateRecordHeaderType(GeneratedsSuper): """Specifies the fields in a Template Record Header, Template_ID and Field_Count, as explained in RFC 5101, section 3.4.1.""" - + subclass = None superclass = None def __init__(self, Template_ID=None, Field_Count=None): @@ -1157,7 +1156,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class IPFIXTemplateRecordFieldSpecifiersType(GeneratedsSuper): """Specifies the fields in a Template Record Field Specifier, as explained in RFC 5101, section 3.2.""" - + subclass = None superclass = None def __init__(self, Enterprise_Bit=None, Information_Element_ID=None, Field_Length=None, Enterprise_Number=None): @@ -1262,7 +1261,7 @@ class IPFIXOptionsTemplateRecordType(GeneratedsSuper): are two: the Options Template Record Header, and the Field Specifiers. See RFC 5101 under Options Template Record Format, section 3.4.2.2, for more information.""" - + subclass = None superclass = None def __init__(self, Options_Template_Record_Header=None, Field_Specifier=None): @@ -1339,7 +1338,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class IPFIXOptionsTemplateRecordHeaderType(GeneratedsSuper): """Defines the ehader of an options template record.""" - + subclass = None superclass = None def __init__(self, Template_ID=None, Field_Count=None, Scope_Field_Count=None): @@ -1433,7 +1432,7 @@ class IPFIXOptionsTemplateRecordFieldSpecifiersType(GeneratedsSuper): as explained in RFC 5101, sections 3.2 and 3.4.2.2. It consists of two sequences: Scope Fields and Option Fields, appended together.""" - + subclass = None superclass = None def __init__(self, Scope_Enterprise_Bit=None, Scope_Information_Element_ID=None, Scope_Field_Length=None, Scope_Enterprise_Number=None, Option_Enterprise_Bit=None, Option_Information_Element_ID=None, Option_Field_Length=None, Option_Enterprise_Number=None): @@ -1586,7 +1585,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class IPFIXDataRecordType(GeneratedsSuper): """Data records are sent in data sets. A data record consists of only one more more Field values.""" - + subclass = None superclass = None def __init__(self, Field_Value=None): @@ -1657,7 +1656,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class NetflowV9ExportPacketType(GeneratedsSuper): """Netflow v9 was developed by Cisco and provides acess to IP flow information. http://www.ietf.org/rfc/rfc3954.txt""" - + subclass = None superclass = None def __init__(self, Packet_Header=None, Flow_Set=None): @@ -1736,7 +1735,7 @@ class NetflowV9PacketHeaderType(GeneratedsSuper): """Header fields defined for Netflow v9. Note that common elements are included in the Network_Flow_Label. http://www.ietf.org/rfc/rfc3954.txt""" - + subclass = None superclass = None def __init__(self, Version=None, Record_Count=None, Sys_Up_Time=None, Unix_Secs=None, Sequence_Number=None, Source_ID=None): @@ -1857,7 +1856,7 @@ class NetflowV9FlowSetType(GeneratedsSuper): There are three differnet types of FlowSets, as defined in RFC 3954: a Template FlowSet, Options Template FlowSet and Data FlowSet.""" - + subclass = None superclass = None def __init__(self, Template_Flow_Set=None, Options_Template_Flow_Set=None, Data_Flow_Set=None): @@ -1939,7 +1938,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class NetflowV9TemplateFlowSetType(GeneratedsSuper): """Provides the format of the Template FlowSet.""" - + subclass = None superclass = None def __init__(self, Flow_Set_ID=None, Length=None, Template_Record=None): @@ -2034,7 +2033,7 @@ class NetflowV9TemplateRecordType(GeneratedsSuper): """Specifies the Template Record region, which includes the template ID, field count, field type, and field length.Number of fields corresponds to Count field.""" - + subclass = None superclass = None def __init__(self, Template_ID=None, Field_Count=None, Field_Type=None, Field_Length=None): @@ -2137,7 +2136,7 @@ class NetflowV9OptionsTemplateFlowSetType(GeneratedsSuper): """Specifies an Options Template FlowSet, which is one or more Options Template Records that have been grouped together in an Export Packet.""" - + subclass = None superclass = None def __init__(self, Flow_Set_ID=None, Length=None, Options_Template_Record=None, Padding=None): @@ -2242,7 +2241,7 @@ class NetflowV9OptionsTemplateRecordType(GeneratedsSuper): """Specifies the Options Template Record region, which includes the Option Scope Length, Option Length, and fields specifying the Scope field type and Scope field length.""" - + subclass = None superclass = None def __init__(self, Template_ID=None, Option_Scope_Length=None, Option_Length=None, Scope_Field_Type=None, Scope_Field_Length=None, Option_Field_Type=None, Option_Field_Length=None): @@ -2380,7 +2379,7 @@ class NetflowV9DataFlowSetType(GeneratedsSuper): is either a Flow Data Record or an Options Data Record previously defined by a Template Record or an Options Template Record. http://www.ietf.org/rfc/rfc3954.txt""" - + subclass = None superclass = None def __init__(self, Flow_Set_ID_Template_ID=None, Length=None, Data_Record=None, Padding=None): @@ -2487,7 +2486,7 @@ class NetflowV9DataRecordType(GeneratedsSuper): Flow Data Record or an Options Data Record previously defined by a Template Record or an Options Template Record. http://www.ietf.org/rfc/rfc3954.txt""" - + subclass = None superclass = None def __init__(self, Flow_Data_Record=None, Options_Data_Record=None): @@ -2570,7 +2569,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class FlowDataRecordType(GeneratedsSuper): """A Flow Data Record is a data record that contains values of the Flow parameters corresponding to a Template Record.""" - + subclass = None superclass = None def __init__(self, Flow_Record_Collection_Element=None): @@ -2638,7 +2637,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class FlowCollectionElementType(GeneratedsSuper): """Field values are associated with each record in the collection of a flow data record.""" - + subclass = None superclass = None def __init__(self, Flow_Record_Field_Value=None): @@ -2710,7 +2709,7 @@ class OptionsDataRecordType(GeneratedsSuper): """The data record that contains values and scope information of the Flow measurement parameters, corresponding to an Options Template Record.""" - + subclass = None superclass = None def __init__(self, Scope_Field_Value=None, Option_Record_Collection_Element=None): @@ -2791,7 +2790,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class OptionCollectionElementType(GeneratedsSuper): """Field values are associatedwith each option in the collection of an option data record.""" - + subclass = None superclass = None def __init__(self, Option_Record_Field_Value=None): @@ -2864,7 +2863,7 @@ class NetflowV5PacketType(GeneratedsSuper): is still the most commonly used network flow format. Netflow v5 was developed by Cisco. http://netflow.caligare.com/netflow_v5.htm""" - + subclass = None superclass = None def __init__(self, Flow_Header=None, Flow_Record=None): @@ -2942,7 +2941,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class NetflowV5FlowHeaderType(GeneratedsSuper): """Defines elements of a netflow v5 header. http://netflow.caligare.com/netflow_v5.htm""" - + subclass = None superclass = None def __init__(self, Version=None, Count=None, Sys_Up_Time=None, Unix_Secs=None, Unix_Nsecs=None, Flow_Sequence=None, Engine_Type=None, Engine_ID=None, Sampling_Interval=None): @@ -3099,7 +3098,7 @@ class NetflowV5FlowRecordType(GeneratedsSuper): elements that define the flow itself (e.g., source IP address) are provided in NetworkFlowLabelType. https://bto.bluecoat.com/p acketguide/8.6/info/netflow5-records.htm""" - + subclass = None superclass = None def __init__(self, Nexthop_IPv4_Addr=None, Packet_Count=None, Byte_Count=None, SysUpTime_Start=None, SysUpTime_End=None, Padding1=None, TCP_Flags=None, Src_Autonomous_System=None, Dest_Autonomous_System=None, Src_IP_Mask_Bit_Count=None, Dest_IP_Mask_Bit_Count=None, Padding2=None): @@ -3286,7 +3285,7 @@ class SiLKRecordType(GeneratedsSuper): source IP, SNMP ingress, etc.). For additional references, see http://tools.netsa.cert.org/silk/analysis-handbook.pdf, http://tools.netsa.cert.org/silk/faq.html#ipfix-fields.""" - + subclass = None superclass = None def __init__(self, Packet_Count=None, Byte_Count=None, TCP_Flags=None, Start_Time=None, Duration=None, End_Time=None, Sensor_Info=None, ICMP_Type=None, ICMP_Code=None, Router_Next_Hop_IP=None, Initial_TCP_Flags=None, Session_TCP_Flags=None, Flow_Attributes=None, Flow_Application=None, Src_IP_Type=None, Dest_IP_Type=None, Src_Country_Code=None, Dest_Country_Code=None, Src_MAPNAME=None, Dest_MAPNAME=None): @@ -3559,7 +3558,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class SiLKSensorInfoType(GeneratedsSuper): """Defines elements associated with a SiLK sensor.""" - + subclass = None superclass = None def __init__(self, Sensor_ID=None, Class=None, Type=None): @@ -3655,7 +3654,7 @@ class YAFRecordType(GeneratedsSuper): into bidirectional flows, then exports those flows to IPFIX. (REF: http://www.usenix.org/event/lisa10/tech/full_papers/Inacio.pdf)""" - + subclass = None superclass = None def __init__(self, Flow=None, Reverse_Flow=None): @@ -3730,7 +3729,7 @@ class YAFFlowType(GeneratedsSuper): to the forward portion of the flow. Elements common to all network flow objects are defined in the NetworkFlowLabelType (src ip address, ingress/egress interface).""" - + subclass = None superclass = None def __init__(self, Flow_Start_Milliseconds=None, Flow_End_Milliseconds=None, Octet_Total_Count=None, Packet_Total_Count=None, Flow_End_Reason=None, SiLK_App_Label=None, Payload_Entropy=None, ML_App_Label=None, TCP_Flow=None, Vlan_ID_MAC_Addr=None, Passive_OS_Fingerprinting=None, First_Packet_Banner=None, Second_Packet_Banner=None, N_Bytes_Payload=None): @@ -3929,7 +3928,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class YAFReverseFlowType(GeneratedsSuper): """These elements correspond to the reverse flow captured by in YAF record.""" - + subclass = None superclass = None def __init__(self, Reverse_Octet_Total_Count=None, Reverse_Packet_Total_Count=None, Reverse_Payload_Entropy=None, Reverse_Flow_Delta_Milliseconds=None, TCP_Reverse_Flow=None, Reverse_Vlan_ID_MAC_Addr=None, Reverse_Passive_OS_Fingerprinting=None, Reverse_First_Packet=None, Reverse_N_Bytes_Payload=None): @@ -4077,7 +4076,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class YAFTCPFlowType(GeneratedsSuper): """Contains TCP-related information of the network flow.""" - + subclass = None superclass = None def __init__(self, TCP_Sequence_Number=None, Initial_TCP_Flags=None, Union_TCP_Flags=None): @@ -4170,7 +4169,7 @@ class SiLKSensorClassType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -4243,7 +4242,7 @@ class SiLKDirectionType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -4317,7 +4316,7 @@ class SiLKCountryCodeType(cybox_common.BaseObjectPropertyType): expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -4390,7 +4389,7 @@ class SiLKAddressType(cybox_common.BaseObjectPropertyType): complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -4463,7 +4462,7 @@ class SiLKFlowAttributesType(cybox_common.BaseObjectPropertyType): for permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -4537,7 +4536,7 @@ class NetflowV9ScopeFieldType(cybox_common.BaseObjectPropertyType): expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -4611,7 +4610,7 @@ class NetflowV9FieldType(cybox_common.BaseObjectPropertyType): expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -4683,7 +4682,7 @@ class NetworkFlowObjectType(cybox_common.ObjectPropertiesType): payload data (i.e. the actual data that was uploaded/downloaded to and from the Dest IP to Source IP as included in packet monitoring tools, such as Wireshark).""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Network_Flow_Label=None, Unidirectional_Flow_Record=None, Bidirectional_Flow_Record=None): @@ -5110,7 +5109,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -5156,7 +5155,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/network_packet_object.py b/cybox/bindings/network_packet_object.py index 549c8330..1863f015 100644 --- a/cybox/bindings/network_packet_object.py +++ b/cybox/bindings/network_packet_object.py @@ -4,16 +4,15 @@ import sys from cybox.bindings import * -import cybox_common - -import address_object -import port_object +from . import cybox_common +from . import address_object +from . import port_object class LinkLayerType(GeneratedsSuper): """A link layer protocol is a hardware interface protocol, such as Ethernet, or a logical link routing protocol, such as ARP.""" - + subclass = None superclass = None def __init__(self, Physical_Interface=None, Logical_Protocols=None): @@ -86,7 +85,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PhysicalInterfaceType(GeneratedsSuper): """Multiple interface types exist - only most common (Ethernet) included now. Others will be added later as needed.""" - + subclass = None superclass = None def __init__(self, Ethernet=None): @@ -149,7 +148,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class LogicalProtocolType(GeneratedsSuper): """Logical Protocols characterizes the logical protocol of a link layer connection. One example of a logical protocol is ARP.""" - + subclass = None superclass = None def __init__(self, ARP_RARP=None, NDP=None): @@ -223,7 +222,7 @@ class EthernetInterfaceType(GeneratedsSuper): """Ethernet sends network packets from the sending host to one or more receiving hosts. (REF: IEEE 802.3; http://wiki.wireshark.org/Ethernet)""" - + subclass = None superclass = None def __init__(self, Ethernet_Header=None): @@ -287,7 +286,7 @@ class EthernetHeaderType(GeneratedsSuper): """Ethernet header characterizes and ethernet header and includes information such as source MAC address, destination MAC address, and more.""" - + subclass = None superclass = None def __init__(self, Destination_MAC_Addr=None, Source_MAC_Addr=None, Type_Or_Length=None, Checksum=None): @@ -383,7 +382,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class TypeLengthType(GeneratedsSuper): """0-1500 then it is a length field. Otherwise, it defines the protocol type of the Internet layer.""" - + subclass = None superclass = None def __init__(self, Length=None, Internet_Layer_Type=None): @@ -466,7 +465,7 @@ class ARPType(GeneratedsSuper): internetwork nodes. This property places ARP into the Link Layer. It is encapsulated. REF: http://www.comptechdoc.org/indep endent/networking/guide/netarp.html""" - + subclass = None superclass = None def __init__(self, Hardware_Addr_Type=None, Proto_Addr_Type=None, Hardware_Addr_Size=None, Proto_Addr_Size=None, Op_Type=None, Sender_Hardware_Addr=None, Sender_Protocol_Addr=None, Recip_Hardware_Addr=None, Recip_Protocol_Addr=None): @@ -622,7 +621,7 @@ class NDPType(GeneratedsSuper): """NDP Type characterizes NDP (Neighbor Discover Protocol) IPv6 packets. NDP defines five ICMPv6 packet types. RFC 2461: http://tools.ietf.org/html/rfc4861""" - + subclass = None superclass = None def __init__(self, ICMPv6_Header=None, Router_Solicitation=None, Router_Advertisement=None, Neighbor_Solicitation=None, Neighbor_Advertisement=None, Redirect=None): @@ -735,7 +734,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class RouterSolicitationType(GeneratedsSuper): """Hosts send Router Solicitations in order to prompt routers to generate Router Advertisements quickly.(type=133; code=0)""" - + subclass = None superclass = None def __init__(self, Options=None): @@ -803,7 +802,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class RouterSolicitationOptionsType(GeneratedsSuper): """Neighbor Discovery messages include zero or more options, some of which may appear multiple times in the same message.""" - + subclass = None superclass = None def __init__(self, Src_Link_Addr=None): @@ -875,7 +874,7 @@ class RouterAdvertisementType(GeneratedsSuper): available via DHCPv6. Examples of such information are DNS- related information or information on other servers within the network.""" - + subclass = None superclass = None def __init__(self, other_config_flag=None, managed_address_config_flag=None, Cur_Hop_Limit=None, Router_Lifetime=None, Reachable_Time=None, Retrans_Timer=None, Options=None): @@ -1009,7 +1008,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class RouterAdvertisementOptionsType(GeneratedsSuper): """Router Advertisement messages include zero or more options, some of which may appear multiple times in the same message.""" - + subclass = None superclass = None def __init__(self, Src_Link_Addr=None, MTU=None, Prefix_Info=None): @@ -1096,7 +1095,7 @@ class NeighborSolicitationType(GeneratedsSuper): the node needs to resolve an address and unicast when the node seeks to verify the reachability of a neighbor. (type=135; code=0)""" - + subclass = None superclass = None def __init__(self, Target_IPv6_Addr=None, Options=None): @@ -1169,7 +1168,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class NeighborSolicitationOptionsType(GeneratedsSuper): """Neighbor Solicitation messages include zero or more options, some of which may appear multiple times in the same message.""" - + subclass = None superclass = None def __init__(self, Src_Link_Addr=None): @@ -1243,7 +1242,7 @@ class NeighborAdvertisementType(GeneratedsSuper): Detection.Override flag. When set, the O-bit indicates that the advertisement should override an existing cache entry and update the cached link-layer address.""" - + subclass = None superclass = None def __init__(self, override_flag=None, router_flag=None, solicited_flag=None, Target_IPv6_Addr=None, Options=None): @@ -1359,7 +1358,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class NeighborOptionsType(GeneratedsSuper): """Neighbor Advertisement messages include zero or more options, some of which may appear multiple times in the same message.""" - + subclass = None superclass = None def __init__(self, Target_Link_Addr=None): @@ -1426,7 +1425,7 @@ class RedirectType(GeneratedsSuper): that the destination is in fact a neighbor. The latter is accomplished by setting the ICMP Target Address equal to the ICMP Destination Address. (type=137; code=0)""" - + subclass = None superclass = None def __init__(self, Target_IPv6_Addr=None, Dest_IPv6_Addr=None, Options=None): @@ -1509,7 +1508,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class RedirectOptionsType(GeneratedsSuper): """Redirect messages include zero or more options, some of which may appear multiple times in the same message.""" - + subclass = None superclass = None def __init__(self, Target_Link_Addr=None, Redirected_Header=None): @@ -1662,7 +1661,7 @@ class NDPPrefixInfoType(GeneratedsSuper): properties of the prefix.1-bit autonomous address-configuration flag. When set indicates that this prefix can be usd for stateless address configuration.""" - + subclass = None superclass = None def __init__(self, addr_config_flag=None, link_flag=None, Length=None, Prefix_Length=None, Valid_Lifetime=None, Preferred_Lifetime=None, Prefix=None): @@ -1797,7 +1796,7 @@ class NDPRedirectedHeaderType(GeneratedsSuper): """The redirected header option is used in redirect messages and contains all or part of the packet that is being redirected. (type=4)""" - + subclass = None superclass = None def __init__(self, Length=None, IPHeader_And_Data=None): @@ -1877,7 +1876,7 @@ class NDPMTUType(GeneratedsSuper): """The MTU option is used in Router Advertisement messages to ensure that all nodes on a link use the same MTU value in those cases where the link MTU is not well known. (type=5).""" - + subclass = None superclass = None def __init__(self, Length=None, MTU=None): @@ -1957,7 +1956,7 @@ class InternetLayerType(GeneratedsSuper): currently defined, just those most commonly used: IPv4, ICMPv4, IPv6, ICMPv6. Other protocols will be added as needed. (http://en.wikipedia.org/wiki/Internet_layer)""" - + subclass = None superclass = None def __init__(self, IPv4=None, ICMPv4=None, IPv6=None, ICMPv6=None): @@ -2051,7 +2050,7 @@ class IPv4PacketType(GeneratedsSuper): """Internet Protocol version 4 (IPv4) is a connectionless protocol for use on packet-switched link layer networks (e.g., Ethernet). REF: RFC 791; http://en.wikipedia.org/wiki/IPv4.""" - + subclass = None superclass = None def __init__(self, IPv4_Header=None, Data=None): @@ -2129,7 +2128,7 @@ class IPv4HeaderType(GeneratedsSuper): in the header to fragment and reassemble internet datagrams when necessary for transmission through small packet networks. REF: RFC 791.""" - + subclass = None superclass = None def __init__(self, IP_Version=None, Header_Length=None, DSCP=None, ECN=None, Total_Length=None, Identification=None, Flags=None, Fragment_Offset=None, TTL=None, Protocol=None, Checksum=None, Src_IPv4_Addr=None, Dest_IPv4_Addr=None, Option=None): @@ -2344,7 +2343,7 @@ class IPv4FlagsType(GeneratedsSuper): packet. It is a three-bit field, each of the three bits are defined by a field with a string value that indicates the meaning of whether or not the bit is set.""" - + subclass = None superclass = None def __init__(self, Reserved=None, Do_Not_Fragment=None, More_Fragments=None): @@ -2436,7 +2435,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class IPv4OptionType(GeneratedsSuper): """The IPv4 option field is variable in length with zero or more options.""" - + subclass = None superclass = None def __init__(self, Copy_Flag=None, Class=None, Option=None): @@ -2530,7 +2529,7 @@ class IPv6PacketType(GeneratedsSuper): like IPv4 it is a connectionless protocol for use on packet- switched link layer networks. RFC 3513, RFC 2460, http://en.wikipedia.org/wiki/IPv6.""" - + subclass = None superclass = None def __init__(self, IPv6_Header=None, Data=None, Ext_Headers=None): @@ -2617,7 +2616,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class IPv6HeaderType(GeneratedsSuper): """The IPv6 header is a simplification of the IPv4 header.""" - + subclass = None superclass = None def __init__(self, IP_Version=None, Traffic_Class=None, Flow_Label=None, Payload_Length=None, Next_Header=None, TTL=None, Src_IPv6_Addr=None, Dest_IPv6_Addr=None): @@ -2766,7 +2765,7 @@ class IPv6ExtHeaderType(GeneratedsSuper): one, or more extension headers, each identified by the Next Header field of the preceding header. http://tools.ietf.org/html/rfc2460""" - + subclass = None superclass = None def __init__(self, Hop_by_Hop_Options=None, Routing=None, Fragment=None, Destination_Options=None, Authentication_Header=None, Encapsulating_Security_Payload=None): @@ -2883,7 +2882,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class IPv6OptionType(GeneratedsSuper): """Specifies the meaning of each bit of the 8-bit IPv6OptionType type.""" - + subclass = None superclass = None def __init__(self, Do_Not_Recogn_Action=None, Packet_Change=None, Option_Byte=None): @@ -2975,7 +2974,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class TransportLayerType(GeneratedsSuper): """only UDP and TCP defined to begin. Other protocols will be defined as necessary.""" - + subclass = None superclass = None def __init__(self, TCP=None, UDP=None): @@ -3049,7 +3048,7 @@ class TCPType(GeneratedsSuper): """TCP provides reliable, ordered delivery of a stream of bytes from a prograom on one computer to another program on another computer. http://en.wikipedia.org/wiki/Transmission_Control_Protocol""" - + subclass = None superclass = None def __init__(self, TCP_Header=None, Options=None, Data=None): @@ -3139,7 +3138,7 @@ class UDPType(GeneratedsSuper): datagrams may arrive out of order, appear duplicated, or go missing without notice. http://en.wikipedia.org/wiki/User_Datagram_Protocol""" - + subclass = None superclass = None def __init__(self, UDP_Header=None, Data=None): @@ -3213,7 +3212,7 @@ class TCPHeaderType(GeneratedsSuper): """The TCP header contains 10 mandatory fields and an optional extension field. http://en.wikipedia.org/wiki/Transmission_Control_Protocol""" - + subclass = None superclass = None def __init__(self, Src_Port=None, Dest_Port=None, Seq_Num=None, ACK_Num=None, Data_Offset=None, Reserved=None, TCP_Flags=None, Window=None, Checksum=None, Urg_Ptr=None): @@ -3388,7 +3387,7 @@ class TCPFlagsType(GeneratedsSuper): packet sent from each end should have this flag set. http://en.wikipedia.org/wiki/Transmission_Control_ProtocolIf this flag is set, it means there is no more data from sender.""" - + subclass = None superclass = None def __init__(self, ece=None, urg=None, ack=None, cwr=None, psh=None, syn=None, rst=None, ns=None, fin=None): @@ -3572,7 +3571,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class UDPHeaderType(GeneratedsSuper): """The UDP header type defines the four fields in the UDP header.""" - + subclass = None superclass = None def __init__(self, SrcPort=None, DestPort=None, Length=None, Checksum=None): @@ -3673,7 +3672,7 @@ class ICMPv4PacketType(GeneratedsSuper): its destination), informational messages ( e.g., timestamp information), or a traceroute message. REF: http://www.networksorcery.com/enp/protocol/icmp.htm""" - + subclass = None superclass = None def __init__(self, ICMPv4_Header=None, Error_Msg=None, Info_Msg=None, Traceroute=None): @@ -3766,7 +3765,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv4HeaderType(GeneratedsSuper): """Actual ICMP header bytes are defined, corresponding to the ICMP type, ICMP code, and to the checksum.""" - + subclass = None superclass = None def __init__(self, Type=None, Code=None, Checksum=None): @@ -3852,7 +3851,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv4ErrorMessageType(GeneratedsSuper): """ICMP error messages include destination unreachable messages, source quench messages, redirect messages, and time exceeded messages.""" - + subclass = None superclass = None def __init__(self, Destination_Unreachable=None, Source_Quench=None, Redirect_Message=None, Time_Exceeded=None, Error_Msg_Content=None): @@ -3955,7 +3954,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv4ErrorMessageContentType(GeneratedsSuper): """Elements associated with ICMPv4 error messages (as opposed to ICMP informational messages or ICMP traceroute message).""" - + subclass = None superclass = None def __init__(self, IP_Header=None, First_Eight_Bytes=None): @@ -4031,7 +4030,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv4InfoMessageType(GeneratedsSuper): """ICMP informational messages include echo request/reply, timestamp request/reply, and address mask request/reply.""" - + subclass = None superclass = None def __init__(self, Echo_Reply=None, Echo_Request=None, Timestamp_Request=None, Timestamp_Reply=None, Address_Mask_Request=None, Address_Mask_Reply=None, Info_Msg_Content=None): @@ -4154,7 +4153,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv4InfoMessageContentType(GeneratedsSuper): """Elements associated with ICMPv4 informational messages (as opposed to ICMP error messages or ICMP traceroute message).""" - + subclass = None superclass = None def __init__(self, Identifier=None, Sequence_Number=None): @@ -4232,7 +4231,7 @@ class ICMPv4TracerouteType(GeneratedsSuper): ICMP error messages or ICMP informational messages); corresponds to ICMP type =30. (http://www.networksorcery.com/enp/protocol/icmp/msg30.htm)""" - + subclass = None superclass = None def __init__(self, Outbound_Packet_Forward_Success=None, Outbound_Packet_no_Route=None, Identifier=None, Outbound_Hop_Count=None, Return_Hop_Count=None, Output_Link_Speed=None, Output_Link_MTU=None): @@ -4377,7 +4376,7 @@ class ICMPv6PacketType(GeneratedsSuper): http://tools.ietf.org/html/rfc4443 and http://www.networksorcery.com/enp/protocol/icmpv6.htm and http://en.wikipedia.org/wiki/ICMPv6.""" - + subclass = None superclass = None def __init__(self, ICMPv6_Header=None, Error_Msg=None, Info_Msg=None): @@ -4463,7 +4462,7 @@ class ICMPv6HeaderType(GeneratedsSuper): and code byte are defined in text by using boolean values associated with corresponding elements in the informational and error message type elements.""" - + subclass = None superclass = None def __init__(self, Type=None, Code=None, Checksum=None): @@ -4551,7 +4550,7 @@ class ICMPv6ErrorMessageType(GeneratedsSuper): packet too big messages, and time exceeded messages, and parameter problem messages, as defined in RFC 2463. Type values of ICMP v6 error messages range from 1 to 127.""" - + subclass = None superclass = None def __init__(self, Destination_Unreachable=None, Packet_Too_Big=None, Time_Exceeded=None, Parameter_Problem=None, Invoking_Packet=None): @@ -4659,7 +4658,7 @@ class ICMPv6InfoMessageType(GeneratedsSuper): informational message types will be added in the future as they are more commonly used (only echo request/reply are defined in RFC 4443).""" - + subclass = None superclass = None def __init__(self, Echo_Request=None, Echo_Reply=None, Info_Msg_Content=None): @@ -4742,7 +4741,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv6InfoMessageContentType(GeneratedsSuper): """Elements associated with ICMPv6 informational messages (as opposed to ICMP v6 error messages).""" - + subclass = None superclass = None def __init__(self, Identifier=None, Sequence_Number=None): @@ -4817,7 +4816,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv4EchoReplyType(GeneratedsSuper): """Echo reply v4 informational message (used to ping); ICMP type=0.""" - + subclass = None superclass = None def __init__(self, Echo_Reply=None, Data=None): @@ -4898,7 +4897,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv4DestinationUnreachableType(GeneratedsSuper): """Destination Unreachable error message; ICMP type=3.""" - + subclass = None superclass = None def __init__(self, Destination_Network_Unreachable=None, Destination_Host_Unreachable=None, Destination_Protocol_Unreachable=None, Destination_Port_Unreachable=None, Fragmentation_Required=None, Source_Route_Failed=None, Destination_Network_Unknown=None, Destination_Host_Unknown=None, Source_Host_Isolated=None, Network_Administratively_Prohibited=None, Host_Administratively_Prohibited=None, Network_Unreachable_For_TOS=None, Host_Unreachable_For_TOS=None, Communication_Administratively_Prohibited=None, Host_Precedence_Violation=None, Precedence_Cutoff_In_Effect=None): @@ -5217,7 +5216,7 @@ class FragmentationRequiredType(GeneratedsSuper): """This further specifies an ICMP destination unreachable (type=3) message of code=4 (fragmentation required) message by providing a Next-Hop MTU field.""" - + subclass = None superclass = None def __init__(self, Fragmentation_Required=None, Next_Hop_MTU=None): @@ -5298,7 +5297,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv4SourceQuenchType(GeneratedsSuper): """Source Quench (congestion control) error message; ICMP type=4.""" - + subclass = None superclass = None def __init__(self, Source_Quench=None): @@ -5366,7 +5365,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv4RedirectMessageType(GeneratedsSuper): """Redirect Message error message; ICMP type=5.""" - + subclass = None superclass = None def __init__(self, Network_Redirect=None, Host_Redirect=None, ToS_Network_Redirect=None, ToS_Host_Redirect=None, IP_Address=None): @@ -5496,7 +5495,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv4EchoRequestType(GeneratedsSuper): """Echo Request informational message (used to ping); ICMP type=8.""" - + subclass = None superclass = None def __init__(self, Echo_Request=None, Data=None): @@ -5577,7 +5576,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv4TimeExceededType(GeneratedsSuper): """Time Exceeded error message; ICMP type=11.""" - + subclass = None superclass = None def __init__(self, TTL_Exceeded_In_Transit=None, Frag_Reassembly_Time_Exceeded=None): @@ -5663,7 +5662,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv4TimestampRequestType(GeneratedsSuper): """Time Stamp Request informational message; ICMP type=13.""" - + subclass = None superclass = None def __init__(self, Timestamp=None, Originate_Timestamp=None): @@ -5742,7 +5741,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv4TimestampReplyType(GeneratedsSuper): """Time Stamp Reply informational message; ICMP type=14.""" - + subclass = None superclass = None def __init__(self, Timestamp_Reply=None, Originate_Timestamp=None, Receive_Timestamp=None, Transmit_Timestamp=None): @@ -5840,7 +5839,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv4AddressMaskRequestType(GeneratedsSuper): """Address Mask Request informational message; ICMP type=17.""" - + subclass = None superclass = None def __init__(self, Address_Mask_Request=None, Address_Mask=None): @@ -5918,7 +5917,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv4AddressMaskReplyType(GeneratedsSuper): """Address Mask informational message; ICMP type=18.""" - + subclass = None superclass = None def __init__(self, Address_Mask_Reply=None, Address_Mask=None): @@ -5996,7 +5995,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv6DestinationUnreachableType(GeneratedsSuper): """Destination unreachable error message; ICMP v6 type=1.""" - + subclass = None superclass = None def __init__(self, No_Route=None, Comm_Prohibited=None, Beyond_Scope=None, Address_Unreachable=None, Port_Unreachable=None, Src_Addr_Failed_Policy=None, Reject_Route=None): @@ -6167,7 +6166,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv6PacketTooBigType(GeneratedsSuper): """Packet too big error message; ICMP v6 type=2.""" - + subclass = None superclass = None def __init__(self, Packet_Too_Big=None, MTU=None): @@ -6248,7 +6247,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv6TimeExceededType(GeneratedsSuper): """Time exceeded error message; ICMP v6 type=3.""" - + subclass = None superclass = None def __init__(self, Hop_Limit_Exceeded=None, Fragment_Reassem_Time_Exceeded=None): @@ -6334,7 +6333,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv6ParameterProblemType(GeneratedsSuper): """Parameter problem error message; ICMP v6 type=4.""" - + subclass = None superclass = None def __init__(self, Erroneous_Header_Field=None, Unrecognized_Next_Header_Type=None, Unrecognized_IPv6_Option=None, Pointer=None): @@ -6450,7 +6449,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv6EchoRequestType(GeneratedsSuper): """Echo request informational ICMP v6 message; type=128.""" - + subclass = None superclass = None def __init__(self, Echo_Request=None, Data=None): @@ -6531,7 +6530,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ICMPv6EchoReplyType(GeneratedsSuper): """Echo reply informational ICMP v6 message; type=129.""" - + subclass = None superclass = None def __init__(self, Echo_Reply=None, Data=None): @@ -6613,7 +6612,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PrefixType(GeneratedsSuper): """Provides an IP address or a prefix of an IP address for NDP for IPv6.""" - + subclass = None superclass = None def __init__(self, IPv6_Addr=None, IP_Addr_Prefix=None): @@ -6687,7 +6686,7 @@ class HopByHopOptionsType(GeneratedsSuper): """Defines fields for the IPv6 Hop-by-Hop Options header which is used to carry optional information that must be examined by every node along a packet's delivery path.""" - + subclass = None superclass = None def __init__(self, Next_Header=None, Header_Ext_Len=None, Option_Data=None): @@ -6783,7 +6782,7 @@ class OptionDataType(GeneratedsSuper): headers (the Hop-by-Hop Options header and the Destination Options header). Contains one or more type-length-value (TLV)-encoded options.""" - + subclass = None superclass = None def __init__(self, Option_Type=None, Option_Data_Len=None, Pad1=None, PadN=None): @@ -6881,7 +6880,7 @@ class RoutingType(GeneratedsSuper): source to list one or more intermediate nodes to be "visited" on the way to a packet's destination. http://tools.ietf.org/html/rfc2460""" - + subclass = None superclass = None def __init__(self, Next_Header=None, Header_Ext_Len=None, Routing_Type=None, Segments_Left=None, Type_Specific_Data=None): @@ -6997,7 +6996,7 @@ class FragmentType(GeneratedsSuper): """Specifies the fields of the Fragment header, which is used by an IPv6 source to send a packet larger than would fit in the path MTU. http://tools.ietf.org/html/rfc2460""" - + subclass = None superclass = None def __init__(self, Fragment_Header=None, Fragment=None): @@ -7074,7 +7073,7 @@ class DestinationOptionsType(GeneratedsSuper): """Defines fields for the IPv6 Destination Options header which is used to carry optional information that needs to be examined only by a packet's destination node(s).""" - + subclass = None superclass = None def __init__(self, Next_Header=None, Header_Ext_Len=None, Option_Data=None): @@ -7170,7 +7169,7 @@ class AuthenticationHeaderType(GeneratedsSuper): integrity and data origin authentication for IP datagrams and to provide protection against replays. http://www.ietf.org/rfc/rfc2402.txt""" - + subclass = None superclass = None def __init__(self, Next_Header=None, Header_Ext_Len=None, Security_Parameters_Index=None, Sequence_Number=None, Authentication_Data=None): @@ -7281,7 +7280,7 @@ class EncapsulatingSecurityPayloadType(GeneratedsSuper): connectionless integrity, an anti-replay service (a form of partial sequence integrity), and limited traffic flow confidentiality. http://www.ietf.org/rfc/rfc2406.txt""" - + subclass = None superclass = None def __init__(self, Security_Parameters_Index=None, Sequence_Number=None, Payload_Data=None, Padding=None, Padding_Len=None, Next_Header=None, Authentication_Data=None): @@ -7411,7 +7410,7 @@ class Pad1Type(GeneratedsSuper): """The Pad1 type specifies how one octet of padding is inserted into the Options area of a header. The Pad1 option type does not have length and value fields.""" - + subclass = None superclass = None def __init__(self, Octet=None): @@ -7477,7 +7476,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PadNType(GeneratedsSuper): """The PadN type specifies how two or more octets of padding are inserted into the Options area of a header.""" - + subclass = None superclass = None def __init__(self, Octet=None, Option_Data_Length=None, Option_Data=None): @@ -7567,7 +7566,7 @@ class FragmentHeaderType(GeneratedsSuper): """Each fragment has a header containing next header information, the offset of the fragment, an M flag specifying whether or not it is the last fragment, and an identification value.""" - + subclass = None superclass = None def __init__(self, Next_Header=None, Fragment_Offset=None, M_Flag=None, Identification=None): @@ -7670,7 +7669,7 @@ class MFlagType(cybox_common.BaseObjectPropertyType): regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -7743,7 +7742,7 @@ class IANAPortNumberRegistryType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -7816,7 +7815,7 @@ class IANAAssignedIPNumbersType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, pattern_type=None, datatype='string', refanging_transform=None, bit_mask=None, appears_random=None, trend=None, defanging_algorithm_ref=None, is_obfuscated=None, regex_syntax=None, apply_condition='ANY', idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -7889,7 +7888,7 @@ class IANAEtherType(cybox_common.BaseObjectPropertyType): (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -7962,7 +7961,7 @@ class IANAHardwareType(cybox_common.BaseObjectPropertyType): (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -8037,7 +8036,7 @@ class IPVersionType(cybox_common.BaseObjectPropertyType): expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -8110,7 +8109,7 @@ class IPv6PacketChangeType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -8184,7 +8183,7 @@ class IPv6DoNotRecogActionType(cybox_common.BaseObjectPropertyType): expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -8257,7 +8256,7 @@ class IPv4OptionsType(cybox_common.BaseObjectPropertyType): regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -8330,7 +8329,7 @@ class IPv4ClassType(cybox_common.BaseObjectPropertyType): regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -8403,7 +8402,7 @@ class IPv4CopyFlagType(cybox_common.BaseObjectPropertyType): (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -8476,7 +8475,7 @@ class MoreFragmentsType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -8549,7 +8548,7 @@ class DoNotFragmentType(cybox_common.BaseObjectPropertyType): (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, pattern_type=None, datatype='string', refanging_transform=None, bit_mask=None, appears_random=None, trend=None, defanging_algorithm_ref=None, is_obfuscated=None, regex_syntax=None, apply_condition='ANY', idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -8622,7 +8621,7 @@ class ARPOpType(cybox_common.BaseObjectPropertyType): regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -8696,7 +8695,7 @@ class NetworkPacketObjectType(cybox_common.ObjectPropertiesType): defines the physical network interfaces and routing protocols. Protocol fields are provided but requirements are not enforced/captured; all fields are optional.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Link_Layer=None, Internet_Layer=None, Transport_Layer=None): @@ -8963,7 +8962,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -9009,7 +9008,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/network_route_entry_object.py b/cybox/bindings/network_route_entry_object.py index 400a9c29..5aa77043 100644 --- a/cybox/bindings/network_route_entry_object.py +++ b/cybox/bindings/network_route_entry_object.py @@ -4,9 +4,8 @@ import sys from cybox.bindings import * -import cybox_common - -import address_object +from . import cybox_common +from . import address_object class RouteType(cybox_common.BaseObjectPropertyType): @@ -16,7 +15,7 @@ class RouteType(cybox_common.BaseObjectPropertyType): regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -93,7 +92,7 @@ class NetworkRouteEntryObjectType(cybox_common.ObjectPropertiesType): the route is the default for all packets sent to local network addresses.The is_publish field specifies whether the route is published.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_publish=None, is_autoconfigure_address=None, is_loopback=None, is_immortal=None, is_ipv6=None, Destination_Address=None, Origin=None, Netmask=None, Gateway_Address=None, Metric=None, Type=None, Protocol=None, Interface=None, Preferred_Lifetime=None, Valid_Lifetime=None, Route_Age=None): @@ -455,7 +454,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -501,7 +500,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/network_route_object.py b/cybox/bindings/network_route_object.py index cac5d50f..ec7c4918 100644 --- a/cybox/bindings/network_route_object.py +++ b/cybox/bindings/network_route_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import network_route_entry_object +from . import cybox_common +from . import network_route_entry_object class NetworkRouteEntriesType(GeneratedsSuper): """The NetworkRouteEntriesType type is intended to characterize the set of network route segments for this route.""" - + subclass = None superclass = None def __init__(self, Network_Route_Entry=None): @@ -86,7 +85,7 @@ class NetRouteObjectType(cybox_common.ObjectPropertiesType): specifies if the route is a loopback route (the gateway is on the local host).The is_publish field specifies if the route is published.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_publish=None, is_autoconfigure_address=None, is_loopback=None, is_immortal=None, is_ipv6=None, Description=None, Network_Route_Entries=None, Preferred_Lifetime=None, Valid_Lifetime=None, Route_Age=None): @@ -375,7 +374,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -421,7 +420,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/network_socket_object.py b/cybox/bindings/network_socket_object.py index 5d71ce5e..4543acc9 100644 --- a/cybox/bindings/network_socket_object.py +++ b/cybox/bindings/network_socket_object.py @@ -4,16 +4,15 @@ import sys from cybox.bindings import * -import cybox_common - -import socket_address_object +from . import cybox_common +from . import socket_address_object class SocketOptionsType(GeneratedsSuper): """The SocketOptionsType specifies any particular options used by the socket. If an options is supported only by specific address families or socket types, that's indicated in parentheses.""" - + subclass = None superclass = None def __init__(self, IP_MULTICAST_IF=None, IP_MULTICAST_IF2=None, IP_MULTICAST_LOOP=None, IP_TOS=None, SO_BROADCAST=None, SO_CONDITIONAL_ACCEPT=None, SO_KEEPALIVE=None, SO_DONTROUTE=None, SO_LINGER=None, SO_DONTLINGER=None, SO_OOBINLINE=None, SO_RCVBUF=None, SO_GROUP_PRIORITY=None, SO_REUSEADDR=None, SO_DEBUG=None, SO_RCVTIMEO=None, SO_SNDBUF=None, SO_SNDTIMEO=None, SO_UPDATE_ACCEPT_CONTEXT=None, SO_TIMEOUT=None, TCP_NODELAY=None): @@ -356,7 +355,7 @@ class ProtocolType(cybox_common.BaseObjectPropertyType): complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -429,7 +428,7 @@ class SocketType(cybox_common.BaseObjectPropertyType): regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -502,7 +501,7 @@ class DomainFamilyType(cybox_common.BaseObjectPropertyType): (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -575,7 +574,7 @@ class AddressFamilyType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -646,7 +645,7 @@ class NetworkSocketObjectType(cybox_common.ObjectPropertiesType): sockets.The is_blocking field specifies whether or not the socket is in blocking mode. The is_listening field specifies whether or not the socket is in listening mode.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_blocking=None, is_listening=None, Address_Family=None, Domain=None, Local_Address=None, Options=None, Protocol=None, Remote_Address=None, Type=None, Socket_Descriptor=None): @@ -937,7 +936,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -983,7 +982,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/network_subnet_object.py b/cybox/bindings/network_subnet_object.py index e705a0f1..6ed1f2fc 100644 --- a/cybox/bindings/network_subnet_object.py +++ b/cybox/bindings/network_subnet_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import address_object -import network_route_entry_object +from . import cybox_common +from . import address_object +from . import network_route_entry_object class RoutesType(GeneratedsSuper): """The RoutesType is intended to characterize a set network routes.""" - + subclass = None superclass = None def __init__(self, Route=None): @@ -80,7 +79,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class NetworkSubnetObjectType(cybox_common.ObjectPropertiesType): """The NetworkSubnetObjectType type is intended to characterize a generic system network subnet.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Name=None, Description=None, Number_Of_IP_Addresses=None, Routes=None): @@ -294,7 +293,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -340,7 +339,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/pdf_file_object.py b/cybox/bindings/pdf_file_object.py index 4519ff4a..417b7cf2 100644 --- a/cybox/bindings/pdf_file_object.py +++ b/cybox/bindings/pdf_file_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import file_object +from . import cybox_common +from . import file_object class PDFXRefTableListType(GeneratedsSuper): """The PDFXrefTableListType captures a list of PDF cross-reference tables.""" - + subclass = None superclass = None def __init__(self, Cross_Reference_Table=None): @@ -81,7 +80,7 @@ class PDFXRefTableType(GeneratedsSuper): """The PDFXRefTableType captures the details of a PDF cross-reference table, which provides a capability for the random access of indirect objects contained in the file.""" - + subclass = None superclass = None def __init__(self, Subsections=None, Offset=None, Hashes=None): @@ -167,7 +166,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PDFXrefTableSubsectionListType(GeneratedsSuper): """The PDFXrefTableSubsectionListType captures a list of cross- reference table subsections.""" - + subclass = None superclass = None def __init__(self, Subsection=None): @@ -235,7 +234,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PDFXrefTableSubsectionType(GeneratedsSuper): """The PDFXrefTableSubsectionType captures details of subsections contained within a PDF cross-reference table.""" - + subclass = None superclass = None def __init__(self, First_Object_Number=None, Number_Of_Objects=None, Cross_Reference_Entries=None): @@ -320,7 +319,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PDFTrailerListType(GeneratedsSuper): """The PDFTrailerListType captures a list of PDF trailers.""" - + subclass = None superclass = None def __init__(self, Trailer=None): @@ -387,7 +386,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PDFTrailerType(GeneratedsSuper): """The PDFTrailerType captures the details of a PDF trailer.""" - + subclass = None superclass = None def __init__(self, Size=None, Prev=None, Root=None, Encrypt=None, Info=None, ID=None, Last_Cross_Reference_Offset=None, Offset=None, Hashes=None): @@ -533,7 +532,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PDFFileIDType(GeneratedsSuper): """The PDFTrailerIDType captures the details of a PDF ID value stored in a trailer.""" - + subclass = None superclass = None def __init__(self, ID_String=None): @@ -604,7 +603,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PDFIndirectObjectListType(GeneratedsSuper): """The PDFIndirectObjectListType captures a list of PDF indirect objects.""" - + subclass = None superclass = None def __init__(self, Indirect_Object=None): @@ -674,7 +673,7 @@ class PDFIndirectObjectType(GeneratedsSuper): object, used in constructing and storing data associated with the PDF document.The type field specifies the basic type of the PDF indirect object.""" - + subclass = None superclass = None def __init__(self, type_=None, ID=None, Contents=None, Offset=None, Hashes=None): @@ -778,7 +777,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PDFIndirectObjectIDType(GeneratedsSuper): """The PDFIndirectObjectIDType captures the details of PDF indirect object IDs.""" - + subclass = None superclass = None def __init__(self, Object_Number=None, Generation_Number=None): @@ -857,7 +856,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PDFIndirectObjectContentsType(GeneratedsSuper): """The PDFIndirectObjectContentsType captures the contents of a PDF indirect object, including both stream and non-stream portions.""" - + subclass = None superclass = None def __init__(self, Non_Stream_Contents=None, Stream_Contents=None): @@ -912,7 +911,7 @@ def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFIndi value = self.Non_Stream_Contents.get_valueOf_() if not value.startswith('' - self.Non_Stream_Contents.set_valueOf_(value) + self.Non_Stream_Contents.set_valueOf_(value) self.Non_Stream_Contents.export(lwrite, level, 'PDFFileObj:', name_='Non_Stream_Contents', pretty_print=pretty_print) if self.Stream_Contents is not None: self.Stream_Contents.export(lwrite, level, 'PDFFileObj:', name_='Stream_Contents', pretty_print=pretty_print) @@ -938,7 +937,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PDFStreamType(GeneratedsSuper): """The PDFStreamType element captures details of PDF document stream objects, which represent arbitrary sequences of bytes.""" - + subclass = None superclass = None def __init__(self, Raw_Stream=None, Raw_Stream_Hashes=None, Decoded_Stream=None, Decoded_Stream_Hashes=None): @@ -1038,7 +1037,7 @@ class PDFDocumentInformationDictionaryType(GeneratedsSuper): """The PDFDocumentInformationDictionaryType captures details of the PDF Document Information Dictionary, used for storing metadata associated with the PDF document.""" - + subclass = None superclass = None def __init__(self, Title=None, Author=None, Subject=None, Keywords=None, Creator=None, Producer=None, CreationDate=None, ModDate=None, Trapped=None): @@ -1187,7 +1186,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PDFXrefEntryListType(GeneratedsSuper): """The PDFXrefEntryListType captures a list of cross-reference table subsection entries.""" - + subclass = None superclass = None def __init__(self, Cross_Reference_Entry=None): @@ -1256,7 +1255,7 @@ class PDFXrefEntryType(GeneratedsSuper): """The PDFXrefEntryType captures details of a cross-reference table subsection entry.The type field specifies the type of the cross- reference entry.""" - + subclass = None superclass = None def __init__(self, type_=None, Byte_Offset=None, Object_Number=None, Generation_Number=None): @@ -1354,7 +1353,7 @@ class PDFDictionaryType(GeneratedsSuper): """The PDFDictionaryType captures a PDF dictionary as a set of key value pairs, or as a reference to an indirect object that contains.""" - + subclass = None superclass = None def __init__(self, Object_Reference=None, Raw_Contents=None): @@ -1411,7 +1410,7 @@ def exportChildren(self, lwrite, level, namespace_='PDFFileObj:', name_='PDFDict value = self.Raw_Contents.get_valueOf_() if not value.startswith('' - self.Raw_Contents.set_valueOf_(value) + self.Raw_Contents.set_valueOf_(value) self.Raw_Contents.export(lwrite, level, 'PDFFileObj:', name_='Raw_Contents', pretty_print=pretty_print) def build(self, node): already_processed = set() @@ -1437,7 +1436,7 @@ class PDFFileMetadataType(GeneratedsSuper): object.The encrypted field specifies whether the PDF file is encrypted.The optimized field specifies whether the PDF file has been optimized.""" - + subclass = None superclass = None def __init__(self, encrypted=None, optimized=None, Document_Information_Dictionary=None, Number_Of_Indirect_Objects=None, Number_Of_Trailers=None, Number_Of_Cross_Reference_Tables=None, Keyword_Counts=None): @@ -1571,7 +1570,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PDFKeywordCountsType(GeneratedsSuper): """The PDFKeywordCountsType captures the occurrences of various keywords in a PDF file.""" - + subclass = None superclass = None def __init__(self, Page_Count=None, Encrypt_Count=None, ObjStm_Count=None, JS_Count=None, JavaScript_Count=None, AA_Count=None, OpenAction_Count=None, ASCIIHexDecode_Count=None, ASCII85Decode_Count=None, LZWDecode_Count=None, FlateDecode_Count=None, RunLengthDecode_Count=None, JBIG2Decode_Count=None, DCTDecode_Count=None, RichMedia_Count=None, CCITTFaxDecode_Count=None, Launch_Count=None, XFA_Count=None): @@ -1804,7 +1803,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PDFKeywordCountType(GeneratedsSuper): """The PDFKeywordCountType captures the obfuscated and non-obfuscated occurrences of a keyword.""" - + subclass = None superclass = None def __init__(self, Non_Obfuscated_Count=None, Obfuscated_Count=None): @@ -1880,7 +1879,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PDFFileObjectType(file_object.FileObjectType): """The PDFFileObjectType type is intended to characterize the structural makeup of PDF files.""" - + subclass = None superclass = file_object.FileObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_packed=None, File_Name=None, File_Path=None, Device_Path=None, Full_Path=None, File_Extension=None, Size_In_Bytes=None, Magic_Number=None, File_Format=None, Hashes=None, Digital_Signatures=None, Modified_Time=None, Accessed_Time=None, Created_Time=None, File_Attributes_List=None, Permissions=None, User_Owner=None, Packer_List=None, Peak_Entropy=None, Sym_Links=None, Byte_Runs=None, Extracted_Features=None, Metadata=None, Version=None, Indirect_Objects=None, Cross_Reference_Tables=None, Trailers=None): @@ -2145,7 +2144,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -2191,7 +2190,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/pipe_object.py b/cybox/bindings/pipe_object.py index b9f2a6bf..f800ff0f 100644 --- a/cybox/bindings/pipe_object.py +++ b/cybox/bindings/pipe_object.py @@ -4,13 +4,13 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class PipeObjectType(cybox_common.ObjectPropertiesType): """The PipeObjectType type is intended to characterize generic system pipes.The named field specifies whether the pipe is named.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, named=None, Name=None): @@ -190,7 +190,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -236,7 +236,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/port_object.py b/cybox/bindings/port_object.py index 2daf19a9..a87b51e0 100644 --- a/cybox/bindings/port_object.py +++ b/cybox/bindings/port_object.py @@ -4,7 +4,7 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class Layer4ProtocolType(cybox_common.BaseObjectPropertyType): @@ -14,7 +14,7 @@ class Layer4ProtocolType(cybox_common.BaseObjectPropertyType): for permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, pattern_type=None, datatype='string', refanging_transform=None, bit_mask=None, appears_random=None, trend=None, defanging_algorithm_ref=None, is_obfuscated=None, regex_syntax=None, apply_condition='ANY', idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -83,7 +83,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PortObjectType(cybox_common.ObjectPropertiesType): """The PortObjectType type is intended to characterize networking ports.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Port_Value=None, Layer4_Protocol=None): @@ -262,7 +262,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -308,7 +308,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/process_object.py b/cybox/bindings/process_object.py index e1aa5786..61e1712d 100644 --- a/cybox/bindings/process_object.py +++ b/cybox/bindings/process_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import network_connection_object -import port_object +from . import cybox_common +from . import network_connection_object +from . import port_object class NetworkConnectionListType(GeneratedsSuper): """The NetworkConnectionListType type is a list of network connections.""" - + subclass = None superclass = None def __init__(self, Network_Connection=None): @@ -79,7 +78,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ImageInfoType(GeneratedsSuper): """The ImageInfoType type captures information about the process image.""" - + subclass = None superclass = None def __init__(self, File_Name=None, Command_Line=None, Current_Directory=None, Path=None): @@ -177,7 +176,7 @@ class ProcessStatusType(GeneratedsSuper): or terminated process. Since this property is platform-specific, it is created here as an abstract type and then used in the platform-specific process CybOX objects.""" - + subclass = None superclass = None def __init__(self): @@ -229,7 +228,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ChildPIDListType(GeneratedsSuper): """The ChildPIDListType type captures the PID's of the children of the process in a list format.""" - + subclass = None superclass = None def __init__(self, Child_PID=None): @@ -300,7 +299,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class ArgumentListType(GeneratedsSuper): """The ArgumentListType is intended to specify a list of arguments utlized in intiating the process.""" - + subclass = None superclass = None def __init__(self, Argument=None): @@ -370,7 +369,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PortListType(GeneratedsSuper): """The PortListType is intended to specify a list of network ports.""" - + subclass = None superclass = None def __init__(self, Port=None): @@ -439,7 +438,7 @@ class ProcessObjectType(cybox_common.ObjectPropertiesType): """The ProcessObjectType type is intended to characterize system processes.The is_hidden field specifies whether the process is hidden or not.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_hidden=None, PID=None, Name=None, Creation_Time=None, Parent_PID=None, Child_PID_List=None, Image_Info=None, Argument_List=None, Environment_Variable_List=None, Kernel_Time=None, Port_List=None, Network_Connection_List=None, Start_Time=None, Status=None, Username=None, User_Time=None, Extracted_Features=None): @@ -888,7 +887,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -934,7 +933,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/product_object.py b/cybox/bindings/product_object.py index d7a3f1ed..feee270d 100644 --- a/cybox/bindings/product_object.py +++ b/cybox/bindings/product_object.py @@ -4,13 +4,13 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class ProductObjectType(cybox_common.ObjectPropertiesType): """The ProductObjectType type is intended to characterize software or hardware products.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Edition=None, Language=None, Product=None, Update=None, Vendor=None, Version=None): @@ -230,7 +230,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -276,7 +276,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/semaphore_object.py b/cybox/bindings/semaphore_object.py index 05228df1..dd096541 100644 --- a/cybox/bindings/semaphore_object.py +++ b/cybox/bindings/semaphore_object.py @@ -4,14 +4,14 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class SemaphoreObjectType(cybox_common.ObjectPropertiesType): """The SemaphoreObjectType type is intended to characterize generic semaphore objects.The named field specifies whether the Semaphore is named.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, named=None, Current_Count=None, Maximum_Count=None, Name=None): @@ -219,7 +219,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -265,7 +265,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/sms_message_object.py b/cybox/bindings/sms_message_object.py index 7882a64d..9c7a24ed 100644 --- a/cybox/bindings/sms_message_object.py +++ b/cybox/bindings/sms_message_object.py @@ -4,7 +4,7 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class SMSMessageObjectType(cybox_common.ObjectPropertiesType): @@ -298,7 +298,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -344,7 +344,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/socket_address_object.py b/cybox/bindings/socket_address_object.py index 80545e8d..fc9127f8 100644 --- a/cybox/bindings/socket_address_object.py +++ b/cybox/bindings/socket_address_object.py @@ -4,17 +4,16 @@ import sys from cybox.bindings import * -import cybox_common - -import address_object -import hostname_object -import port_object +from . import cybox_common +from . import address_object +from . import hostname_object +from . import port_object class SocketAddressObjectType(cybox_common.ObjectPropertiesType): """The SocketAddressObjectType specifies an IP address/port number pair.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, IP_Address=None, Hostname=None, Port=None): @@ -203,7 +202,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -249,7 +248,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/system_object.py b/cybox/bindings/system_object.py index 9f166b74..3693c0f3 100644 --- a/cybox/bindings/system_object.py +++ b/cybox/bindings/system_object.py @@ -4,14 +4,13 @@ import sys from cybox.bindings import * -import cybox_common - -import address_object +from . import cybox_common +from . import address_object class BIOSInfoType(GeneratedsSuper): """The BIOSInfoType type specifies information about a system's BIOS.""" - + subclass = None superclass = None def __init__(self, BIOS_Date=None, BIOS_Version=None, BIOS_Manufacturer=None, BIOS_Release_Date=None, BIOS_Serial_Number=None): @@ -120,7 +119,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class NetworkInterfaceListType(GeneratedsSuper): """The NetworkInterfaceListType type specifies information about the network interfaces present on the system.""" - + subclass = None superclass = None def __init__(self, Network_Interface=None): @@ -188,7 +187,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class IPGatewayListType(GeneratedsSuper): """The IPGatewayListType type specifies the IP Addresses of the gateways used by the system.""" - + subclass = None superclass = None def __init__(self, IP_Gateway_Address=None): @@ -256,7 +255,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class NetworkInterfaceType(GeneratedsSuper): """The NetworkInterfaceType type specifies information about a network interface, such as its MAC address.""" - + subclass = None superclass = None def __init__(self, Adapter=None, Description=None, DHCP_Lease_Expires=None, DHCP_Lease_Obtained=None, DHCP_Server_List=None, IP_Gateway_List=None, IP_List=None, MAC=None): @@ -395,7 +394,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class IPInfoListType(GeneratedsSuper): """The IPInfoListType type specifies a list of IP address/subnet mask pairs associated with a network interface.""" - + subclass = None superclass = None def __init__(self, IP_Info=None): @@ -463,7 +462,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class IPInfoType(GeneratedsSuper): """The IP_Info type specifies information about the IP address and its associated subnet mask used by a network interface.""" - + subclass = None superclass = None def __init__(self, IP_Address=None, Subnet_Mask=None): @@ -536,7 +535,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class DHCPServerListType(GeneratedsSuper): """The DHCPServerListType type specifies a list of DHCP Servers, via their IP addresses.""" - + subclass = None superclass = None def __init__(self, DHCP_Server_Address=None): @@ -608,7 +607,7 @@ class BitnessType(cybox_common.BaseObjectPropertyType): (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -681,7 +680,7 @@ class ProcessorArchType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -751,7 +750,7 @@ class OSType(cybox_common.PlatformSpecificationType): """The OSType type specifies information about an operating system. It imports and extends the cybox_common.PlatformSpecificationType from the CybOX Common Types.""" - + subclass = None superclass = cybox_common.PlatformSpecificationType def __init__(self, Description=None, Identifier=None, Bitness=None, Build_Number=None, Environment_Variable_List=None, Install_Date=None, Patch_Level=None, Platform=None): @@ -877,7 +876,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class SystemObjectType(cybox_common.ObjectPropertiesType): """The SystemObjectType type is intended to characterize computer systems (as a combination of both software and hardware).""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Available_Physical_Memory=None, BIOS_Info=None, Date=None, Hostname=None, Local_Time=None, Network_Interface_List=None, OS=None, Processor=None, Processor_Architecture=None, System_Time=None, Timezone_DST=None, Timezone_Standard=None, Total_Physical_Memory=None, Uptime=None, Username=None): @@ -1227,7 +1226,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -1273,7 +1272,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/unix_file_object.py b/cybox/bindings/unix_file_object.py index 1cd4d129..03b41efb 100644 --- a/cybox/bindings/unix_file_object.py +++ b/cybox/bindings/unix_file_object.py @@ -4,9 +4,8 @@ import sys from cybox.bindings import * -import cybox_common - -import file_object +from . import cybox_common +from . import file_object class UnixFileType(cybox_common.BaseObjectPropertyType): @@ -16,7 +15,7 @@ class UnixFileType(cybox_common.BaseObjectPropertyType): complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -101,7 +100,7 @@ class UnixFilePermissionsType(file_object.FilePermissionsType): field specifies whether or not all other users can write to the file.The oexec field specifies whether or not all other users can execute the file.""" - + subclass = None superclass = file_object.FilePermissionsType def __init__(self, gwrite=None, suid=None, oexec=None, owrite=None, uwrite=None, gexec=None, gread=None, uexec=None, uread=None, sgid=None, oread=None): @@ -320,7 +319,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class UnixFileObjectType(file_object.FileObjectType): """The UnixFileObjectType type is intended to characterize Unix files.""" - + subclass = None superclass = file_object.FileObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_packed=None, File_Name=None, File_Path=None, Device_Path=None, Full_Path=None, File_Extension=None, Size_In_Bytes=None, Magic_Number=None, File_Format=None, Hashes=None, Digital_Signatures=None, Modified_Time=None, Accessed_Time=None, Created_Time=None, File_Attributes_List=None, Permissions=None, User_Owner=None, Packer_List=None, Peak_Entropy=None, Sym_Links=None, Byte_Runs=None, Extracted_Features=None, Group_Owner=None, INode=None, Type=None): @@ -544,7 +543,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -590,7 +589,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/unix_network_route_entry_object.py b/cybox/bindings/unix_network_route_entry_object.py index 2e8c958c..a54b3b37 100644 --- a/cybox/bindings/unix_network_route_entry_object.py +++ b/cybox/bindings/unix_network_route_entry_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import network_route_entry_object +from . import cybox_common +from . import network_route_entry_object class UnixNetworkRouteEntryObjectType(network_route_entry_object.NetworkRouteEntryObjectType): """The UnixNetworkRouteEntryObjectType type is intended to characterize entries in the network routing table of a Unix system.""" - + subclass = None superclass = network_route_entry_object.NetworkRouteEntryObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_publish=None, is_autoconfigure_address=None, is_loopback=None, is_immortal=None, is_ipv6=None, Destination_Address=None, Origin=None, Netmask=None, Gateway_Address=None, Metric=None, Type=None, Protocol=None, Interface=None, Preferred_Lifetime=None, Valid_Lifetime=None, Route_Age=None, Flags=None, MSS=None, Ref=None, Use=None, Window=None): @@ -237,7 +236,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -283,7 +282,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/unix_pipe_object.py b/cybox/bindings/unix_pipe_object.py index 57fb6c4b..8bc3d622 100644 --- a/cybox/bindings/unix_pipe_object.py +++ b/cybox/bindings/unix_pipe_object.py @@ -4,14 +4,13 @@ import sys from cybox.bindings import * -import cybox_common - -import pipe_object +from . import cybox_common +from . import pipe_object class UnixPipeObjectType(pipe_object.PipeObjectType): """The UnixPipeObjectType type is intended to characterize Unix pipes.""" - + subclass = None superclass = pipe_object.PipeObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, named=None, Name=None, Permission_Mode=None): @@ -178,7 +177,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -224,7 +223,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/unix_process_object.py b/cybox/bindings/unix_process_object.py index 613a5186..87404ec3 100644 --- a/cybox/bindings/unix_process_object.py +++ b/cybox/bindings/unix_process_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import process_object +from . import cybox_common +from . import process_object class FileDescriptorListType(GeneratedsSuper): """The FileDescriptorListType type specifies a list of Unix file descriptors.""" - + subclass = None superclass = None def __init__(self, File_Descriptor=None): @@ -88,7 +87,7 @@ class UnixProcessStateType(cybox_common.BaseObjectPropertyType): specifications. See "man ps" for more information.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -158,7 +157,7 @@ class UnixProcessStatusType(process_object.ProcessStatusType): """The UnixProcessStatusType field specifies the current status of the running Unix process. It extends the abstract process_object.ProcessStatusType from the CybOX Process Object.""" - + subclass = None superclass = process_object.ProcessStatusType def __init__(self, Current_Status=None, Timestamp=None): @@ -241,7 +240,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class UnixProcessObjectType(process_object.ProcessObjectType): """The UnixProcessObjectType type is intended to characterize Unix processes.""" - + subclass = None superclass = process_object.ProcessObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_hidden=None, PID=None, Name=None, Creation_Time=None, Parent_PID=None, Child_PID_List=None, Image_Info=None, Argument_List=None, Environment_Variable_List=None, Kernel_Time=None, Port_List=None, Network_Connection_List=None, Start_Time=None, Status=None, Username=None, User_Time=None, Extracted_Features=None, Open_File_Descriptor_List=None, Priority=None, RUID=None, Session_ID=None): @@ -538,7 +537,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -584,7 +583,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/unix_user_account_object.py b/cybox/bindings/unix_user_account_object.py index 2939413b..273088ca 100644 --- a/cybox/bindings/unix_user_account_object.py +++ b/cybox/bindings/unix_user_account_object.py @@ -4,16 +4,15 @@ import sys from cybox.bindings import * -import cybox_common - -import user_account_object +from . import cybox_common +from . import user_account_object class UnixPrivilegeType(user_account_object.PrivilegeType): """The UnixPrivilegeType type is used to specify Unix privileges. It extends the abstract user_account_object.PrivilegeType from the CybOX UserAccount object.""" - + subclass = None superclass = user_account_object.PrivilegeType def __init__(self, Permissions_Mask=None): @@ -84,7 +83,7 @@ class UnixGroupType(user_account_object.GroupType): """The UnixGroupType type is used for specifying Unix groups. It extends the abstract user_account_object.GroupType from the Cybox UserAccount construct.""" - + subclass = None superclass = user_account_object.GroupType def __init__(self, Group_ID=None): @@ -154,7 +153,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class UnixUserAccountObjectType(user_account_object.UserAccountObjectType): """The UnixUserAccountType type is intended to characterize Unix user accounts.""" - + subclass = None superclass = user_account_object.UserAccountObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, disabled=None, locked_out=None, Description=None, Domain=None, password_required=None, Full_Name=None, Group_List=None, Home_Directory=None, Last_Login=None, Privilege_List=None, Script_Path=None, Username=None, User_Password_Age=None, Group_ID=None, User_ID=None, Login_Shell=None): @@ -358,7 +357,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -404,7 +403,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/unix_volume_object.py b/cybox/bindings/unix_volume_object.py index 07cf67a2..f525177b 100644 --- a/cybox/bindings/unix_volume_object.py +++ b/cybox/bindings/unix_volume_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import volume_object +from . import cybox_common +from . import volume_object class UnixVolumeObjectType(volume_object.VolumeObjectType): """The UnixVolumeObjectType type is intended to characterize Unix disk volumes.""" - + subclass = None superclass = volume_object.VolumeObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_mounted=None, Name=None, Device_Path=None, File_System_Type=None, Total_Allocation_Units=None, Sectors_Per_Allocation_Unit=None, Bytes_Per_Sector=None, Actual_Available_Allocation_Units=None, Creation_Time=None, File_System_Flag_List=None, Serial_Number=None, Mount_Point=None, Options=None): @@ -200,7 +199,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -246,7 +245,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/uri_object.py b/cybox/bindings/uri_object.py index d8792aa8..2ee61529 100644 --- a/cybox/bindings/uri_object.py +++ b/cybox/bindings/uri_object.py @@ -4,14 +4,14 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class URIObjectType(cybox_common.ObjectPropertiesType): """The URIObjectType type is intended to characterize Uniform Resource Identifiers (URI's).The type field specifies the type of URI that is being defined.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, type_=None, Value=None): @@ -186,7 +186,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -232,7 +232,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/url_history_object.py b/cybox/bindings/url_history_object.py index 4e259efb..35ad630a 100644 --- a/cybox/bindings/url_history_object.py +++ b/cybox/bindings/url_history_object.py @@ -4,10 +4,9 @@ import sys from cybox.bindings import * -import cybox_common - -import hostname_object -import uri_object +from . import cybox_common +from . import hostname_object +from . import uri_object class URLHistoryEntryType(GeneratedsSuper): @@ -385,7 +384,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -431,7 +430,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/user_account_object.py b/cybox/bindings/user_account_object.py index 7504a721..8ad2fe72 100644 --- a/cybox/bindings/user_account_object.py +++ b/cybox/bindings/user_account_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import account_object +from . import cybox_common +from . import account_object class PrivilegeListType(GeneratedsSuper): """The PrivilegeListType type specifies the list of privileges that the user account has.""" - + subclass = None superclass = None def __init__(self, Privilege=None): @@ -96,7 +95,7 @@ class PrivilegeType(GeneratedsSuper): has. This is an abstract type since user privileges are operating-system specific, and is extended as needed in the derived CybOX object schemas.""" - + subclass = None superclass = None def __init__(self): @@ -148,7 +147,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class GroupListType(GeneratedsSuper): """The GroupListType type specifies the groups that the user account belongs to.""" - + subclass = None superclass = None def __init__(self, Group=None): @@ -232,7 +231,7 @@ class GroupType(GeneratedsSuper): This is an abstract type since group IDs are operating-system specific, and is extended as needed in the derived CybOX object schemas.""" - + subclass = None superclass = None def __init__(self): @@ -285,7 +284,7 @@ class UserAccountObjectType(account_object.AccountObjectType): """The UserAccountObjectType type is intended to characterize generic user accounts.The password_required field specifies whether a password is required for this user account.""" - + subclass = None superclass = account_object.AccountObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, disabled=None, locked_out=None, Description=None, Domain=None, password_required=None, Full_Name=None, Group_List=None, Home_Directory=None, Last_Login=None, Privilege_List=None, Script_Path=None, Username=None, User_Password_Age=None): @@ -549,7 +548,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -595,7 +594,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/user_session_object.py b/cybox/bindings/user_session_object.py index 52b88996..b284ebba 100644 --- a/cybox/bindings/user_session_object.py +++ b/cybox/bindings/user_session_object.py @@ -4,13 +4,13 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class UserSessionObjectType(cybox_common.ObjectPropertiesType): """The UserSessionObjectType type is intended to characterize user sessions.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Effective_Group=None, Effective_Group_ID=None, Effective_User=None, Effective_User_ID=None, Login_Time=None, Logout_Time=None): @@ -234,7 +234,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -280,7 +280,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/volume_object.py b/cybox/bindings/volume_object.py index 940d4695..148da17e 100644 --- a/cybox/bindings/volume_object.py +++ b/cybox/bindings/volume_object.py @@ -4,7 +4,7 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class VolumeOptionsType(GeneratedsSuper): @@ -12,7 +12,7 @@ class VolumeOptionsType(GeneratedsSuper): the volume. This is an abstract type since volume options are OS-specific, and is extended by the related OS-specific CybOX volume objects.""" - + subclass = None superclass = None def __init__(self): @@ -64,7 +64,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class FileSystemFlagListType(GeneratedsSuper): """The FileSystemFlagListType is a listing of the flags specified for the volume by the file system.""" - + subclass = None superclass = None def __init__(self, File_System_Flag=None): @@ -139,7 +139,7 @@ class VolumeFileSystemFlagType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -209,7 +209,7 @@ class VolumeObjectType(cybox_common.ObjectPropertiesType): """The VolumeObjectType type is intended to characterize generic drive volumes.The is_mounted field specifies whether the volume is mounted.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_mounted=None, Name=None, Device_Path=None, File_System_Type=None, Total_Allocation_Units=None, Sectors_Per_Allocation_Unit=None, Bytes_Per_Sector=None, Actual_Available_Allocation_Units=None, Creation_Time=None, File_System_Flag_List=None, Serial_Number=None): @@ -499,7 +499,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -545,7 +545,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/whois_object.py b/cybox/bindings/whois_object.py index 9bc319cc..0a944a7d 100644 --- a/cybox/bindings/whois_object.py +++ b/cybox/bindings/whois_object.py @@ -4,14 +4,13 @@ import sys from cybox.bindings import * -import cybox_common - -import address_object -import uri_object +from . import cybox_common +from . import address_object +from . import uri_object class WhoisRegistrarInfoType(GeneratedsSuper): - + subclass = None superclass = None def __init__(self, Registrar_ID=None, Registrar_GUID=None, Name=None, Address=None, Email_Address=None, Phone_Number=None, Whois_Server=None, Referral_URL=None, Contacts=None): @@ -157,7 +156,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WhoisContactsType(GeneratedsSuper): """The WhoisContactsType represents a list of contacts (usually registrar or registrant) found in a Whois entry""" - + subclass = None superclass = None def __init__(self, Contact=None): @@ -225,7 +224,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WhoisContactType(GeneratedsSuper): """The contact_type field specifies what type of contact this is. Only values from WhoisObj:RegistrarContactTypeEnum can be used.""" - + subclass = None superclass = None def __init__(self, contact_type=None, Contact_ID=None, Name=None, Email_Address=None, Phone_Number=None, Fax_Number=None, Address=None, Organization=None, extensiontype_=None): @@ -369,7 +368,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WhoisStatusesType(GeneratedsSuper): """The WhoisStatusesType defines a list of WhoisStatusType objecst""" - + subclass = None superclass = None def __init__(self, Status=None): @@ -440,7 +439,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WhoisNameserversType(GeneratedsSuper): """The WhoisNameserversType defines a list of nameservers associated with a Whois entry""" - + subclass = None superclass = None def __init__(self, Nameserver=None): @@ -506,7 +505,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): # end class WhoisNameserversType class WhoisRegistrantInfoType(WhoisContactType): - + subclass = None superclass = WhoisContactType def __init__(self, contact_type=None, Contact_ID=None, Name=None, Email_Address=None, Phone_Number=None, Fax_Number=None, Address=None, Organization=None, Registrant_ID=None): @@ -576,7 +575,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WhoisRegistrantsType(GeneratedsSuper): """The WhoisRegistrantsType represents a list of registrant information for a given Whois entry""" - + subclass = None superclass = None def __init__(self, Registrant=None): @@ -646,7 +645,7 @@ class RegionalRegistryType(cybox_common.BaseObjectPropertyType): (RIR) for a given WHOIS entry. RIRs defined by the RegionalRegistryTypeEnum may be used, as well as those specified by a free form text string.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, pattern_type=None, datatype='string', refanging_transform=None, bit_mask=None, appears_random=None, trend=None, defanging_algorithm_ref=None, is_obfuscated=None, regex_syntax=None, apply_condition='ANY', idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -706,7 +705,7 @@ class WhoisStatusType(cybox_common.BaseObjectPropertyType): """The WhoisStatusType specifies a status for a domain as listed in its Whois entry. Only statuses defined by WhoisStatusTypeEnum can be used.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None, extensiontype_=None): @@ -765,7 +764,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WhoisObjectType(cybox_common.ObjectPropertiesType): """The WhoisObjectType type is intended to characterize Whois information for a domain.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Lookup_Date=None, Domain_Name=None, Domain_ID=None, Server_Name=None, IP_Address=None, DNSSEC=None, Nameservers=None, Status=None, Updated_Date=None, Creation_Date=None, Expiration_Date=None, Regional_Internet_Registry=None, Sponsoring_Registrar=None, Registrar_Info=None, Registrants=None, Contact_Info=None, Remarks=None): @@ -1120,7 +1119,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -1166,7 +1165,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_computer_account_object.py b/cybox/bindings/win_computer_account_object.py index a4bb9a61..66bffe49 100644 --- a/cybox/bindings/win_computer_account_object.py +++ b/cybox/bindings/win_computer_account_object.py @@ -4,16 +4,15 @@ import sys from cybox.bindings import * -import cybox_common - -import account_object -import port_object +from . import cybox_common +from . import account_object +from . import port_object class FullyQualifiedNameType(GeneratedsSuper): """The FullyQualifiedNameType type refers to the fully qualified name(s) of the Windows computer account.""" - + subclass = None superclass = None def __init__(self, NetBEUI_Name=None, Full_Name=None): @@ -89,7 +88,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class KerberosType(GeneratedsSuper): """The KerberosType type specifies the Kerberos authentication protocol specific Object properties for the Windows computer account.""" - + subclass = None superclass = None def __init__(self, Delegation=None, Ticket=None): @@ -165,7 +164,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class KerberosDelegationType(GeneratedsSuper): """The Delegation field specifies the Kerberos delegation used for the Windows computer account.""" - + subclass = None superclass = None def __init__(self, Bitmask=None, Service=None): @@ -241,7 +240,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class KerberosServiceType(GeneratedsSuper): """The KerberosServiceType specifies the properties of the Kerberos delegation service for the Windows computer account.""" - + subclass = None superclass = None def __init__(self, Computer=None, Name=None, Port=None, User=None): @@ -337,7 +336,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsComputerAccountObjectType(account_object.AccountObjectType): """The WinComputerAccountObject type is intended to characterize Windows computer accounts.""" - + subclass = None superclass = account_object.AccountObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, disabled=None, locked_out=None, Description=None, Domain=None, Fully_Qualified_Name=None, Kerberos=None, Security_ID=None, Security_Type=None, Type=None): @@ -558,7 +557,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -604,7 +603,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_critical_section_object.py b/cybox/bindings/win_critical_section_object.py index ea71afad..10fe77da 100644 --- a/cybox/bindings/win_critical_section_object.py +++ b/cybox/bindings/win_critical_section_object.py @@ -4,13 +4,13 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class WindowsCriticalSectionObjectType(cybox_common.ObjectPropertiesType): """The WindowsCriticalSectionObjectType type is intended to characterize Windows Critical Section objects.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Address=None, Spin_Count=None): @@ -189,7 +189,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -235,7 +235,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_driver_object.py b/cybox/bindings/win_driver_object.py index 43812a59..7f3c3437 100644 --- a/cybox/bindings/win_driver_object.py +++ b/cybox/bindings/win_driver_object.py @@ -4,9 +4,8 @@ import sys from cybox.bindings import * -import cybox_common - -import win_executable_file_object +from . import cybox_common +from . import win_executable_file_object class DeviceObjectStructType(GeneratedsSuper): @@ -15,7 +14,7 @@ class DeviceObjectStructType(GeneratedsSuper): virtual, or physical device for which a driver handles I/O requests. See also: http://msdn.microsoft.com/en- us/library/windows/hardware/ff543147(v=vs.85).aspx""" - + subclass = None superclass = None def __init__(self, Attached_Device_Name=None, Attached_Device_Object=None, Attached_To_Device_Name=None, Attached_To_Device_Object=None, Attached_To_Driver_Object=None, Attached_To_Driver_Name=None, Device_Name=None, Device_Object=None): @@ -153,7 +152,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class DeviceObjectListType(GeneratedsSuper): """The DeviceObjectListType specifies a list of device objects.""" - + subclass = None superclass = None def __init__(self, Device_Object_Struct=None): @@ -221,7 +220,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsDriverObjectType(win_executable_file_object.WindowsExecutableFileObjectType): """The WindowsDriverObject type is intended to characterize Windows device drivers.""" - + subclass = None superclass = win_executable_file_object.WindowsExecutableFileObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Device_Object_List=None, Driver_Init=None, Driver_Name=None, Driver_Object_Address=None, Driver_Start_IO=None, Driver_Unload=None, Image_Base=None, Image_Size=None, IRP_MJ_CLEANUP=None, IRP_MJ_CLOSE=None, IRP_MJ_CREATE=None, IRP_MJ_CREATE_MAILSLOT=None, IRP_MJ_CREATE_NAMED_PIPE=None, IRP_MJ_DEVICE_CHANGE=None, IRP_MJ_DEVICE_CONTROL=None, IRP_MJ_DIRECTORY_CONTROL=None, IRP_MJ_FILE_SYSTEM_CONTROL=None, IRP_MJ_FLUSH_BUFFERS=None, IRP_MJ_INTERNAL_DEVICE_CONTROL=None, IRP_MJ_LOCK_CONTROL=None, IRP_MJ_PNP=None, IRP_MJ_POWER=None, IRP_MJ_READ=None, IRP_MJ_QUERY_EA=None, IRP_MJ_QUERY_INFORMATION=None, IRP_MJ_QUERY_SECURITY=None, IRP_MJ_QUERY_QUOTA=None, IRP_MJ_QUERY_VOLUME_INFORMATION=None, IRP_MJ_SET_EA=None, IRP_MJ_SET_INFORMATION=None, IRP_MJ_SET_SECURITY=None, IRP_MJ_SET_QUOTA=None, IRP_MJ_SET_VOLUME_INFORMATION=None, IRP_MJ_SHUTDOWN=None, IRP_MJ_SYSTEM_CONTROL=None, IRP_MJ_WRITE=None): @@ -785,7 +784,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -831,7 +830,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_event_log_object.py b/cybox/bindings/win_event_log_object.py index 11e63b19..013f18f5 100644 --- a/cybox/bindings/win_event_log_object.py +++ b/cybox/bindings/win_event_log_object.py @@ -4,13 +4,13 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class UnformattedMessageListType(GeneratedsSuper): """The UnformattedMessageListType type is a list of unformatted messages in the event log entry.""" - + subclass = None superclass = None def __init__(self, Unformatted_Message=None): @@ -81,7 +81,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsEventLogObjectType(cybox_common.ObjectPropertiesType): """The WindowsEventLogObjectType type is intended to characterize entries in the Windows event log.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, EID=None, Type=None, Log=None, Message=None, Category_Num=None, Category=None, Generation_Time=None, Source=None, Machine=None, User=None, Blob=None, Correlation_Activity_ID=None, Correlation_Related_Activity_ID=None, Execution_Process_ID=None, Execution_Thread_ID=None, Index=None, Reserved=None, Unformatted_Message_List=None, Write_Time=None): @@ -453,7 +453,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -499,7 +499,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_event_object.py b/cybox/bindings/win_event_object.py index ea37174a..5ea7feca 100644 --- a/cybox/bindings/win_event_object.py +++ b/cybox/bindings/win_event_object.py @@ -4,9 +4,8 @@ import sys from cybox.bindings import * -import cybox_common - -import win_handle_object +from . import cybox_common +from . import win_handle_object class WinEventType(cybox_common.BaseObjectPropertyType): @@ -16,7 +15,7 @@ class WinEventType(cybox_common.BaseObjectPropertyType): complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -85,7 +84,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsEventObjectType(cybox_common.ObjectPropertiesType): """The WindowsEventObjectType type is intended to characterize Windows event (synchronization) objects.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Handle=None, Name=None, Type=None): @@ -279,7 +278,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -325,7 +324,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_executable_file_object.py b/cybox/bindings/win_executable_file_object.py index 879ff1f2..2289d1ef 100644 --- a/cybox/bindings/win_executable_file_object.py +++ b/cybox/bindings/win_executable_file_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import win_file_object +from . import cybox_common +from . import win_file_object class PEChecksumType(GeneratedsSuper): """The PECheckSumType records the checksum of the PE file, both as found in the file and computed.""" - + subclass = None superclass = None def __init__(self, PE_Computed_API=None, PE_File_API=None, PE_File_Raw=None): @@ -101,7 +100,7 @@ class PEExportsType(GeneratedsSuper): by the PE File (a DLL) which can be dynamically loaded by other executables. This type abstracts, and its components, abstract the Windows structures.""" - + subclass = None superclass = None def __init__(self, Name=None, Exported_Functions=None, Number_Of_Functions=None, Exports_Time_Stamp=None, Number_Of_Addresses=None, Number_Of_Names=None): @@ -219,7 +218,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PEExportedFunctionsType(GeneratedsSuper): """PEExportedFunctionsType specifies a list of PE exported functions""" - + subclass = None superclass = None def __init__(self, Exported_Function=None): @@ -286,7 +285,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PESectionListType(GeneratedsSuper): """Specifies a list of sections that appear in the PE file.""" - + subclass = None superclass = None def __init__(self, Section=None): @@ -353,7 +352,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class EntropyType(GeneratedsSuper): """Specifies the result of an entropy computation.""" - + subclass = None superclass = None def __init__(self, Value=None, Min=None, Max=None): @@ -446,7 +445,7 @@ class PEImportType(GeneratedsSuper): binary will typically have few initially visible imports, and thus it is necessary to make the distinction between those that are visible initially or only after the binary is unpacked.""" - + subclass = None superclass = None def __init__(self, initially_visible=None, delay_load=None, File_Name=None, Imported_Functions=None, Virtual_Address=None): @@ -562,7 +561,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PEImportedFunctionsType(GeneratedsSuper): """A list of PE imported functions""" - + subclass = None superclass = None def __init__(self, Imported_Function=None): @@ -702,7 +701,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PEResourceType(GeneratedsSuper): """The PEResourceType type is intended as container for the properties relevant to PE binary resources.""" - + subclass = None superclass = None def __init__(self, Type=None, Name=None, Size=None, Virtual_Address=None, Language=None, Sub_Language=None, Hashes=None, Data=None, extensiontype_=None): @@ -853,7 +852,7 @@ class PEVersionInfoResourceType(PEResourceType): resource type. For more information please see: http://msdn.microsoft.com/en- us/library/windows/desktop/aa381058(v=vs.85).aspx""" - + subclass = None superclass = PEResourceType def __init__(self, Type=None, Name=None, Hashes=None, Comments=None, CompanyName=None, FileDescription=None, FileVersion=None, InternalName=None, LangID=None, LegalCopyright=None, LegalTrademarks=None, OriginalFilename=None, PrivateBuild=None, ProductName=None, ProductVersion=None, SpecialBuild=None): @@ -1042,7 +1041,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PEExportedFunctionType(GeneratedsSuper): """PEExportType sepcifies the type describing exported functions.""" - + subclass = None superclass = None def __init__(self, Function_Name=None, Entry_Point=None, Ordinal=None): @@ -1134,7 +1133,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PEResourceListType(GeneratedsSuper): """PEResourceListType specifies a list of resources found in the PE file.""" - + subclass = None superclass = None def __init__(self, Resource=None): @@ -1209,7 +1208,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PEImportedFunctionType(GeneratedsSuper): """PEImportedFunctionType specifies the type describing imported functions.""" - + subclass = None superclass = None def __init__(self, Function_Name=None, Hint=None, Ordinal=None, Bound=None, Virtual_Address=None): @@ -1321,7 +1320,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PEImportListType(GeneratedsSuper): """PEImportListType specifies a list of functions in an import data section.""" - + subclass = None superclass = None def __init__(self, Import=None): @@ -1392,7 +1391,7 @@ class PESectionType(GeneratedsSuper): header and data. The PESectionType contains properties that describe the Section Header and metadata computed about the section (e.g., hashes, entropy).""" - + subclass = None superclass = None def __init__(self, Section_Header=None, Data_Hashes=None, Entropy=None, Header_Hashes=None): @@ -1488,7 +1487,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PEDataDirectoryStructType(GeneratedsSuper): """The PEDataDirectoryStruct type is intended as container for the properties relevant to a PE binary's data directory structure.""" - + subclass = None superclass = None def __init__(self, Virtual_Address=None, Size=None): @@ -1567,7 +1566,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PESectionHeaderStructType(GeneratedsSuper): """The PESectionHeaderStruct type is intended as container for the properties relevant to a PE binary's section header structure.""" - + subclass = None superclass = None def __init__(self, Name=None, Virtual_Size=None, Virtual_Address=None, Size_Of_Raw_Data=None, Pointer_To_Raw_Data=None, Pointer_To_Relocations=None, Pointer_To_Linenumbers=None, Number_Of_Relocations=None, Number_Of_Linenumbers=None, Characteristics=None): @@ -1733,7 +1732,7 @@ class DOSHeaderType(GeneratedsSuper): /doc/pefile.html for more information about the winnt.h file, and http://www.tavi.co.uk/phobos/exeformat.html for even more clarification.""" - + subclass = None superclass = None def __init__(self, e_magic=None, e_cblp=None, e_cp=None, e_crlc=None, e_cparhdr=None, e_minalloc=None, e_maxalloc=None, e_ss=None, e_sp=None, e_csum=None, e_ip=None, e_cs=None, e_lfarlc=None, e_ovro=None, reserved1=None, e_oemid=None, e_oeminfo=None, reserved2=None, e_lfanew=None, Hashes=None): @@ -1993,7 +1992,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PEHeadersType(GeneratedsSuper): """PEHeaderType specifies the headers found in PE and COFF files.""" - + subclass = None superclass = None def __init__(self, DOS_Header=None, Signature=None, File_Header=None, Optional_Header=None, Entropy=None, Hashes=None): @@ -2110,7 +2109,7 @@ class PEFileHeaderType(GeneratedsSuper): """The PEFileHeaderType type refers to the PE file header (somtimes referred to as the COFF header) and its associated characteristics.""" - + subclass = None superclass = None def __init__(self, Machine=None, Number_Of_Sections=None, Time_Date_Stamp=None, Pointer_To_Symbol_Table=None, Number_Of_Symbols=None, Size_Of_Optional_Header=None, Characteristics=None, Hashes=None): @@ -2250,7 +2249,7 @@ class PEOptionalHeaderType(GeneratedsSuper): """The PEOptionalHeaderType type describes the PE Optional Header structure. Additional computed metadata, e.g., hashes of the header, are also included.""" - + subclass = None superclass = None def __init__(self, Magic=None, Major_Linker_Version=None, Minor_Linker_Version=None, Size_Of_Code=None, Size_Of_Initialized_Data=None, Size_Of_Uninitialized_Data=None, Address_Of_Entry_Point=None, Base_Of_Code=None, Base_Of_Data=None, Image_Base=None, Section_Alignment=None, File_Alignment=None, Major_OS_Version=None, Minor_OS_Version=None, Major_Image_Version=None, Minor_Image_Version=None, Major_Subsystem_Version=None, Minor_Subsystem_Version=None, Win32_Version_Value=None, Size_Of_Image=None, Size_Of_Headers=None, Checksum=None, Subsystem=None, DLL_Characteristics=None, Size_Of_Stack_Reserve=None, Size_Of_Stack_Commit=None, Size_Of_Heap_Reserve=None, Size_Of_Heap_Commit=None, Loader_Flags=None, Number_Of_Rva_And_Sizes=None, Data_Directory=None, Hashes=None): @@ -2628,7 +2627,7 @@ class DataDirectoryType(GeneratedsSuper): in the PE file's optional header. The data directories, except the Certificate Table, are loaded into memory so they can be used at runtime.""" - + subclass = None superclass = None def __init__(self, Export_Table=None, Import_Table=None, Resource_Table=None, Exception_Table=None, Certificate_Table=None, Base_Relocation_Table=None, Debug=None, Architecture=None, Global_Ptr=None, TLS_Table=None, Load_Config_Table=None, Bound_Import=None, Import_Address_Table=None, Delay_Import_Descriptor=None, CLR_Runtime_Header=None, Reserved=None): @@ -2841,7 +2840,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class PEBuildInformationType(GeneratedsSuper): """The PEBuildInformationType captures information about the tools used to build the PE binary, including the compiler and linker.""" - + subclass = None superclass = None def __init__(self, Linker_Name=None, Linker_Version=None, Compiler_Name=None, Compiler_Version=None): @@ -2943,7 +2942,7 @@ class PEType(cybox_common.BaseObjectPropertyType): expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -3016,7 +3015,7 @@ class SubsystemType(cybox_common.BaseObjectPropertyType): complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -3085,7 +3084,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsExecutableFileObjectType(win_file_object.WindowsFileObjectType): """The WindowsExecutableFileObjectType type is intended to characterize Windows PE (Portable Executable) files.""" - + subclass = None superclass = win_file_object.WindowsFileObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_packed=None, File_Name=None, File_Path=None, Device_Path=None, Full_Path=None, File_Extension=None, Size_In_Bytes=None, Magic_Number=None, File_Format=None, Hashes=None, Digital_Signatures=None, Modified_Time=None, Accessed_Time=None, Created_Time=None, File_Attributes_List=None, Permissions=None, User_Owner=None, Packer_List=None, Peak_Entropy=None, Sym_Links=None, Byte_Runs=None, Extracted_Features=None, Filename_Accessed_Time=None, Filename_Created_Time=None, Filename_Modified_Time=None, Drive=None, Security_ID=None, Security_Type=None, Stream_List=None, Build_Information=None, Digital_Signature=None, Exports=None, Extraneous_Bytes=None, Headers=None, Imports=None, PE_Checksum=None, Resources=None, Sections=None, Type=None): @@ -3470,7 +3469,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -3516,7 +3515,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_file_object.py b/cybox/bindings/win_file_object.py index 44f54832..c7eec32e 100644 --- a/cybox/bindings/win_file_object.py +++ b/cybox/bindings/win_file_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import file_object +from . import cybox_common +from . import file_object class StreamListType(GeneratedsSuper): """The StreamListType type specifies a list of NTFS alternate data streams.""" - + subclass = None superclass = None def __init__(self, Stream=None): @@ -81,7 +80,7 @@ class WindowsFilePermissionsType(file_object.FilePermissionsType): """The WindowsFilePermissionsType type specifies Windows file permissions. It imports and extends the file_object.FilePermissionsType from the CybOX File Object.""" - + subclass = None superclass = file_object.FilePermissionsType def __init__(self, Full_Control=None, Modify=None, Read=None, Read_And_Execute=None, Write=None): @@ -227,7 +226,7 @@ class WindowsFileAttributeType(cybox_common.BaseObjectPropertyType): for permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -297,7 +296,7 @@ class WindowsFileAttributesType(file_object.FileAttributeType): """The WindowsFileAttributesType type specifies Windows file attributes. It imports and extends the file_object.FileAttributeType from the CybOX File Object.""" - + subclass = None superclass = file_object.FileAttributeType def __init__(self, Attribute=None): @@ -372,7 +371,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class StreamObjectType(cybox_common.HashListType): """The StreamObjectType type is intended to characterize NTFS alternate data streams.""" - + subclass = None superclass = cybox_common.HashListType def __init__(self, Hash=None, Name=None, Size_In_Bytes=None): @@ -455,7 +454,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsFileObjectType(file_object.FileObjectType): """The WindowsFileObjectType type is intended to characterize Windows files.""" - + subclass = None superclass = file_object.FileObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_packed=None, File_Name=None, File_Path=None, Device_Path=None, Full_Path=None, File_Extension=None, Size_In_Bytes=None, Magic_Number=None, File_Format=None, Hashes=None, Digital_Signatures=None, Modified_Time=None, Accessed_Time=None, Created_Time=None, File_Attributes_List=None, Permissions=None, User_Owner=None, Packer_List=None, Peak_Entropy=None, Sym_Links=None, Byte_Runs=None, Extracted_Features=None, Filename_Accessed_Time=None, Filename_Created_Time=None, Filename_Modified_Time=None, Drive=None, Security_ID=None, Security_Type=None, Stream_List=None): @@ -723,7 +722,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -769,7 +768,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_filemapping_object.py b/cybox/bindings/win_filemapping_object.py index 1ac6e6ce..4bf1cca7 100644 --- a/cybox/bindings/win_filemapping_object.py +++ b/cybox/bindings/win_filemapping_object.py @@ -4,9 +4,8 @@ import sys from cybox.bindings import * -import cybox_common - -import win_handle_object +from . import cybox_common +from . import win_handle_object class PageProtectionAttributeType(cybox_common.BaseObjectPropertyType): @@ -16,7 +15,7 @@ class PageProtectionAttributeType(cybox_common.BaseObjectPropertyType): type. Its base type is the CybOX Core cybox_common.BaseObjectPropertyType, for permitting complex (i.e. regular-expression based) specifications.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -407,7 +406,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -453,7 +452,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_handle_object.py b/cybox/bindings/win_handle_object.py index 9831b394..94099e8c 100644 --- a/cybox/bindings/win_handle_object.py +++ b/cybox/bindings/win_handle_object.py @@ -4,13 +4,13 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class WindowsHandleListType(GeneratedsSuper): """The WindowsHandleListType type specifies a list of Windows handles, for re-use in other objects.""" - + subclass = None superclass = None def __init__(self, Handle=None): @@ -82,7 +82,7 @@ class HandleType(cybox_common.BaseObjectPropertyType): (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -151,7 +151,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsHandleObjectType(cybox_common.ObjectPropertiesType): """The WindowsHandleObjectType type is intended to characterize Windows handles.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, ID=None, Name=None, Type=None, Object_Address=None, Access_Mask=None, Pointer_Count=None): @@ -379,7 +379,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -425,7 +425,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_hook_object.py b/cybox/bindings/win_hook_object.py index 4e15170d..0e4608c0 100644 --- a/cybox/bindings/win_hook_object.py +++ b/cybox/bindings/win_hook_object.py @@ -4,10 +4,9 @@ import sys from cybox.bindings import * -import cybox_common - -import library_object -import win_handle_object +from . import cybox_common +from . import library_object +from . import win_handle_object class WinHookType(cybox_common.BaseObjectPropertyType): @@ -312,7 +311,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -358,7 +357,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_kernel_hook_object.py b/cybox/bindings/win_kernel_hook_object.py index 9326392d..b7f143ae 100644 --- a/cybox/bindings/win_kernel_hook_object.py +++ b/cybox/bindings/win_kernel_hook_object.py @@ -4,7 +4,7 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class KernelHookType(cybox_common.BaseObjectPropertyType): @@ -14,7 +14,7 @@ class KernelHookType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -83,7 +83,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsKernelHookObjectType(cybox_common.ObjectPropertiesType): """The WindowsKernelHookObjectType type is intended to characterize Windows kernel function hooks.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Digital_Signature_Hooking=None, Digital_Signature_Hooked=None, Hooking_Address=None, Hook_Description=None, Hooked_Function=None, Hooked_Module=None, Hooking_Module=None, Type=None): @@ -331,7 +331,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -377,7 +377,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_kernel_object.py b/cybox/bindings/win_kernel_object.py index 9b2dcfd4..e2c61611 100644 --- a/cybox/bindings/win_kernel_object.py +++ b/cybox/bindings/win_kernel_object.py @@ -4,13 +4,13 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class SSDTEntryListType(GeneratedsSuper): """The SSDTEntryListType type specifies a listing of the entries in the System Service Descriptor Table (SSDT).""" - + subclass = None superclass = None def __init__(self, SSDT_Entry=None): @@ -79,7 +79,7 @@ class SSDTEntryType(GeneratedsSuper): """The SSDTEntryType type specifies a single entry in the System Service Descriptor Table (SSDT).The hooked attribute specifies whether the SSDT entry is hooked.""" - + subclass = None superclass = None def __init__(self, hooked=None, Service_Table_Base=None, Service_Counter_Table_Base=None, Number_Of_Services=None, Argument_Table_Base=None): @@ -194,7 +194,7 @@ class IDTEntryListType(GeneratedsSuper): I386 architecture, indicating where the Prtoetcted mode Interrupt Service Routines (ISR) are located. See http://wiki.osdev.org/Interrupt_Descriptor_Table""" - + subclass = None superclass = None def __init__(self, IDT_Entry=None): @@ -263,7 +263,7 @@ class IDTEntryType(GeneratedsSuper): """The IDTEntryType type specifies a single entry in the Interrupt Descriptor Table (IDT). Entries can be interrupt gates, task gates, and trap gates.""" - + subclass = None superclass = None def __init__(self, Type_Attr=None, Offset_High=None, Offset_Low=None, Offset_Middle=None, Selector=None): @@ -369,7 +369,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsKernelObjectType(cybox_common.ObjectPropertiesType): """The WindowsKernelObjectType type is intended to characterize Windows Kernel structures.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, IDT=None, SSDT=None): @@ -550,7 +550,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -596,7 +596,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_mailslot_object.py b/cybox/bindings/win_mailslot_object.py index 35de9c33..c061f1db 100644 --- a/cybox/bindings/win_mailslot_object.py +++ b/cybox/bindings/win_mailslot_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import win_handle_object +from . import cybox_common +from . import win_handle_object class WindowsMailslotObjectType(cybox_common.ObjectPropertiesType): """The WindowsMailslotObjectType is intended to characterize Windows mailslot objects.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Handle=None, Max_Message_Size=None, Name=None, Read_Timeout=None, Security_Attributes=None): @@ -229,7 +228,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -275,7 +274,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_memory_page_region_object.py b/cybox/bindings/win_memory_page_region_object.py index 22b572f9..2df0674f 100644 --- a/cybox/bindings/win_memory_page_region_object.py +++ b/cybox/bindings/win_memory_page_region_object.py @@ -4,9 +4,8 @@ import sys from cybox.bindings import * -import cybox_common - -import memory_object +from . import cybox_common +from . import memory_object class MemoryPageTypeType(cybox_common.BaseObjectPropertyType): @@ -16,7 +15,7 @@ class MemoryPageTypeType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -89,7 +88,7 @@ class MemoryPageStateType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -163,7 +162,7 @@ class MemoryPageProtectionType(cybox_common.BaseObjectPropertyType): expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -232,7 +231,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsMemoryPageRegionObjectType(memory_object.MemoryObjectType): """The WindowsMemoryPageRegionObjectType type is intended to characterize Windows memory page regions.""" - + subclass = None superclass = memory_object.MemoryObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_protected=None, is_injected=None, is_mapped=None, Hashes=None, Name=None, Region_Size=None, Region_Start_Address=None, Extracted_Features=None, Type=None, Allocation_Base_Address=None, Allocation_Protect=None, State=None, Protect=None): @@ -451,7 +450,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -497,7 +496,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_mutex_object.py b/cybox/bindings/win_mutex_object.py index e3544a92..6cf90244 100644 --- a/cybox/bindings/win_mutex_object.py +++ b/cybox/bindings/win_mutex_object.py @@ -4,16 +4,15 @@ import sys from cybox.bindings import * -import cybox_common - -import mutex_object -import win_handle_object +from . import cybox_common +from . import mutex_object +from . import win_handle_object class WindowsMutexObjectType(mutex_object.MutexObjectType): """The WindowsMutexObjectType type is intended to characterize Windows mutual exclusion (mutex) objects.""" - + subclass = None superclass = mutex_object.MutexObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, named=None, Name=None, Handle=None, Security_Attributes=None): @@ -196,7 +195,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -242,7 +241,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_network_route_entry_object.py b/cybox/bindings/win_network_route_entry_object.py index a3eabc7b..39c2ff03 100644 --- a/cybox/bindings/win_network_route_entry_object.py +++ b/cybox/bindings/win_network_route_entry_object.py @@ -4,10 +4,9 @@ import sys from cybox.bindings import * -import cybox_common - -import address_object -import network_route_entry_object +from . import cybox_common +from . import address_object +from . import network_route_entry_object class NLRouteProtocolType(cybox_common.BaseObjectPropertyType): @@ -18,7 +17,7 @@ class NLRouteProtocolType(cybox_common.BaseObjectPropertyType): expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -92,7 +91,7 @@ class NLRouteOriginType(cybox_common.BaseObjectPropertyType): expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -161,7 +160,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsNetworkRouteEntryObjectType(network_route_entry_object.NetworkRouteEntryObjectType): """The WindowsNetworkRouteEntryObjectType type is intended to characterize Windows network routing table entries.""" - + subclass = None superclass = network_route_entry_object.NetworkRouteEntryObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_publish=None, is_autoconfigure_address=None, is_loopback=None, is_immortal=None, is_ipv6=None, Destination_Address=None, Origin=None, Netmask=None, Gateway_Address=None, Metric=None, Type=None, Protocol=None, Interface=None, Preferred_Lifetime=None, Valid_Lifetime=None, Route_Age=None, NL_ROUTE_PROTOCOL=None, NL_ROUTE_ORIGIN=None): @@ -353,7 +352,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -399,7 +398,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_network_share_object.py b/cybox/bindings/win_network_share_object.py index cfd65f9a..c01dc138 100644 --- a/cybox/bindings/win_network_share_object.py +++ b/cybox/bindings/win_network_share_object.py @@ -4,7 +4,7 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class SharedResourceType(cybox_common.BaseObjectPropertyType): @@ -419,7 +419,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -465,7 +465,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_pipe_object.py b/cybox/bindings/win_pipe_object.py index bb5e7c54..80e51d15 100644 --- a/cybox/bindings/win_pipe_object.py +++ b/cybox/bindings/win_pipe_object.py @@ -4,16 +4,15 @@ import sys from cybox.bindings import * -import cybox_common - -import pipe_object -import win_handle_object +from . import cybox_common +from . import pipe_object +from . import win_handle_object class WindowsPipeObjectType(pipe_object.PipeObjectType): """The WindowsPipeObjectType type is intended to characterize Windows pipes.""" - + subclass = None superclass = pipe_object.PipeObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, named=None, Name=None, Default_Time_Out=None, Handle=None, In_Buffer_Size=None, Max_Instances=None, Open_Mode=None, Out_Buffer_Size=None, Pipe_Mode=None, Security_Attributes=None): @@ -268,7 +267,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -314,7 +313,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_prefetch_object.py b/cybox/bindings/win_prefetch_object.py index 3f3dcf9f..a36a9fd6 100644 --- a/cybox/bindings/win_prefetch_object.py +++ b/cybox/bindings/win_prefetch_object.py @@ -4,16 +4,15 @@ import sys from cybox.bindings import * -import cybox_common - -import device_object -import win_volume_object +from . import cybox_common +from . import device_object +from . import win_volume_object class AccessedFileListType(GeneratedsSuper): """The AccessedFileListType specifies a list of files accessed by a prefetch application.""" - + subclass = None superclass = None def __init__(self, Accessed_Filename=None): @@ -84,7 +83,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class AccessedDirectoryListType(GeneratedsSuper): """The AccessedDirectoryListType specifies a list of directories accessed by a prefetch application.""" - + subclass = None superclass = None def __init__(self, Accessed_Directory=None): @@ -155,7 +154,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class VolumeType(GeneratedsSuper): """VolumeType characterizes the volume information in the Windows prefetch file.""" - + subclass = None superclass = None def __init__(self, VolumeItem=None, DeviceItem=None): @@ -241,7 +240,7 @@ class WindowsPrefetchObjectType(cybox_common.ObjectPropertiesType): prefetching was introduced to speed up application startup. The prefetch object draws upon the descriptions and XML sample at http://www.forensicswiki.org/wiki/Prefetch_XML""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Application_File_Name=None, Prefetch_Hash=None, Times_Executed=None, First_Run=None, Last_Run=None, Volume=None, Accessed_File_List=None, Accessed_Directory_List=None): @@ -508,7 +507,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -554,7 +553,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_process_object.py b/cybox/bindings/win_process_object.py index d6746a23..0092eb70 100644 --- a/cybox/bindings/win_process_object.py +++ b/cybox/bindings/win_process_object.py @@ -4,18 +4,17 @@ import sys from cybox.bindings import * -import cybox_common - -import memory_object -import process_object -import win_handle_object -import win_thread_object +from . import cybox_common +from . import memory_object +from . import process_object +from . import win_handle_object +from . import win_thread_object class MemorySectionListType(GeneratedsSuper): """The MemorySectionListType type specifies a list of memory sections used by the process.""" - + subclass = None superclass = None def __init__(self, Memory_Section=None): @@ -83,7 +82,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class StartupInfoType(GeneratedsSuper): """The StartupInfoType type encapsulates the information contained in the STARTUPINFO struct for the process.""" - + subclass = None superclass = None def __init__(self, lpDesktop=None, lpTitle=None, dwX=None, dwY=None, dwXSize=None, dwYSize=None, dwXCountChars=None, dwYCountChars=None, dwFillAttribute=None, dwFlags=None, wShowWindow=None, hStdInput=None, hStdOutput=None, hStdError=None): @@ -288,7 +287,7 @@ class WindowsProcessObjectType(process_object.ProcessObjectType): Address Space Layout Randomization (ASLR) is enabled for the process.The dep_enabled field specifies whether Data Execution Prevention (DEP) is enabled for the process.""" - + subclass = None superclass = process_object.ProcessObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_hidden=None, PID=None, Name=None, Creation_Time=None, Parent_PID=None, Child_PID_List=None, Image_Info=None, Argument_List=None, Environment_Variable_List=None, Kernel_Time=None, Port_List=None, Network_Connection_List=None, Start_Time=None, Status=None, Username=None, User_Time=None, Extracted_Features=None, aslr_enabled=None, dep_enabled=None, Handle_List=None, Priority=None, Section_List=None, Security_ID=None, Startup_Info=None, Security_Type=None, Window_Title=None, Thread=None): @@ -305,7 +304,7 @@ def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, if not Thread: self.Thread = [] else: - self.Thread = Thread + self.Thread = Thread def factory(*args_, **kwargs_): if WindowsProcessObjectType.subclass: return WindowsProcessObjectType.subclass(*args_, **kwargs_) @@ -686,7 +685,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -732,7 +731,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_registry_key_object.py b/cybox/bindings/win_registry_key_object.py index e2e04c66..e98f733b 100644 --- a/cybox/bindings/win_registry_key_object.py +++ b/cybox/bindings/win_registry_key_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import win_handle_object +from . import cybox_common +from . import win_handle_object class RegistryValueType(GeneratedsSuper): """The RegistryValueType type is intended to characterize Windows registry Value name/data pairs.""" - + subclass = None superclass = None def __init__(self, Name=None, Data=None, Datatype=None, Byte_Runs=None): @@ -111,7 +110,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class RegistryValuesType(GeneratedsSuper): """The RegistryValuesType type specifies the values (with their name/data pairs) held within the registry key.""" - + subclass = None superclass = None def __init__(self, Value=None): @@ -179,7 +178,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class RegistrySubkeysType(GeneratedsSuper): """The RegistrySubkeysType specifies the set of subkeys contained under the registry key.""" - + subclass = None superclass = None def __init__(self, Subkey=None): @@ -251,7 +250,7 @@ class RegistryHiveType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -324,7 +323,7 @@ class RegistryDatatypeType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -393,7 +392,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsRegistryKeyObjectType(cybox_common.ObjectPropertiesType): """The WindowsRegistryObjectType type is intended to characterize Windows registry objects, including Keys and Key/Value pairs.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType 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): @@ -671,7 +670,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -717,7 +716,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_semaphore_object.py b/cybox/bindings/win_semaphore_object.py index 1bfccb55..abaa4f13 100644 --- a/cybox/bindings/win_semaphore_object.py +++ b/cybox/bindings/win_semaphore_object.py @@ -4,16 +4,15 @@ import sys from cybox.bindings import * -import cybox_common - -import semaphore_object -import win_handle_object +from . import cybox_common +from . import semaphore_object +from . import win_handle_object class WindowsSemaphoreObjectType(semaphore_object.SemaphoreObjectType): """The WindowsSemaphoreObjectType is intended to characterize Windows semaphore (synchronization) objects.""" - + subclass = None superclass = semaphore_object.SemaphoreObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, named=None, Current_Count=None, Maximum_Count=None, Name=None, Handle=None, Security_Attributes=None): @@ -198,7 +197,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -244,7 +243,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_service_object.py b/cybox/bindings/win_service_object.py index 2f94caf2..d9101c4c 100644 --- a/cybox/bindings/win_service_object.py +++ b/cybox/bindings/win_service_object.py @@ -4,14 +4,13 @@ import sys from cybox.bindings import * -import cybox_common - -import win_process_object +from . import cybox_common +from . import win_process_object class ServiceDescriptionListType(GeneratedsSuper): """A collection of service descriptions.""" - + subclass = None superclass = None def __init__(self, Description=None): @@ -86,7 +85,7 @@ class ServiceType(cybox_common.BaseObjectPropertyType): complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -159,7 +158,7 @@ class ServiceStatusType(cybox_common.BaseObjectPropertyType): complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -232,7 +231,7 @@ class ServiceModeType(cybox_common.BaseObjectPropertyType): complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -303,7 +302,7 @@ class WindowsServiceObjectType(win_process_object.WindowsProcessObjectType): Windows services.Indicates whether or not the DLL is signed.Indicates whether or not the DLL's signature was verified.""" - + subclass = None superclass = win_process_object.WindowsProcessObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_hidden=None, PID=None, Name=None, Creation_Time=None, Parent_PID=None, Child_PID_List=None, Image_Info=None, Argument_List=None, Environment_Variable_List=None, Kernel_Time=None, Port_List=None, Network_Connection_List=None, Start_Time=None, Status=None, Username=None, User_Time=None, Extracted_Features=None, aslr_enabled=None, dep_enabled=None, Handle_List=None, Priority=None, Section_List=None, Security_ID=None, Startup_Info=None, Security_Type=None, Window_Title=None, service_dll_signature_verified=None, service_dll_signature_exists=None, Description_List=None, Display_Name=None, Group_Name=None, Service_Name=None, Service_DLL=None, Service_DLL_Certificate_Issuer=None, Service_DLL_Certificate_Subject=None, Service_DLL_Hashes=None, Service_DLL_Signature_Description=None, Startup_Command_Line=None, Startup_Type=None, Service_Status=None, Service_Type=None, Started_As=None): @@ -760,7 +759,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -806,7 +805,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_system_object.py b/cybox/bindings/win_system_object.py index fc06a391..03117134 100644 --- a/cybox/bindings/win_system_object.py +++ b/cybox/bindings/win_system_object.py @@ -4,16 +4,15 @@ import sys from cybox.bindings import * -import cybox_common - -import system_object -import win_handle_object +from . import cybox_common +from . import system_object +from . import win_handle_object class GlobalFlagListType(GeneratedsSuper): """The GlobalFlagListType type is a listing of all Windows global flags.""" - + subclass = None superclass = None def __init__(self, Global_Flag=None): @@ -81,7 +80,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class GlobalFlagType(GeneratedsSuper): """The GlobalFlagType type is intended to characterize Windows global flags.""" - + subclass = None superclass = None def __init__(self, Abbreviation=None, Destination=None, Hexadecimal_Value=None, Symbolic_Name=None): @@ -180,7 +179,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsSystemObjectType(system_object.SystemObjectType): """The WindowsSystemObjectType type is intended to characterize Windows systems.""" - + subclass = None superclass = system_object.SystemObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Available_Physical_Memory=None, BIOS_Info=None, Date=None, Hostname=None, Local_Time=None, Network_Interface_List=None, OS=None, Processor=None, Processor_Architecture=None, System_Time=None, Timezone_DST=None, Timezone_Standard=None, Total_Physical_Memory=None, Uptime=None, Username=None, Domain=None, Global_Flag_List=None, NetBIOS_Name=None, Open_Handle_List=None, Product_ID=None, Product_Name=None, Registered_Organization=None, Registered_Owner=None, Windows_Directory=None, Windows_System_Directory=None, Windows_Temp_Directory=None): @@ -505,7 +504,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -551,7 +550,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_system_restore_object.py b/cybox/bindings/win_system_restore_object.py index e97dc7c3..46341cb7 100644 --- a/cybox/bindings/win_system_restore_object.py +++ b/cybox/bindings/win_system_restore_object.py @@ -4,11 +4,11 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class HiveListType(GeneratedsSuper): - + subclass = None superclass = None def __init__(self, Hive=None): @@ -83,7 +83,7 @@ class ChangeLogEntryTypeType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -152,7 +152,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsSystemRestoreObjectType(cybox_common.ObjectPropertiesType): """The WindowsSystemRestoreObjectType is intended to characterize Windows system restore points.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Restore_Point_Description=None, Restore_Point_Full_Path=None, Restore_Point_Name=None, Restore_Point_Type=None, ACL_Change_SID=None, ACL_Change_Username=None, Backup_File_Name=None, Change_Event=None, ChangeLog_Entry_Flags=None, ChangeLog_Entry_Sequence_Number=None, ChangeLog_Entry_Type=None, Change_Log_File_Name=None, Created=None, File_Attributes=None, New_File_Name=None, Original_File_Name=None, Original_Short_File_Name=None, Process_Name=None, Registry_Hive_List=None): @@ -523,7 +523,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -569,7 +569,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_task_object.py b/cybox/bindings/win_task_object.py index 05ee69f2..9dc621fc 100644 --- a/cybox/bindings/win_task_object.py +++ b/cybox/bindings/win_task_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import email_message_object +from . import cybox_common +from . import email_message_object class TriggerListType(GeneratedsSuper): """The TriggerListType type specifies a set of triggers associated with the scheduled task.""" - + subclass = None superclass = None def __init__(self, Trigger=None): @@ -82,7 +81,7 @@ class TriggerType(GeneratedsSuper): http://msdn.microsoft.com/en- us/library/windows/desktop/aa383868(v=vs.85).aspxThe enabled field specifies whether the trigger is enabled.""" - + subclass = None superclass = None def __init__(self, enabled=None, Trigger_Begin=None, Trigger_Delay=None, Trigger_End=None, Trigger_Frequency=None, Trigger_Max_Run_Time=None, Trigger_Session_Change_Type=None, Trigger_Type=None): @@ -229,7 +228,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class TaskActionListType(GeneratedsSuper): """The TaskActionListType type specifies a list of task actions.""" - + subclass = None superclass = None def __init__(self, Action=None): @@ -296,7 +295,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class TaskActionType(GeneratedsSuper): """The TaskActionType type characterizes scheduled task actions.""" - + subclass = None superclass = None def __init__(self, Action_Type=None, Action_ID=None, IEmailAction=None, IComHandlerAction=None, IExecAction=None, IShowMessageAction=None): @@ -414,7 +413,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class IComHandlerActionType(GeneratedsSuper): """The IComHandlerActionType type characterizes IComHandler actions.""" - + subclass = None superclass = None def __init__(self, COM_Data=None, COM_Class_ID=None): @@ -489,7 +488,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class IExecActionType(GeneratedsSuper): """The IExecActionType type characterizes IExec actions.""" - + subclass = None superclass = None def __init__(self, Exec_Arguments=None, Exec_Program_Path=None, Exec_Working_Directory=None, Exec_Program_Hashes=None): @@ -584,7 +583,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class IShowMessageActionType(GeneratedsSuper): """The IShowMessageActionType type characterizes IShowMessage actions.""" - + subclass = None superclass = None def __init__(self, Show_Message_Body=None, Show_Message_Title=None): @@ -664,7 +663,7 @@ class TaskStatusType(cybox_common.BaseObjectPropertyType): complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -738,7 +737,7 @@ class TaskTriggerType(cybox_common.BaseObjectPropertyType): expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -812,7 +811,7 @@ class TaskTriggerFrequencyType(cybox_common.BaseObjectPropertyType): expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -885,7 +884,7 @@ class TaskPriorityType(cybox_common.BaseObjectPropertyType): for permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -958,7 +957,7 @@ class TaskFlagType(cybox_common.BaseObjectPropertyType): complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -1028,7 +1027,7 @@ class TaskActionTypeType(cybox_common.BaseObjectPropertyType): """The TaskActionTypeType characterizes the specific types of task actions.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -1098,7 +1097,7 @@ class WindowsTaskObjectType(cybox_common.ObjectPropertiesType): """The WindowsTaskObjectType type is intended to characterize Windows task scheduler tasks. See Also: http://msdn.microsoft.com/en- us/library/windows/desktop/aa381311(v=vs.85).aspx""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Status=None, Priority=None, Name=None, Application_Name=None, Parameters=None, Flags=None, Account_Name=None, Account_Run_Level=None, Account_Logon_Type=None, Creator=None, Creation_Date=None, Most_Recent_Run_Time=None, Exit_Code=None, Max_Run_Time=None, Next_Run_Time=None, Action_List=None, Trigger_List=None, Comment=None, Working_Directory=None, Work_Item_Data=None): @@ -1523,7 +1522,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): 'Fuzzy_Hash_Value': cybox_common.FuzzyHashValueType, 'Show_Message_Title': cybox_common.StringObjectPropertyType, 'Data_Size': cybox_common.DataSizeType, - 'Email_Message': email_message_object.EmailMessageObjectType, + 'email_message': email_message_object.EmailMessageObjectType, 'Dependency_Description': cybox_common.StructuredTextType, 'File': email_message_object.AttachmentReferenceType, 'Contributor': cybox_common.ContributorType, @@ -1536,7 +1535,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -1582,7 +1581,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_thread_object.py b/cybox/bindings/win_thread_object.py index 824d3a50..56f45812 100644 --- a/cybox/bindings/win_thread_object.py +++ b/cybox/bindings/win_thread_object.py @@ -4,9 +4,8 @@ import sys from cybox.bindings import * -import cybox_common - -import win_handle_object +from . import cybox_common +from . import win_handle_object class ThreadRunningStatusType(cybox_common.BaseObjectPropertyType): @@ -17,7 +16,7 @@ class ThreadRunningStatusType(cybox_common.BaseObjectPropertyType): expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -87,7 +86,7 @@ class WindowsThreadObjectType(cybox_common.ObjectPropertiesType): """The Windows_ThreadObjectType is intended to characterize Windows process threads. See also: http://msdn.microsoft.com/en- us/library/windows/desktop/ms684852(v=vs.85).aspx""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Thread_ID=None, Handle=None, Running_Status=None, Context=None, Priority=None, Creation_Flags=None, Creation_Time=None, Start_Address=None, Parameter_Address=None, Security_Attributes=None, Stack_Size=None): @@ -382,7 +381,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -428,7 +427,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_user_account_object.py b/cybox/bindings/win_user_account_object.py index 39dae10c..311b2f49 100644 --- a/cybox/bindings/win_user_account_object.py +++ b/cybox/bindings/win_user_account_object.py @@ -4,15 +4,14 @@ import sys from cybox.bindings import * -import cybox_common - -import user_account_object +from . import cybox_common +from . import user_account_object class WindowsPrivilegeType(user_account_object.PrivilegeType): """Windows Privilege represents a single privilege that a user may have within Windows.""" - + subclass = None superclass = user_account_object.PrivilegeType def __init__(self, User_Right=None): @@ -81,7 +80,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsGroupType(user_account_object.GroupType): """Windows Group represents a single windows group.""" - + subclass = None superclass = user_account_object.GroupType def __init__(self, Name=None): @@ -151,7 +150,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsUserAccountObjectType(user_account_object.UserAccountObjectType): """The WinUserAccountObjectType type is intended to characterize Windows user accounts.""" - + subclass = None superclass = user_account_object.UserAccountObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, disabled=None, locked_out=None, Description=None, Domain=None, password_required=None, Full_Name=None, Group_List=None, Home_Directory=None, Last_Login=None, Privilege_List=None, Script_Path=None, Username=None, User_Password_Age=None, Security_ID=None, Security_Type=None): @@ -344,7 +343,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -390,7 +389,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_volume_object.py b/cybox/bindings/win_volume_object.py index d9c65abc..81fc079b 100644 --- a/cybox/bindings/win_volume_object.py +++ b/cybox/bindings/win_volume_object.py @@ -4,14 +4,13 @@ import sys from cybox.bindings import * -import cybox_common - -import volume_object +from . import cybox_common +from . import volume_object class WindowsVolumeAttributesListType(GeneratedsSuper): """A list of attributes describing this windows volume.""" - + subclass = None superclass = None def __init__(self, Attribute=None): @@ -87,7 +86,7 @@ class WindowsVolumeAttributeType(cybox_common.BaseObjectPropertyType): expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -160,7 +159,7 @@ class WindowsDriveType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, pattern_type=None, datatype='string', refanging_transform=None, bit_mask=None, appears_random=None, trend=None, defanging_algorithm_ref=None, is_obfuscated=None, regex_syntax=None, apply_condition='ANY', idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -229,7 +228,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsVolumeObjectType(volume_object.VolumeObjectType): """The WindowsVolumeObjectType type is intended to characterize Windows disk volumes.""" - + subclass = None superclass = volume_object.VolumeObjectType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, is_mounted=None, Name=None, Device_Path=None, File_System_Type=None, Total_Allocation_Units=None, Sectors_Per_Allocation_Unit=None, Bytes_Per_Sector=None, Actual_Available_Allocation_Units=None, Creation_Time=None, File_System_Flag_List=None, Serial_Number=None, Attributes_List=None, Drive_Letter=None, Drive_Type=None): @@ -429,7 +428,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -475,7 +474,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/win_waitable_timer_object.py b/cybox/bindings/win_waitable_timer_object.py index 7f671df7..953412a1 100644 --- a/cybox/bindings/win_waitable_timer_object.py +++ b/cybox/bindings/win_waitable_timer_object.py @@ -4,9 +4,8 @@ import sys from cybox.bindings import * -import cybox_common - -import win_handle_object +from . import cybox_common +from . import win_handle_object class WaitableTimerType(cybox_common.BaseObjectPropertyType): @@ -16,7 +15,7 @@ class WaitableTimerType(cybox_common.BaseObjectPropertyType): permitting complex (i.e. regular-expression based) specifications.This attribute is optional and specifies the expected type for the value of the specified property.""" - + subclass = None superclass = cybox_common.BaseObjectPropertyType def __init__(self, obfuscation_algorithm_ref=None, refanging_transform_type=None, has_changed=None, delimiter='##comma##', pattern_type=None, datatype='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='ANY', trend=None, idref=None, is_defanged=None, id=None, condition=None, valueOf_=None): @@ -85,7 +84,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class WindowsWaitableTimerObjectType(cybox_common.ObjectPropertiesType): """The WindowsWaitableTimerObjectType is intended to characterize Windows waitable timer (synchronization) objects.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Handle=None, Name=None, Security_Attributes=None, Type=None): @@ -290,7 +289,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -336,7 +335,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/bindings/x509_certificate_object.py b/cybox/bindings/x509_certificate_object.py index 0453d443..87dee5ba 100644 --- a/cybox/bindings/x509_certificate_object.py +++ b/cybox/bindings/x509_certificate_object.py @@ -4,14 +4,14 @@ import sys from cybox.bindings import * -import cybox_common +from . import cybox_common class X509CertificateContentsType(GeneratedsSuper): """The X509CertificateContentsType type represents the contents of an X.509 certificate, including items such as issuer, subject, and others.""" - + subclass = None superclass = None def __init__(self, Version=None, Serial_Number=None, Signature_Algorithm=None, Issuer=None, Validity=None, Subject=None, Subject_Public_Key=None, Standard_Extensions=None, Non_Standard_Extensions=None): @@ -160,7 +160,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class X509CertificateSignatureType(GeneratedsSuper): """The X509CertificateSignatureType contains the signature and signature algorithm of this X.509 certificate.""" - + subclass = None superclass = None def __init__(self, Signature_Algorithm=None, Signature=None): @@ -236,7 +236,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class SubjectPublicKeyType(GeneratedsSuper): """The SubjectPublicKeyType is used to carry the public key and identify the algorithm with which the key is used.""" - + subclass = None superclass = None def __init__(self, Public_Key_Algorithm=None, RSA_Public_Key=None): @@ -313,7 +313,7 @@ class ValidityType(GeneratedsSuper): """The ValidityType type is the time interval during which the issuer warrants that it will maintain information about the status of the certificate.""" - + subclass = None superclass = None def __init__(self, Not_Before=None, Not_After=None): @@ -388,7 +388,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class RSAPublicKeyType(GeneratedsSuper): """The RSAPublicKeyType captures details of RSA public keys.""" - + subclass = None superclass = None def __init__(self, Modulus=None, Exponent=None): @@ -468,7 +468,7 @@ class X509V3ExtensionsType(GeneratedsSuper): """The X509V3ExtensionsType captures the standard X509 V3 Extensions that may be used in X509 certificates. Based on RFC 3280, "Standard Extensions": http://www.ietf.org/rfc/rfc3280.txt""" - + subclass = None superclass = None def __init__(self, Basic_Constraints=None, Name_Constraints=None, Policy_Constraints=None, Key_Usage=None, Extended_Key_Usage=None, Subject_Key_Identifier=None, Authority_Key_Identifier=None, Subject_Alternative_Name=None, Issuer_Alternative_Name=None, Subject_Directory_Attributes=None, CRL_Distribution_Points=None, Inhibit_Any_Policy=None, Private_Key_Usage_Period=None, Certificate_Policies=None, Policy_Mappings=None): @@ -681,7 +681,7 @@ class X509NonStandardExtensionsType(GeneratedsSuper): sl.org/docs/apps/x509v3_config.html#Deprecated_Extensions. Also based on the Alvestrand certificateExtension reference: http://www.alvestrand.no/objectid/2.5.29.html""" - + subclass = None superclass = None def __init__(self, Netscape_Comment=None, Netscape_Certificate_Type=None, Old_Authority_Key_Identifier=None, Old_Primary_Key_Attributes=None): @@ -777,7 +777,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): class X509CertificateObjectType(cybox_common.ObjectPropertiesType): """The X509CertificateObjectType type is intended to characterize X.509 certificates.""" - + subclass = None superclass = cybox_common.ObjectPropertiesType def __init__(self, object_reference=None, Custom_Properties=None, xsi_type=None, Certificate=None, Raw_Certificate=None, Certificate_Signature=None): @@ -986,7 +986,7 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): """ def usage(): - print USAGE_TEXT + print(USAGE_TEXT) sys.exit(1) def get_root_tag(node): @@ -1032,7 +1032,7 @@ def parseEtree(inFileName): return rootObj, rootElement def parseString(inString): - from StringIO import StringIO + from cybox.compat import StringIO doc = parsexml_(StringIO(inString)) rootNode = doc.getroot() rootTag, rootClass = get_root_tag(rootNode) diff --git a/cybox/common/hashes.py b/cybox/common/hashes.py index 4d72a15d..5fbbab81 100644 --- a/cybox/common/hashes.py +++ b/cybox/common/hashes.py @@ -2,6 +2,7 @@ # See LICENSE.txt for complete terms. import cybox +from cybox.compat import basestring import cybox.bindings.cybox_common as common_binding from cybox.common import vocabs, HexBinary, String, VocabString from cybox.common.vocabs import HashName diff --git a/cybox/common/properties.py b/cybox/common/properties.py index e1958c7e..b57454a8 100644 --- a/cybox/common/properties.py +++ b/cybox/common/properties.py @@ -6,6 +6,7 @@ import dateutil.parser import cybox +from cybox.compat import basestring import cybox.bindings.cybox_common as common_binding from cybox.common import PatternFieldGroup from cybox.utils import normalize_to_xml, denormalize_from_xml @@ -15,6 +16,7 @@ DATETIME_PRECISION_VALUES = DATE_PRECISION_VALUES + TIME_PRECISION_VALUES + class BaseProperty(PatternFieldGroup, cybox.Entity): # Most Properties are defined in the "common" binding, so we'll just set # that here. Some BaseProperty subclasses might have to override this. @@ -63,7 +65,7 @@ def value(self, value_): # static methods, or on an instance of the class after it has been # created. if isinstance(value_, list): - self._value = map(self._parse_value, value_) + self._value = list(map(self._parse_value, value_)) else: self._value = self._parse_value(value_) @@ -104,7 +106,7 @@ def _parse_value(value): @property def serialized_value(self): if isinstance(self.value, list): - return map(self._serialize_value, self.value) + return list(map(self._serialize_value, self.value)) else: return self.__class__._serialize_value(self.value) diff --git a/cybox/compat.py b/cybox/compat.py new file mode 100644 index 00000000..778fc37a --- /dev/null +++ b/cybox/compat.py @@ -0,0 +1,23 @@ +import sys + +# Syntax sugar. +_ver = sys.version_info + +#: Python 2.x? +is_py2 = (_ver[0] == 2) + +#: Python 3.x? +is_py3 = (_ver[0] == 3) + + +if is_py2: + from StringIO import StringIO + basestring = basestring + bytes = str + str = unicode + +elif is_py3: + from io import StringIO + basestring = (str, bytes) + bytes = bytes + str = str diff --git a/cybox/objects/artifact_object.py b/cybox/objects/artifact_object.py index 5f9d5591..011d7aab 100644 --- a/cybox/objects/artifact_object.py +++ b/cybox/objects/artifact_object.py @@ -323,7 +323,7 @@ def __init__(self, key): def unpack(self, packed_data): from zipfile import ZipFile - from StringIO import StringIO + from cybox.compat import StringIO buf = StringIO(packed_data) with ZipFile(buf, 'r') as myzip: diff --git a/cybox/test/__init__.py b/cybox/test/__init__.py index 4c2fab1b..3a88460c 100644 --- a/cybox/test/__init__.py +++ b/cybox/test/__init__.py @@ -4,6 +4,8 @@ import json import unittest +from cybox.compat import str + import cybox.bindings as bindings from cybox import Entity, EntityList, TypedField import cybox.bindings.cybox_core as core_binding @@ -52,8 +54,8 @@ def round_trip(o, output=False, list_=False): klass = o.__class__ if output: - print "Class: ", klass - print "-" * 40 + print("Class: ", klass) + print("-" * 40) # 1. cybox.Entity -> dict/list if list_: @@ -66,7 +68,7 @@ def round_trip(o, output=False, list_=False): if output: print(json_string) - print "-" * 40 + print("-" * 40) # Before parsing the JSON, make sure the cache is clear cybox.utils.cache_clear() @@ -86,12 +88,12 @@ def round_trip(o, output=False, list_=False): # 6. Bindings Object -> XML String xml_string = o2.to_xml(encoding=bindings.ExternalEncoding) - if not isinstance(xml_string, unicode): + if not isinstance(xml_string, str): xml_string = xml_string.decode(bindings.ExternalEncoding) if output: print(xml_string) - print "-" * 40 + print("-" * 40) # Before parsing the XML, make sure the cache is clear cybox.utils.cache_clear() diff --git a/cybox/test/common/hash_test.py b/cybox/test/common/hash_test.py index 273ff806..4cffb426 100644 --- a/cybox/test/common/hash_test.py +++ b/cybox/test/common/hash_test.py @@ -172,10 +172,10 @@ def test_namespace_count(self): h.append(EMPTY_SHA256) h.append(EMPTY_SHA384) h.append(EMPTY_SHA512) - print h.to_xml() + print(h.to_xml()) ns_list = cybox.test.round_trip(h, list_=True)._get_namespaces() - print ns_list + print(ns_list) # Only "common" and "vocabs" should be here. "xsi" is only added later self.assertEqual(2, len(ns_list)) diff --git a/cybox/test/core/object_test.py b/cybox/test/core/object_test.py index 88e5511c..da86983f 100644 --- a/cybox/test/core/object_test.py +++ b/cybox/test/core/object_test.py @@ -150,7 +150,7 @@ def test_relationship_vocabnameref(self): def _test_round_trip(self, observables): self.maxDiff = None - print observables.to_xml() + print(observables.to_xml()) observables2 = round_trip(observables) self.assertEqual(observables.to_dict(), observables2.to_dict()) diff --git a/cybox/test/core/observable_test.py b/cybox/test/core/observable_test.py index c77373d8..42695365 100644 --- a/cybox/test/core/observable_test.py +++ b/cybox/test/core/observable_test.py @@ -42,7 +42,7 @@ def test_keywords(self): self.assertTrue("eyword" not in o.to_xml()) o.add_keyword("Foo") - print o.to_xml() + print(o.to_xml()) self.assertTrue("Foo" in o.to_xml()) o2 = round_trip(o) diff --git a/cybox/test/dev.py b/cybox/test/dev.py index 8e7e15e2..b0bb1236 100755 --- a/cybox/test/dev.py +++ b/cybox/test/dev.py @@ -20,13 +20,13 @@ def main(): subs = list(subclasses(cybox.Entity)) -# print "\n".join([str(x) for x in subs]) -# print len(subs) +# print("\n".join([str(x) for x in subs])) +# print(len(subs)) no_namespace = [x for x in subs if not filter_has_namespace(x)] for x in no_namespace: - print x - print len(no_namespace) + print(x) + print(len(no_namespace)) def filter_has_namespace(cls): diff --git a/cybox/test/objects/email_message_test.py b/cybox/test/objects/email_message_test.py index d65610c9..f03f1570 100644 --- a/cybox/test/objects/email_message_test.py +++ b/cybox/test/objects/email_message_test.py @@ -299,10 +299,10 @@ def test_get_namespaces(self): m.links.append(u.parent.id_) o = Observables([u, m]) - print o.to_xml() + print(o.to_xml()) actual_namespaces = o._get_namespaces() - print "\n".join([str(x) for x in actual_namespaces]) + print("\n".join([str(x) for x in actual_namespaces])) self.assertEqual(5, len(actual_namespaces)) diff --git a/cybox/utils/__init__.py b/cybox/utils/__init__.py index 59bd763d..2bcc7dec 100644 --- a/cybox/utils/__init__.py +++ b/cybox/utils/__init__.py @@ -5,11 +5,14 @@ #importlib is imported below import os +import xml.sax.saxutils from .caches import * from .idgen import * from .nsparser import * +from cybox.compat import str + def get_class_for_object_type(object_type): return META.get_class_for_object_type(object_type) @@ -34,12 +37,12 @@ def normalize_to_xml(value, delimiter): raise ValueError("delimiter must not be None") if isinstance(value, list): - normalized_list = [unicode(x) for x in value] + normalized_list = [str(x) for x in value] if any(delimiter in x for x in normalized_list): raise ValueError("list items cannot contain delimiter") normalized = delimiter.join(normalized_list) else: - normalized = unicode(value) + normalized = str(value) if delimiter in normalized: raise ValueError("value cannot contain delimiter") diff --git a/cybox/utils/normalize.py b/cybox/utils/normalize.py index 9142c4f8..55936dcb 100644 --- a/cybox/utils/normalize.py +++ b/cybox/utils/normalize.py @@ -15,47 +15,47 @@ # Windows-specific file normalization mappings # Replace with CSIDL values, if possible # As a backup, replace with Windows environment variable values -file_path_normalization_mapping = [{'regex' : re.compile('%system%',flags=re.IGNORECASE), +file_path_normalization_mapping = [{'regex' : re.compile('%system%',flags=re.IGNORECASE), 'replacement' : 'CSIDL_SYSTEM'}, - {'regex' : re.compile('%appdata%',flags=re.IGNORECASE), + {'regex' : re.compile('%appdata%',flags=re.IGNORECASE), 'replacement' : 'CSIDL_APPDATA'}, - {'regex' : re.compile('%commonappdata%',flags=re.IGNORECASE), + {'regex' : re.compile('%commonappdata%',flags=re.IGNORECASE), 'replacement' : 'CSIDL_COMMON_APPDATA'}, - {'regex' : re.compile('%commonprograms%',flags=re.IGNORECASE), + {'regex' : re.compile('%commonprograms%',flags=re.IGNORECASE), 'replacement' : 'CSIDL_COMMON_PROGRAMS'}, - {'regex' : re.compile('%programfiles%',flags=re.IGNORECASE), + {'regex' : re.compile('%programfiles%',flags=re.IGNORECASE), 'replacement' : 'CSIDL_PROGRAM_FILES'}, - {'regex' : re.compile('%programs%',flags=re.IGNORECASE), + {'regex' : re.compile('%programs%',flags=re.IGNORECASE), 'replacement' : 'CSIDL_COMMON_PROGRAMS'}, - {'regex' : re.compile('%temp%',flags=re.IGNORECASE), + {'regex' : re.compile('%temp%',flags=re.IGNORECASE), 'replacement' : 'TEMP'}, - {'regex' : re.compile('%userprofile%',flags=re.IGNORECASE), + {'regex' : re.compile('%userprofile%',flags=re.IGNORECASE), 'replacement' : 'CSIDL_PROFILE'}, - {'regex' : re.compile('%profiles%',flags=re.IGNORECASE), + {'regex' : re.compile('%profiles%',flags=re.IGNORECASE), 'replacement' : 'CSIDL_PROFILE'}, - {'regex' : re.compile('%windir%',flags=re.IGNORECASE), + {'regex' : re.compile('%windir%',flags=re.IGNORECASE), 'replacement' : 'CSIDL_WINDOWS'}, - {'regex' : re.compile('%systemroot%',flags=re.IGNORECASE), + {'regex' : re.compile('%systemroot%',flags=re.IGNORECASE), 'replacement' : 'CSIDL_WINDOWS'}, - {'regex' : re.compile('[\w][:]\\\\windows\\\\system32',flags=re.IGNORECASE), + {'regex' : re.compile('[\w][:]\\\\windows\\\\system32',flags=re.IGNORECASE), 'replacement' : 'CSIDL_SYSTEM'}, - {'regex' : re.compile('[\w][:]\\\\windows(?:(?!\\\\system32))',flags=re.IGNORECASE), + {'regex' : re.compile('[\w][:]\\\\windows(?:(?!\\\\system32))',flags=re.IGNORECASE), 'replacement' : 'CSIDL_WINDOWS'}, - {'regex' : re.compile('[\w][:]\\\\[A-Z+a-z~ ()0-9\\\\]+\\\\application data',flags=re.IGNORECASE), + {'regex' : re.compile('[\w][:]\\\\[A-Z+a-z~ ()0-9\\\\]+\\\\application data',flags=re.IGNORECASE), 'replacement' : 'CSIDL_APPDATA'}, - {'regex' : re.compile('[\w][:]\\\\[A-Z+a-z~ ()0-9\\\\]+\\\\all users\\\\application data',flags=re.IGNORECASE), + {'regex' : re.compile('[\w][:]\\\\[A-Z+a-z~ ()0-9\\\\]+\\\\all users\\\\application data',flags=re.IGNORECASE), 'replacement' : 'CSIDL_COMMON_APPDATA'}, - {'regex' : re.compile('[\w][:]\\\\[A-Z+a-z~ ()0-9\\\\]+\\\\all users\\\\start menu\\\\programs',flags=re.IGNORECASE), + {'regex' : re.compile('[\w][:]\\\\[A-Z+a-z~ ()0-9\\\\]+\\\\all users\\\\start menu\\\\programs',flags=re.IGNORECASE), 'replacement' : 'CSIDL_COMMON_PROGRAMS'}, - {'regex' : re.compile('[\w][:]\\\\[A-Z+a-z~ ()0-9\\\\]+\\\\temp',flags=re.IGNORECASE), + {'regex' : re.compile('[\w][:]\\\\[A-Z+a-z~ ()0-9\\\\]+\\\\temp',flags=re.IGNORECASE), 'replacement' : 'TEMP'}, - {'regex' : re.compile('[\w][:]\\\\users\\\\[A-Z+a-z~ ()0-9]+',flags=re.IGNORECASE), + {'regex' : re.compile('[\w][:]\\\\users\\\\[A-Z+a-z~ ()0-9]+',flags=re.IGNORECASE), 'replacement' : 'CSIDL_PROFILE'}, - {'regex' : re.compile('^\w:\\\\{0,2}$',flags=re.IGNORECASE), + {'regex' : re.compile('^\w:\\\\{0,2}$',flags=re.IGNORECASE), 'replacement' : '%SystemDrive%'}, - {'regex' : re.compile('^\w:\\\\documents and settings\\\\all users',flags=re.IGNORECASE), + {'regex' : re.compile('^\w:\\\\documents and settings\\\\all users',flags=re.IGNORECASE), 'replacement' : '%ALLUSERSPROFILE%'}, - {'regex' : re.compile('^\w:\\\\programdata',flags=re.IGNORECASE), + {'regex' : re.compile('^\w:\\\\programdata',flags=re.IGNORECASE), 'replacement' : '%ALLUSERSPROFILE%'}] # Windows Registry Hive Abbreviated -> Full mappings @@ -95,7 +95,7 @@ def perform_replacement(entity, mapping_list): def normalize_object_properties(object_properties): '''Normalize the field values of certain ObjectProperties instances. - + Currently supports: File Objects --File_Path field. Normalized for common Windows paths/environment variables. @@ -103,14 +103,14 @@ def normalize_object_properties(object_properties): --Registry Value/Data field. Normalized for common Windows paths/environment variables. - --Hive field. Normalized for full representation + --Hive field. Normalized for full representation from abbreviated form. E.g., HKLM -> HKEY_LOCAL_MACHINE. Process Objects --Image_Info/Path field. Normalized for common Windows paths/environment variables. ''' - + # Normalize file object properties/subclasses if isinstance(object_properties, File): # Normalize any windows-related file paths @@ -130,4 +130,4 @@ def normalize_object_properties(object_properties): elif isinstance(object_properties, Process): # Normalize any windows-related file paths in the process image path if object_properties.image_info and object_properties.image_info.path: - perform_replacement(object_properties.image_info.path, file_path_normalization_mapping) \ No newline at end of file + perform_replacement(object_properties.image_info.path, file_path_normalization_mapping) diff --git a/examples/artifact_instance.py b/examples/artifact_instance.py index 38a0b3f7..81d46e20 100644 --- a/examples/artifact_instance.py +++ b/examples/artifact_instance.py @@ -32,7 +32,7 @@ def main(): "captured in a PCAP file and then base64 encoded for " "transport.") - print Observables(o).to_xml() + print(Observables(o).to_xml()) if __name__ == "__main__": diff --git a/examples/convert_samples.py b/examples/convert_samples.py index 226b6db9..b33a2d9f 100644 --- a/examples/convert_samples.py +++ b/examples/convert_samples.py @@ -25,7 +25,7 @@ def from_file(filename): def main(): if len(sys.argv) < 2: - print "Argument required" + print("Argument required") return # The argument should be a directory containing XML files. @@ -35,7 +35,7 @@ def main(): os.mkdir(output_dir) if not os.path.isdir(output_dir): - print "{0} exists and is not a directory.".format(output_dir) + print("{0} exists and is not a directory.".format(output_dir)) return for f in os.listdir(sys.argv[1]): @@ -48,9 +48,9 @@ def main(): try: f.write(from_file(orig_file).to_json()) except Exception as e: - print "---------------------------------" - print "ERROR with {0}".format(orig_file) - print e + print("---------------------------------") + print("ERROR with {0}".format(orig_file)) + print(e) continue if __name__ == "__main__": diff --git a/examples/parse_xml.py b/examples/parse_xml.py index 5e06c506..34585700 100755 --- a/examples/parse_xml.py +++ b/examples/parse_xml.py @@ -18,12 +18,12 @@ def parse(xml_file): def main(): if len(sys.argv) != 2: - print "[!] Please provide an xml file" + print("[!] Please provide an xml file" ) exit(1) xml_file = sys.argv[-1] observables = parse(xml_file) - print observables.to_dict() # example to_dict() call on returned object + print(observables.to_dict() # example to_dict() call on returned object) if __name__ == "__main__": main() diff --git a/examples/simple_email_instance.py b/examples/simple_email_instance.py index 33cecaa6..57cbe9d8 100644 --- a/examples/simple_email_instance.py +++ b/examples/simple_email_instance.py @@ -25,7 +25,7 @@ def main(): m.add_related(a, "Received_From", inline=False) - print Observables([m, a]).to_xml() + print(Observables([m, a]).to_xml()) if __name__ == "__main__": diff --git a/examples/simple_email_pattern.py b/examples/simple_email_pattern.py index 75325937..93dea7a9 100644 --- a/examples/simple_email_pattern.py +++ b/examples/simple_email_pattern.py @@ -23,7 +23,7 @@ def main(): m.subject = "New modifications to the specification" m.subject.condition = "Equals" - print Observables(m).to_xml() + print(Observables(m).to_xml()) if __name__ == "__main__": main() diff --git a/examples/simple_file_instance.py b/examples/simple_file_instance.py index 03e57658..dad2a150 100644 --- a/examples/simple_file_instance.py +++ b/examples/simple_file_instance.py @@ -28,7 +28,7 @@ def main(): o = Observable(f) o.description = "This observable specifies a specific file observation." - print Observables(o).to_xml() + print(Observables(o).to_xml()) if __name__ == "__main__": main() diff --git a/examples/url_instance.py b/examples/url_instance.py index bdccc271..c5f8167d 100644 --- a/examples/url_instance.py +++ b/examples/url_instance.py @@ -22,7 +22,7 @@ def main(): u.value = v u.type_ = URI.TYPE_URL - print Observables(u).to_xml() + print(Observables(u).to_xml()) if __name__ == "__main__": main() diff --git a/examples/url_pattern.py b/examples/url_pattern.py index 16559e2e..4427b9f9 100644 --- a/examples/url_pattern.py +++ b/examples/url_pattern.py @@ -23,7 +23,7 @@ def main(): u.value = v u.type_ = URI.TYPE_URL - print Observables(u).to_xml() + print(Observables(u).to_xml()) if __name__ == "__main__": main() diff --git a/examples/xml_to_json.py b/examples/xml_to_json.py index fb27f434..d0546ed3 100644 --- a/examples/xml_to_json.py +++ b/examples/xml_to_json.py @@ -17,10 +17,10 @@ def from_file(filename): def main(): if len(sys.argv) < 2: - print "Argument required" + print("Argument required") return - print from_file(sys.argv[1]).to_json() + print(from_file(sys.argv[1]).to_json()) if __name__ == "__main__": main()