wo4hD(ddlmZdZddZddZdS)) TemporaryFilec<|dddS)N||maxsplitr)split) descriptions i/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/migrations/070_modsec_incident_names.py extract_namer s   TA  . .q 11Fc  |jd fd}td5}|D];\}}|d|t |<|d|5|D]}|dd \}} |  j t|k  d d d n #1swxYwYd d d d S#1swxYwYd S) z This migration extracts incident name from whole mod_security message Centos6 version of sqlite does not have instr(), using slow python-based way incidentc3RK jjjdkjdEd{VdS#t$rYdSwxYw)Nmodsecr) selectidr whereplugincontainstuplesiterator RuntimeError)rsr select_incidentsz!migrate..select_incidentss  X-ABBx(233x+44T::;;              FF sBB B&%B&zw+)modez{},{} r,rr)nameN)ormrwriteformatr seekatomicr updatestriprrintexecute) migratordatabasefakekwargsrfid_desclinerrs @r migrater/s |J'H      D ! ! ! Q))++ ? ?IC GGI$$S,t*<*<== > > > > q __       JJsQJ77 TTZZ\\2288K3s88+'))))                                   s7A0D<BD$ D<$D( (D<+D( ,D<<EEc dS)z$Write your rollback migrations here.N)r'r(r)r*s r rollbackr2)sDr N)F)tempfilerr r/r2r1r r r4sY""""""222B      r