/usr/lib/python3/dist-packages/uaclient/api/u/pro/security/cves/__pycache__
NameSizeModeActions
v1.cpython-310.pyc93140644editdlrm
__init__.cpython-310.pyc1680644editdlrm
Edit: /usr/lib/python3/dist-packages/uaclient/api/u/pro/security/cves/__pycache__/v1.cpython-310.pyc (9314B)
o Ki- @sddlZddlmZmZmZmZddlmZmZddl m Z ddl m Z ddl mZmZddlmZddlmZdd lmZmZmZmZmZmZmZmZGd d d eZGd d d eZGdddeZGdddeZ GdddeZ!Gdddee Z"GdddeZ#de$fddZ%dede"fddZ&dedee'efde'de"fd d!Z(ded"ede"fd#d$Z)e d%d&e)ed'Z*d(d)d*e"eggd+d,d-Z+dS).N)AnyDictListOptional)systemutil) APIEndpoint)AdditionalInfo)VulnerabilityParserget_vulnerabilities)get_apt_cache_datetime)UAConfig) BoolDataValue DataObjectDatetimeDataValueFieldFloatDataValueStringDataValue data_dict data_listc@sNeZdZededddededddgZddddeedeefdd Zd S) CVEsOptions unfixableFzShow only unfixable CVES.docfixablezShow only fixable CVES.rrcC||_||_dSNr)selfrrrE/usr/lib/python3/dist-packages/uaclient/api/u/pro/security/cves/v1.py__init__)s zCVEsOptions.__init__N) __name__ __module__ __qualname__rrfieldsrboolr!rrrr rs*rc@s`eZdZededddededddededdded ed dgZdededed efd d Zd S)CVEAffectedPackagenameFz The CVE namer fix_versionz.The version that fixes the CVE for the package fix_statusz)The status of the CVE fix for the package fix_originz*The pocket where the fix is available fromcC||_||_||_||_dSrr(r)r*r+)rr(r)r*r+rrr r!Ns zCVEAffectedPackage.__init__Nr"r#r$rrr%strr!rrrr r'3sDr'c@sBeZdZededdedeeddgZdede efddZ dS) AffectedPackagecurrent_versionz"The current version of the packagercvesz The CVE that affects the packagecCrrr1r2)rr1r2rrr r!es zAffectedPackage.__init__N) r"r#r$rrrr'r%r/rr!rrrr r0Ws" r0c@s:eZdZededdededdgZdedefddZdS) RelatedUSNr(z The USN namertitlez The USN titlecCrrr(r5)rr(r5rrr r!zs zRelatedUSN.__init__Nr.rrrr r4ls r4c@seZdZededdededdededdedeed d ded ed d ded ed ddgZddddddde de j de de e e d e e d e e de e ede e e fddZdS)CVEInfo descriptionzThe CVE descriptionr published_atzThe CVE published datepriorityzThe ubuntu priority for the CVEnotesFzA list of notes for the CVE cvss_scorezThe CVE cvss score cvss_severityzThe CVE cvss severityN)r;r<r= related_usnsrelated_packagesr>r?c Cs4||_||_||_||_||_||_||_||_dSrr8r9r:r;r<r=r>r?) rr8r9r:r;r<r=r>r?rrr r!s  zCVEInfo.__init__)r"r#r$rrrrrr%r/datetimerrfloatr4r!rrrr r7sr*   r7c @sleZdZedeedddedeedddgZdddee efdee efd e j d e e j fd d Z dS) CVEsResultpackages) value_clszcA dictionary where the keys are installed package names and the values are AffectedPackage objects.rr2zMA dictionary where the keys are CVE names and the values are CVEInfo objects.N)apt_updated_atvulnerability_data_published_atrFcCr,rrDr2rGrF)rrDr2rGrFrrr r!s  zCVEsResult.__init__) r"r#r$rrr0r7r%rr/rArr!rrrr rCs,   rCc@s`eZdZdZdeeefdeeeffddZdeeefdeeefdeeeffdd Zd S) CVEParserr2 affected_pkgreturncCs||jiSr)getvulnerability_type)rrJrrr get_package_vulnerabilitiessz%CVEParser.get_package_vulnerabilitiesvulnerability_infovulnerabilities_datacCs\|dr,g}|didi}|dD]}||||idddq||d<|S)Nr>security_issuesusnsr5r6)rLappend)rrOrPr>usn_info related_usnrrr _post_process_vulnerability_infos     z*CVEParser._post_process_vulnerability_infoN) r"r#r$rMrr/rrNrWrrrr rIs      rIrKcCs4|do |d}|jr|rdS|jr|sdSdS)Nr)r+FT)rLrr)cveoptions is_fixablerrr cve_status_match_optionss   r[rYcCs t|tSr)_cvesr )rYrrr r2 s r2vulnerabilitiesrGc si}tt|diD]@\}}g}t|dgdddD]!}t||rB|t|d|d|d|d d |dq!|rOt|d |d ||<qfd dt|didddD}t ||t |t dS)NrDr2cS|dS)Nr(r)rXrrr z(_parse_vulnerabilities..)keyr(r)r*r+r-r1r3csji|]1\}}|vr|t|dt|d|d|d|d|ddd|dgD|d gd qS) r8r9ubuntu_priorityr;r<r=cSs(g|]}t|dd|dddqS)r(rSr5r6)r4rL).0rVrrr 6s  z5_parse_vulnerabilities...r>r?r@)r7rparse_rfc3339_daterL)rccve_namerX allowed_cvesrr .s    z*_parse_vulnerabilities..r]cSr^)Nrr)vrrr r_Ar`rH) setsortedrLitemsr[rTr'addr0rCrrer ) rYr]rGrDpkg_name package_infopkg_cvesrXr2rrgr _parse_vulnerabilitiessP    rrcfgcCsH|jr |jr d|_d|_tj}tt||d}|j}t|||j dS)z This endpoint shows the CVE vulnerabilities in the system. By default, this API will show all CVEs that affect the system. F)parserrsseries)rYr]rG) rrrget_release_inforur rIvulnerabilities_inforrrG)rYrsrucve_vulnerabilities_resultcve_vulnerabilitiesrrr r\Ps  r\v1CVEs)versionr(fn options_cls35Tzs from uaclient.api.u.pro.security.cves.v1 import cves, CVEsOptions options = CVEsOptions() result = cves(options) zpro api u.pro.security.cves.v1a { "cves": { "CVE-2023-5678": { "cvss_score": 8.1, "cvss_severity": "high", "description": "description example", "notes": [ "note example", ], "priority": "medium", "published_at": ".*" } }, "packages": { "accountsservice": { "current_version": "0.6.40-2ubuntu11.6", "cves": [ { "fix_origin": "esm-infra", "fix_status": "fixed", "fix_version": "0.6.40-2ubuntu11.6+esm1", "name": "CVE-2023-5678" } ] }, "libaccountsservice0": { "current_version": "0.6.40-2ubuntu11.6", "cves": [ { "fix_origin": "esm-infra", "fix_status": "fixed", "fix_version": "0.6.40-2ubuntu11.6+esm1", "name": "CVE-2023-5678" } ] } }, } ) introduced_inrequires_networkexample_python result_classignore_result_classes exceptions example_cli example_json),rAtypingrrrruaclientrruaclient.api.apiruaclient.api.data_typesr +uaclient.api.u.pro.security.cves._common.v1r r uaclient.aptr uaclient.configr uaclient.data_typesrrrrrrrrrr'r0r4r7rCrIr&r[r2r/rrr\endpoint_docrrrr sj    ( $>#    A