hTdZddlZddlZddlmZddlmZddlmZGddeZ Gdd eZ Gd d eZ Gd d eZ Gdde Z GddeZGdde ZGddeZGdde ZGddZdS)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)ABC) NamedTuple)EnumceZdZdZdZdZdS) HashStaterN)__name__ __module__ __qualname__ACTIVE BLACKLISTED SUPERSEDEDP/opt/imunify360/venv/lib/python3.11/site-packages/imav/patchman/fs_scanner/db.pyrrs FKJJJrrc.eZdZdZdZdZdZdZdZdZ dZ d S) DefinitionTyperr  N) r r r MALWARE VULNERABILITY APPLICATIONDRYRUN MALWARE_RULEMALWARE_RULE_DRYRUNVULNERABILITY_ECOMMERCEVULNERABILITY_PLUGINrrrrr#s;GMK FLrrcbeZdZUeed<eed<eed<d dejdefdZ defd Z d Z d Z d S)Table table_namefieldscreate_table_queryconn buffer_sizecX||_||_g|_|dSN)r)r*buffer create_table)selfr)r*s r__init__zTable.__init__3s0 &#%  rrowct|t|jksJ|j|t|j|jkr|dSdS)z$ Insert with buffer N)lenr&r-appendr*flush)r/r1s rbuffered_insertzTable.buffered_insert9sl3xx3t{++++++ 3 t{  t/ / / JJLLLLL 0 /rc6d|j}|j5|jd|jd|dddgt |jzd|jdddn #1swxYwYg|_dS)z Flush buffer z, z INSERT INTO z (z ) VALUES (?)N)joinr&r) executemanyr%r3r-)r/r&s rr5z Table.flushBs4;'' Y   I ! !s r __enter__z DB.__enter__s rcV||dSr,)r5close)r/exc_typeexc_valexc_tbs r__exit__z DB.__exit__s   rr(db_namer*crtj|rtj|t j||_t|j||_t|j||_ t|j||_ |j|j |j f|_ dS)N)r*)osrIexistsremoverCconnectr)rLrMrWrXr]r^_tables)r/rir*s rr0z DB.__init__s 7>>' " "  Ig   OG,, 1 I;! ! ! #7 I;# # # - I;     !  #    rc(d|jDdS)z& Flush tables buffers c6g|]}|Sr)r5).0_s r zDB.flush..s )))q)))rN)ror>s rr5zDB.flushs  *)DL))))))rc8|jdSr,)r)rdr>s rrdzDB.closes rNr?) r r r rbrhr@rEr0r5rdrrrr`r`sw   #    **** rr`)__doc__rkrCabcrtypingrenumrrrr$rGrLrQrWrZr]r`rrrrzs*  T#7#7#7#7#7C#7#7#7L:        #####:###     5         U   $$$$$$$$$$r