One Hat Cyber Team
Your IP :
216.73.216.183
Server IP :
23.137.84.82
Server :
Linux srv25.usacloudserver.us 5.14.0-570.39.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Sep 4 05:08:52 EDT 2025 x86_64
Server Software :
LiteSpeed
PHP Version :
8.1.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
lib64
/
python3.9
/
site-packages
/
borg
/
__pycache__
/
Edit File:
cache.cpython-39.pyc
a HZ�hs� � @ s. d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlmZ d dl m Z ddlmZ e� Zed�Z ddlmZmZ dd lmZmZmZ dd lmZ ddlmZ ddlmZ dd lmZmZ ddlmZmZmZmZ ddlmZ ddlm Z ddlm!Z! ddlm"Z" ddlm#Z#m$Z$ ddlm%Z%m&Z& ddlm'Z' ddlm(Z( ddl)m*Z*m+Z+ ddl,m-Z- ddl.m/Z/m0Z0m1Z1 ddl2m3Z3 ddl4m5Z5 ddl6m7Z7 ddl8m9Z9 edd�Z:G d d!� d!�Z;d"d#� Z<d$d%� Z=d6d&d'�Z>d(d)� Z?d*d+� Z@G d,d-� d-�ZAG d.d/� d/�ZBG d0d1� d1�ZCG d2d3� d3eC�ZDG d4d5� d5eC�ZEdS )7� N)� unhexlify)� namedtuple)�perf_counter� )� create_loggerzborg.debug.files_cache)�CACHE_README�FILES_CACHE_MODE_DISABLED)� ChunkIndex�ChunkIndexEntry�CacheSynchronizer)�Location)�Error)�Manifest)� get_cache_dir�get_security_dir)� int_to_bigint� bigint_to_int� bin_to_hex�parse_stringified_list)�format_file_size)�safe_ns)�yes)�remove_surrogates)�ProgressIndicatorPercent�ProgressIndicatorMessage)�set_ec�EXIT_WARNING)�safe_unlink)�msgpack)�ArchiveItem�ChunkListEntry)�PlaintextKey)�IntegrityCheckedFile�DetachedIntegrityCheckedFile�FileIntegrityError)�Lock)�SaveFile)�cache_if_remote)�LIST_SCAN_LIMIT�FileCacheEntryzage inode size cmtime chunk_idsc @ s� e Zd ZdZdd� Zeddd��Zdd� Zd d � Zdd� Z dd d�Z ddd�Zddd�Zdddd�dd�Z ddd�Zdd� ZdS ) �SecurityManageras Tracks repositories. Ensures that nothing bad happens (repository swaps, replay attacks, unknown repositories etc.). This is complicated by the Cache being initially used for this, while only some commands actually use the Cache, which meant that other commands did not perform these checks. Further complications were created by the Cache being a cache, so it could be legitimately deleted, which is annoying because Borg didn't recognize repositories after that. Therefore a second location, the security database (see get_security_dir), was introduced which stores this information. However, this means that the code has to deal with a cache existing but no security DB entry, or inconsistencies between the security DB and the cache which have to be reconciled, and also with no cache existing but a security DB entry. c C sV || _ t|j�| _t|�| _tj�| jd�| _tj�| jd�| _ tj�| jd�| _ d S )Nzkey-type�locationzmanifest-timestamp)� repositoryr �id_str�dir� cache_dir�os�path�join� key_type_file� location_file�manifest_ts_file)�selfr, � r7 �0/usr/lib64/python3.9/site-packages/borg/cache.py�__init__? s zSecurityManager.__init__Nc C s( |pt | j�}tj�|�r$t�|� dS )z:destroy the security dir for ``repository`` or at ``path``N)r r- r0 r1 �exists�shutil�rmtree�r, r1 r7 r7 r8 �destroyG s zSecurityManager.destroyc C s t dd� | j| j| jfD ��S )Nc s s | ]}t j�|�V qd S �N)r0 r1 r: )�.0�fr7 r7 r8 � <genexpr>O s �z(SecurityManager.known.<locals>.<genexpr>)�allr3 r4 r5 �r6 r7 r7 r8 �knownN s �zSecurityManager.knownc C s� | � � sdS zFt| j��(}|�� }|t|j�kW d � W S 1 sF0 Y W n0 ty� } zt�d|� W Y d }~n d }~0 0 d S )NFz&Could not read/parse key type file: %s) rE �openr3 �read�str�TYPE�OSError�logger�warning)r6 �key�fd�type�excr7 r7 r8 �key_matchesR s 2zSecurityManager.key_matchesc C s� t �d| jj| j� | jj�� }t �d|� t �dt|j�� t �d|j � t | j��}|�|� W d � n1 sv0 Y t | j �� }|�t|j�� W d � n1 s�0 Y t | j��}|�|j � W d � n1 s�0 Y d S )Nz#security: saving state for %s to %szsecurity: current location %szsecurity: key type %szsecurity: manifest timestamp %s)rK �debugr, r- r. � _location�canonical_pathrH rI � timestampr&