TmdZddlZddlmZddlmZddlmZddlm Z ddl m Z m Z ddl mZmZejeZGd d e Zd eeeeeffd eeeeefffd Zdeeefd eeeffdZdS)u  This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.  If not, see . Copyright © 2019 Cloud Linux Software Inc. This software is also available under ImunifyAV commercial license, see N) defaultdict)Iterable)urljoin)Request)APIAPIError)IAIDTokenErrorIndependentAgentIDAPIc`eZdZeejdZddddddZede de fdZ dS)VulnerabilityAPIz/api/patch/vulnerabilitiescveIdapptypenameseverityidsreturnc<Kt|jj}|s|S tjd{V}n4#t $r'}t d||cYd}~Sd}~wwxYw|jdd |z}t||dd} | |d{V}n4#t$r'}t d||cYd}~Sd}~wwxYw| t|d |S) zc Get vulnerabilities details for specific *ids*. More details in DEF-32152 NzACan't get iaid token: %s. Return default vulnerabilities details.z?ids=,zapplication/json)zX-Authz Content-Type)headerszRFailed to get vulnerabilities details: %s. Return default vulnerabilities details.vulnerabilities)r_STUB_VULNERABILITY_INFOcopyr get_tokenr loggererrorURLjoinr async_requestrupdatenormalize_vulnerabilities)clsrinfotokenexcurlrequestresults V/opt/imunify360/venv/lib/python3.11/site-packages/imav/malwarelib/api/vulnerability.py get_detailszVulnerabilityAPI.get_details/s 37<== K /9;;;;;;;;EE    LL:    KKKKKK  g/ /// $6HII    ,,W55555555FF    LL:    KKKKKK   -f5F.GHHIII s9; A,A'!A,'A,$C C1 C,&C1,C1N) __name__ __module__ __qualname__rr _BASE_URLrr classmethodrdictr,r+r r %sr '#-!= > >C   #H####[###r4r rrc>d|DS)z) Normalize vulnerabilities data. c4i|]\}}|t|Sr3)normalize_vulnerability).0_id vulnerabilitys r+ z-normalize_vulnerabilities..\s7    C $] 3 3   r4)items)rs r+r#r#Vs/   "1"7"7"9"9   r4r:c|dd|dd|dd|dd|dddS)z' Normalize vulnerability data. rr rrrrr)getupper)r:s r+r7r7bs~ ""7B//  ++!!&"--!!&"--!%%j"55;;==   r4)__doc__logging collectionsrtypingr urllib.parserurllib.requestrdefence360agent.api.serverrrdefence360agent.internals.iaidr r getLoggerr-rr r2strr#r7r3r4r+rJse*###### """"""44444444  8 $ $.....s...b #tCH~-.  #tCH~      4S> d38n      r4