^~C() z d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z m Z mZ ddlZddl Z ddlmZ ddlmZ dZd Zd ZdZdZd ZdZ ed ZdZdefdZdefdZde e defdZdedefdZdedefdZ d Z!d Z"defdZ#d Z$d Z% d&ded e e& d!ed" d#e e d$e e f d%Z'dS )'z2Helper for integrate sentry in stand-alone scripts N)suppress)Path)ListOptionalLiteral)tags)sentry imunify360zimunify-antiviruszimunify360-firewallz/var/imunify360/license.jsonz!/var/imunify360/license-free.json IMUNIFYAVUNKNOWNz,/opt/imunify360/venv/share/imunify360/sentryzQhttps://6de77a2763bd40c58fc9e3a89285aaa8@im360.sentry.cloudlinux.com/3?timeout=20returnc t d S # t t f$ r t cY S w xY w)z,Return dsn from the file or the default one.ascii)encoding)SENTRY_DSN_PATH read_textstripOSErrorUnicodeDecodeErrorSENTRY_DSN_DEFAULT K/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/sentry.pyget_sentry_dsnr sW "(('(::@@BBB'( " " "!!!!"s ,/ A A c t t 5 t t fD ]} t t 5 t | 5 }t j | d cd d d cd d d c cd d d S # 1 swxY w Y d d d n# 1 swxY w Y d d d n# 1 swxY w Y t S )Nid) r ExceptionLICENSELICENSE_FREEFileNotFoundErroropenjsonload UNKNOWN_ID)filenamefiles r get_server_idr' $ s ) - - ,/ - -H+,, - -d8nn -yt, - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - s^ %B;B" B $B"0B;B B"B B"B;"B&&B;)B&*B;;B?B?cmdc t j | t j t j t j }n# t $ r Y dS w xY w|j dk rdS t j |j S )N)stdinstdoutstderr r ) subprocessrunDEVNULLPIPEr returncodeosfsdecoder+ )r( cps r collect_outputr6 , s{ ^$?% rr }r ;ry!!!s 69 AApkgc , ddd| g}t | S )Nrpmz-qz#--queryformat=%{VERSION}-%{RELEASE}r6 r7 r( s r get_rpm_versionr<