CPE1_1 class¶
- class cpe.cpe1_1.CPE1_1(cpe_str, *args, **kwargs)[source]¶
Implementation of version 1.1 of CPE specification.
Basic structure of CPE Name:
- Hardware part: the physical platform supporting the IT system.
- Operating system part: the operating system controls and manages the IT hardware.
- Application part: software systems, services, servers, and packages installed on the system.
CPE Name syntax:
cpe:/ {hardware-part} [ / {OS-part} [ / {application-part} ] ]- ELEMENT_SEPARATOR = ';'¶
Separator of part elements of CPE Name
- PART_SEPARATOR = '/'¶
Part separator of CPE Name
- VERSION = '1.1'¶
Version of CPE Name
- __getitem__(i)[source]¶
Returns the i’th component name of CPE Name.
Parameters: i (int) – component index to find Returns: component string found Return type: CPEComponent Exception: IndexError - index not found in CPE Name TEST: good index
>>> str = 'cpe:///sun_microsystem:sun@os:5.9:#update' >>> c = CPE1_1(str) >>> c[0] CPEComponent1_1(sun_microsystem)
- __len__()[source]¶
Returns the number of components of CPE Name.
Returns: count of components of CPE Name Return type: int TEST: a CPE Name with two parts (hw and os) and some elements empty and with values
>>> str = "cpe:/cisco::3825/cisco:ios:12.3:enterprise" >>> c = CPE1_1(str) >>> len(c) 7
- static __new__(cpe_str, *args, **kwargs)[source]¶
Create a new CPE Name of version 1.1.
Parameters: cpe_str (string) – CPE Name string Returns: CPE object of version 1.1 of CPE specification. Return type: CPE1_1