VULN_CHECK_I913V6 jE ddlZddlZddlZddlZddlZddlmZmZmZmZm Z m Z m Z m Z m Z ddlmZddlmZej$dZeeeej/dZedkrededdedd ed ed efd Zed dZeddZeZe Ze Z e Z!e Z"e Z#e Z$e Z%e Z&e Z'ee&Z(e Z)e Z*ee%Z+ee!Z,ee"Z-ee#Z.ee$Z/e Z0e Z1ee Z2ee Z3ee Z4e Z5e Z6 e)e,gejn_8e2ejn_9e2gejt_8e,ejt_9e*e gejv_8e-ejv_9e4e.gejx_8e*ejx_9e4egejz_8e*ejz_9e4ee5gej|_8e*ej|_9e1gej~_8e3ej~_9ee-gej_8e3ej_9e(e(ee4gej_8e*ej_9e4ee5gej_8e*ej_9e4e_4e5e_5e*e_*dZCdZDe(gej_8dej_9e(gej_8e'ej_9e)ee gej_8e-ej_9e-e gej_8eej_9e-eee gej_8eej_9e)eegej_8e,ej_9e,gej_8eej_9e,gej_8e ej_9e)ee(ee0gej_8e.ej_9e)ee0gej_8e/ej_9e/e gej_8dej_9e.gej_8eej_9e.egej_8e ej_9e+gej_8eej_9e+gej_8e-ej_9e)jede_Ue jede_Ve(e_(e.e_.e-e_-e+e_+de*dejdejd ejfdZYeYej_ZeYejx_ZeYej_ZGddZ[de\d e,fdZ]de\d e"fdZ^de-d edzfd Z_d!e`e\d e/fd"Zaejd#ejd ejdfd$Ze d)d%ejd&e`e\d'edzd dfd(Zfy#eW$r eddwxYw)*N) CDLLPOINTERc_boolc_char_pc_int32c_longc_uint32c_ulongc_void_p) find_library)_set_ssl_context_verify_mode.) z,Only OS X 10.8 and newer are supported, not namemacos10_16_pathreturnc tdk\r|}n t|}|stt|dS#t$rt d|ddwxYw)z:Loads a CDLL by name, falling back to known path on 10.16+)rT) use_errnoz The library z failed to loadN)_mac_version_infor OSErrorr ImportError)rrpaths B/usr/lib/python3.12/site-packages/pip/_vendor/truststore/_macos.py _load_cdllrs] J  ("D%DMDD)) JLo>?TIJs +.ASecurityz6/System/Library/Frameworks/Security.framework/SecurityCoreFoundationzB/System/Library/Frameworks/CoreFoundation.framework/CoreFoundationrkCFAllocatorDefaultkCFTypeArrayCallBackszError initializing ctypesresult_argscbt|dk(r|Sd} tj|d}tj|tj tj }tj|tj}|Ttjd}tj||dtj}|s td|j}|tj| ||dk(rd|}t!j"|#|tj|wwxYw)z< Raises an error if the OSStatus value is non-zero. rN'Error copying C string from CFStringRefz8SecureTransport operation returned a non-zero OSStatus: )intrSecCopyErrorMessageStringctypescastrr rCFStringGetCStringPtrCFConstkCFStringEncodingUTF8create_string_bufferCFStringGetCStringrvalue CFReleasesslSSLError)r#r$r%error_message_cfstringerror_message_cfstring_c_void_pmessagebuffers r_handle_osstatusr;s% 6{a "!=!)!C!CFD!Q+1++ "FNN6??$C+ '!66 +W-J-J  ?006F#66/-- F GHHllG " -  $ $%; <'R-LVHU ,,w  " -  $ $%; < .s CDD.c0eZdZdZedZdZdZdZdZ y)r/zCoreFoundation constantsiiiiiN) __name__ __module__ __qualname____doc__CFStringEncodingr0#errSecIncompleteCertRevocationCheckerrSecHostNameMismatcherrSecCertificateExpirederrSecNotTrustedrr/r/ s(",Z8*0'#%rGr/r3c^tjtj|t|SN)r CFDataCreater!len)r3s r_bytes_to_cf_data_refrLs&  & &**E3u: rGctj|}tjtj|t j }|S)zi Given a Python binary data, create a CFString. The string must be CFReleased by the caller. )r,rrCFStringCreateWithCStringr!r/r0)r3c_strcf_strs r_bytes_to_cf_stringrQs> OOE "E  5 5** %%F MrG cf_string_refc tj|tj}|Tt j d}tj ||dtj}|s td|j}||jd}|S)z Creates a Unicode string from a CFString object. Used entirely for error reporting. Yes, it annoys me quite a lot that this function is this complex. r'r(zutf-8) rr.r/r0r,r1r2rr3decode)rRstringr:r#s r_cf_string_ref_to_strrV(s 1 1w44F~,,T222 64)F)F CD D w' MrGcertsctjtjdtjtj }|s t d|D]{}d}d} t|}tjtj|}tj|||rtj||sgtj|}|S#|rtj||rtj|wwxYw)zBuilds a CFArray of SecCertificateRefs from a list of DER-encoded certificates. Responsibility of the caller to call CoreFoundation.CFRelease on the CFArray. rzUnable to allocate memory!N) rCFArrayCreateMutabler!r,byrefr" MemoryErrorrLrSecCertificateCreateWithDataCFArrayAppendValuer4)rWcf_array cert_datacf_data sec_cert_refs r_der_certs_to_cf_cert_arrayrb?s22**  ^99:H 677   7+I6G#@@22GL  - -h E((1((6 O ((1((6s AC1Dctxc#K|j}|j}d|_t|tj d||_t||y#||_t||wxYww)NF)check_hostname verify_moderr5 CERT_NONE)rcrerfs r_configure_contextrh]s_''N//KC cmm47 +$S+6,$S+6s:A-AA-A**A- ssl_context cert_chainserver_hostnamec d}d}d}d} |Kd} t|jd}tjd|}|r,tj |ntjdd}|}|j tjzrtjtjdtjtj}tj||tj |tjt t"z} tj|| tj | n(|j tj$zr t'dd} t)|}tj+}tj-||tj||rtj | |j/d} | rj@k(s|t>jBk(rd} n!|jDs|t>jFk(rd} | sd} tjI|}tK|xsd }tjM}tjO|tj|tjP|}||_)||_*| |rtj ||rtj |yy#|rtj |wwxYw#|rtj |wwxYw#| rtj | wwxYw#|rtj |wwxYw#|rtj ||rtj |wwxYw) NasciiTrz/VERIFY_CRL_CHECK_LEAF not implemented for macOS) binary_formr Fz8Unknown result from Security.SecTrustEvaluateWithError: zCertificate verification failed)+rQencoderSecPolicyCreateSSLrr4 verify_flagsr5VERIFY_CRL_CHECK_CHAINrYr!r,rZr"r]SecPolicyCreateRevocation#kSecRevocationUseAnyAvailableMethod%kSecRevocationRequirePositiveResponseVERIFY_CRL_CHECK_LEAFNotImplementedErrorrb SecTrustRefSecTrustCreateWithCertificates get_ca_certsSecTrustSetAnchorCertificates CFErrorRefSecTrustEvaluateWithErrorr6CFErrorGetCoderf CERT_REQUIREDr/rErDrerCCFErrorCopyDescriptionrVSecTrustResultTypeSecTrustGetTrustResultSSLCertVerificationErrorverify_message verify_code)rirjrkrWpoliciestrustcf_errorcf_str_hostname ssl_policyrevocation_policyctx_ca_certs_der ctx_ca_certssec_trust_eval_result is_trusted cf_error_codecf_error_string_refcf_error_messagesec_trust_result_typeerrs r_verify_peercerts_implrjs EH EHB,  &"O >"5o6L6LW6U"V%88O "",,_=!44T4@J  # #c&@&@ @%::22 ^AABH  - -h C  $ $Z 0 ( B B378!   - -h8I J  $ $%6 7  % %(A(A A%&WX X 0/ ;E((*E  3 3xe!4 ((/ 0;/G/G0H0  L ;::F 66ulK",,\:  2 25$ ?!,,. ( B B 6<<)!  !A %J "a 'J,,JK`Jcd  *99(CM &&#*;*;;!9!99 G$D$DD! ..!W%C%CC! "&  B&4&K&KH&U#**=>98!)1(C(C(E%//6<<(=>223CD%5""/ +6   $ $X .   $ $U + u#",,_=#L((/ ",,\: ~'",,-@A'   $ $X .   $ $U + sgQ0OD4Q4A O9=.Q,!P DQ%BP3O66Q9PQP00Q3Q  Q1RrI)g contextlibr,platformr5typingrrrrrrr r r ctypes.utilr _ssl_constantsrmac_ver _mac_versiontuplemapr*splitrrstrrrrBooleanCFIndexrACFDataCFStringCFArrayCFMutableArrayCFErrorCFTypeCFTypeID CFTypeRefCFAllocatorRefOSStatusr| CFDataRef CFStringRef CFArrayRefCFMutableArrayRefCFArrayCallBacks CFOptionFlagsSecCertificateRef SecPolicyRefrxrSecTrustOptionFlagsr\argtypesrestypeSecCertificateCopyDatar+r{!SecTrustSetAnchorCertificatesOnlySecTrustEvaluatersrpryrrtrur4 CFGetTypeIDrNr.r2rJCFDataGetLengthCFDataGetBytePtr CFArrayCreaterYr]CFArrayGetCountCFArrayGetValueAtIndexr~rin_dllr!r"AttributeErrorAnyr;errcheckr/bytesrLrQrVlistrbcontextmanager SSLContextIteratorrhrrFrGrrs     %8x!!$ #c<#5#5c#:;<w  67H7K6LAN_`aNbMcd  JSJ3J4J" H H         FO   W  FO h W  N+ H%x h y=6Di5PH))24EH))10A/BH##,.7H##+3;X2FH&&/1)>-*N&,;8??/,N( )N *N!,N *N 2 X2 &**2 FJJ2 6::2 j4D''02B&&/+;(9 u  t.tE{7H<  7CNN 7vt/D 7 7#'K,K,U K,4ZK, K,= 1 2<=s O?W W/