CPEComponent class

class cpe.comp.cpecomp.CPEComponent(comp_str)[source]

Represents a generic component of CPE Name, compatible with the components of all versions of CPE specification.

ATT_EDITION = 'edition'

Edition attribute of CPE Name that captures the edition-related terms applied by the vendor to the product

ATT_LANGUAGE = 'language'

Language attribute of CPE Name that defines the language supported in the user interface of the product being described

ATT_OTHER = 'other'

Other attribute of version 2.3 of CPE Name that capture any other general descriptive or identifying information which is vendor- or product-specific and which does not logically fit in any other attribute value

ATT_PART = 'part'

Part attribute of CPE Name that indicates the type of system associated with the product

ATT_PRODUCT = 'product'

Product attribute of CPE Name that describes or identify the most common and recognizable title or name of the product

ATT_SW_EDITION = 'sw_edition'

SW_edition attribute of version 2.3 of CPE Name that characterizes how the product is tailored to a particular market or class of end users

ATT_TARGET_HW = 'target_hw'

Target_HW attribute of version 2.3 of CPE Name that characterizes the instruction set architecture (e.g., x86) on which the product being described or identified by the WFN operates

ATT_TARGET_SW = 'target_sw'

Target_SW attribute of version 2.3 of CPE Name that characterizes the software computing environment within which the product operates

ATT_UPDATE = 'update'

Version attribute of CPE Name that indicates vendor-specific alphanumeric strings characterizing the particular update, service pack, or point release of the product

ATT_VENDOR = 'vendor'

Vendor attribute of CPE Name that describes or identify the person or organization that manufactured or created the product

ATT_VERSION = 'version'

Version attribute of CPE Name that indicates vendor-specific alphanumeric strings characterizing the particular release version of the product

COMP_1_1 = '1.1'

Version 1.1 of CPE component

COMP_2_2 = '2.2'

Version 2.2 of CPE component

COMP_2_3_FS = '2.3_fs'

Version 2.3 with formatted string style of CPE component

COMP_2_3_URI = '2.3_uri'

Version 2.3 with URI style of CPE component

COMP_2_3_WFN = '2.3_wfn'

Version 2.3 with WFN style of CPE component

CPE_COMP_KEYS = ('part', 'vendor', 'product', 'version', 'update', 'edition', 'language')

List of attribute names associated with CPE Name components (versions 1.1 and 2.2 of CPE specification)

CPE_COMP_KEYS_EXTENDED = ('part', 'vendor', 'product', 'version', 'update', 'edition', 'language', 'sw_edition', 'target_sw', 'target_hw', 'other')

List of attribute names associated with CPE Name components of version 2.3

SYSTEM_VALUES = ('h', 'o', 'a', 'u')

Possible values of a type of system in CPE specification: hardware, operating system, software and undefined

VALUE_PART_APP = 'a'

Value of part attribute associated with an application

VALUE_PART_HW = 'h'

Value of part attribute associated with a hardware system

VALUE_PART_OS = 'o'

Value of part attribute associated with an operating system

VALUE_PART_UNDEFINED = 'u'

Value of part attribute that indicates a CPE Name with undefined type of system

__contains__(item)[source]

Returns True if item is included in set of values of self.

Parameters:item (CPEComponent) – component to find in self
Returns:True if item is included in set of self, otherwise False
Return type:boolean
__eq__(other)[source]

Returns True if other (first element of operation) and self (second element of operation) are equal components, false otherwise.

Parameters:other (CPEComponent) – component to compare
Returns:True if other == self, False otherwise
Return type:boolean
__init__(comp_str)[source]

Store the value of component.

Parameters:comp_str (string) – value of component value
Returns:None
__ne__(other)[source]

Returns True if other (first element of operation) and self (second element of operation) are not equal components, false otherwise.

Parameters:other (CPEComponent) – component to compare
Returns:True if other != self, False otherwise
Return type:boolean
__repr__()[source]

Returns a unambiguous representation of CPE component.

Returns:Representation of CPE component as string
Return type:string
__weakref__

list of weak references to the object (if defined)

classmethod is_valid_attribute(att_name)[source]

Check if input attribute name is correct.

Parameters:att_name (string) – attribute name to check
Returns:True is attribute name is valid, otherwise False
Return type:boolean

TEST: a wrong attribute

>>> from cpecomp import CPEComponent
>>> att = CPEComponent.ATT_PRODUCT
>>> CPEComponent.is_valid_attribute(att)
True
ordered_comp_parts = {0: 'part', 1: 'vendor', 2: 'product', 3: 'version', 4: 'update', 5: 'edition', 6: 'language', 7: 'sw_edition', 8: 'target_sw', 9: 'target_hw', 10: 'other'}

Order of attributes of CPE Name components