CPE1_1 class¶
-
class
cpe.cpe1_1.
CPE1_1
(cpe_str, *args, **kwargs)¶ 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} ] ]-
__getitem__
(i)¶ 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__
()¶ 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__
(cls, cpe_str, *args, **kwargs)¶ 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
-
as_wfn
()¶ Returns the CPE Name as Well-Formed Name string of version 2.3.
Returns: CPE Name as WFN string Return type: string Exception: TypeError - incompatible version