)w'e d Z ddlZddlZddlmZ ddlmZ ddlmZm Z m
Z
ddlmZmZ G d dej
Z G d d
ej
Z G d dej
Zd
Zedk r e dS dS )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)HashCalculator)DB)PatchDependenciesMatcherVersionsMatcher
HashesMatcher)all_possible_relative_pathsdir_traverse_generatorc e Zd ZdZddZdS )ExistingDirActionzJ
Check that directory exists and turn its path into absolute path
Nc t j | st | d t || j t j | d S )Nz dir does not exist)ospathisdir
ValueErrorsetattrdestabspathselfparser namespacevalues
option_strings R/opt/imunify360/venv/lib/python3.11/site-packages/imav/patchman/fs_scanner/main.py__call__zExistingDirAction.__call__- sW w}}V$$ =;;;<<< 49bgoof&=&=>>>>> N__name__
__module____qualname____doc__r r r r r ( s2 ? ? ? ? ? ?r r c e Zd ZdZddZdS )ReadableFileActionz0
Check that file exists and is readable
Nc t j | st | d t j |t j st | d t
|| j | d S )Nz does not existz is not readable)r
r isfiler accessR_OKr r r s r r zReadableFileAction.__call__8 sv w~~f%% 9777888y)) :888999 49f-----r r r r# r r r% r% 3 s2 . . . . . .r r% c e Zd ZdZddZdS )WritableFilePathActionz*
Check that file path is writable
Nc t j | pd}t j |t j st d| d t
|| j | d S )N.z
Directory z is not writable)r
r dirnamer( W_OKr r r )r r r r r dir_names r r zWritableFilePathAction.__call__E se 7??6**1cy27++ FD(DDDEEE 49f-----r r r r# r r r+ r+ @ s2 . . . . . .r r+ c & t j } | dt t d | dt t d | dt t d | dt t
d | d
dt t dd
| dt t j dd |
}t |j }t |j }t |j }t! |j }t% |j 5 }t) |j D ]j}t- ||j D ]R}| |||| } | |||| }
| |||| }| r|
r|r nSk d d d d S # 1 swxY w Y d S )Nversion_identifiersz%Path to file with version_identifiers)typeactionhelp
patch_depsz$Path to file with patch_dependencieshasheszPath to file with hashes
target_dirzPath to target dirz--outputz-ozPath to output sqlite db fileT)r3 r4 r5 requiredz--algorithmmd5zHashing algorithm)r3 choicesdefaultr5 )argparseArgumentParseradd_argumentstrr% r r+ r HASHING_ALGORITHMSkeys
parse_argsr r2 r r6 algorithmr r7 r outputr r8 r match_and_save) argparserargsversions_matcherdeps_matcherhash_calculatorhashes_matcherdb file_path
relative_pathversion_matcheddeps_matchedhashes_matcheds r mainrS L s '))I
!
4
!
3
!
'
!
%
,
16688
!!D&t'?@@+DO<