l#g}ddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ddl mZddlmZmZe ZdZd d Zejfd ZdS) N)Corenative)EventHookLogger) EventHook)db)run snake_casectjrgStjtj|k}t |S)N)rdeferredrselectwhereeventlist)rhookss R/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/hooks/execute.py get_hooksrsB {     $ $Y_%= > >E ;;Fc`K |rtj||d\}}nbtj|}t j|}t|d||d{V\}}}n(#t$r}dt|}}Yd}~nd}~wwxYw||fS)N)rNT)shellinputcwd) native_hooks execute_hookjsondumpsencodeospathdirnamer Exceptionrepr)rdatar exit_codeerrr_es rrrs '    %dD 1 1 1$NIss:d##**,,D'//$''C&)D#'''!!!!!! Iq# '''tAww3 ' c>sA?B B)B$$B)c.K|d}t|}t|j}|sdSt |j|j5}|rt |jjdz}tj d|d|}tj ||| tj||j|d<|j|j|d}|D]} || j| j5} | t+| j|| jd{V\} } | | | dddn #1swxYwY ddddS#1swxYwYdS) NDUMPr&zw+z.json)modeprefixsuffixdir tmp_filename)rsubtypeparamsr)getdictrrevent_hook_loggerr/r __class____name__tempfileNamedTemporaryFilerdumpflushrfsyncfilenonamerrbeginrfinish) rtempdirr8r0r event_loggerr+tmpr#hook hook_loggerr$r%s r execute_hooksrD*s? 99V  D %[[F ek " "E  5; 6 63,  . 899C?F-&gC IdC IIKKK HSZZ\\ " " "%(XF> "[}    3 3Ddi <<< 3 !!###'3ItDK((("""""" 3""9c222  3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3#333333333333333333s8B;F AE0$ F 0E4 4F 7E4 8F  FF)F)rr subprocessr6 defence360agent.contracts.configrdefence360agent.hooksrr defence360agent.internals.loggerr defence360agent.model.event_hookrdefence360agent.model.instancerdefence360agent.utilsr r r3rrTMPDIRrDrrrNs 111111888888<<<<<<666666------11111111#O%%"(,{333333r