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
LiteSpeed
Server IP : 23.137.84.82 & Your IP : 216.73.216.127
Domains :
Cant Read [ /etc/named.conf ]
User : epicgamerzoneco
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
lib64 /
python3.9 /
site-packages /
borg /
testsuite /
Delete
Unzip
Name
Size
Permission
Date
Action
__pycache__
[ DIR ]
drwxr-xr-x
2025-10-23 11:01
__init__.py
14.17
KB
-rw-r--r--
2025-10-13 20:00
archive.py
11.77
KB
-rw-r--r--
2025-10-13 20:00
archiver.py
247.53
KB
-rw-r--r--
2025-10-13 20:00
attic.tar.gz
2.76
KB
-rw-r--r--
2025-10-13 20:00
benchmark.py
2.87
KB
-rw-r--r--
2025-10-13 20:00
cache.py
9.04
KB
-rw-r--r--
2025-10-13 20:00
checksums.py
1.68
KB
-rw-r--r--
2025-10-13 20:00
chunker.py
6.08
KB
-rw-r--r--
2025-10-13 20:00
chunker_pytest.py
5.29
KB
-rw-r--r--
2025-10-13 20:00
chunker_slow.py
1.5
KB
-rw-r--r--
2025-10-13 20:00
compress.py
8.72
KB
-rw-r--r--
2025-10-13 20:00
crypto.py
6.65
KB
-rw-r--r--
2025-10-13 20:00
efficient_collection_queue.py
1.57
KB
-rw-r--r--
2025-10-13 20:00
file_integrity.py
6.15
KB
-rw-r--r--
2025-10-13 20:00
hashindex.py
20.17
KB
-rw-r--r--
2025-10-13 20:00
hashindex_stress.py
1.14
KB
-rw-r--r--
2025-10-13 20:00
helpers.py
49.67
KB
-rw-r--r--
2025-10-13 20:00
item.py
4.48
KB
-rw-r--r--
2025-10-13 20:00
key.py
19.72
KB
-rw-r--r--
2025-10-13 20:00
locking.py
13.4
KB
-rw-r--r--
2025-10-13 20:00
logger.py
1.54
KB
-rw-r--r--
2025-10-13 20:00
lrucache.py
1.4
KB
-rw-r--r--
2025-10-13 20:00
nanorst.py
1008
B
-rw-r--r--
2025-10-13 20:00
nonces.py
7.02
KB
-rw-r--r--
2025-10-13 20:00
patterns.py
16.96
KB
-rw-r--r--
2025-10-13 20:00
platform.py
8.52
KB
-rw-r--r--
2025-10-13 20:00
remote.py
6.28
KB
-rw-r--r--
2025-10-13 20:00
repository.py
47.31
KB
-rw-r--r--
2025-10-13 20:00
shellpattern.py
3.09
KB
-rw-r--r--
2025-10-13 20:00
upgrader.py
6.74
KB
-rw-r--r--
2025-10-13 20:00
version.py
1.76
KB
-rw-r--r--
2025-10-13 20:00
xattr.py
3.28
KB
-rw-r--r--
2025-10-13 20:00
Save
Rename
import errno import os import io import time from unittest.mock import patch import pytest from ..remote import SleepingBandwidthLimiter, RepositoryCache, cache_if_remote from ..repository import Repository from ..crypto.key import PlaintextKey from ..compress import CompressionSpec from ..helpers import IntegrityError from .hashindex import H from .key import TestKey class TestSleepingBandwidthLimiter: def expect_write(self, fd, data): self.expected_fd = fd self.expected_data = data def check_write(self, fd, data): assert fd == self.expected_fd assert data == self.expected_data return len(data) def test_write_unlimited(self, monkeypatch): monkeypatch.setattr(os, "write", self.check_write) it = SleepingBandwidthLimiter(0) self.expect_write(5, b"test") it.write(5, b"test") def test_write(self, monkeypatch): monkeypatch.setattr(os, "write", self.check_write) monkeypatch.setattr(time, "monotonic", lambda: now) monkeypatch.setattr(time, "sleep", lambda x: None) now = 100 it = SleepingBandwidthLimiter(100) # all fits self.expect_write(5, b"test") it.write(5, b"test") # only partial write self.expect_write(5, b"123456") it.write(5, b"1234567890") # sleeps self.expect_write(5, b"123456") it.write(5, b"123456") # long time interval between writes now += 10 self.expect_write(5, b"1") it.write(5, b"1") # long time interval between writes, filling up quota now += 10 self.expect_write(5, b"1") it.write(5, b"1") # long time interval between writes, filling up quota to clip to maximum now += 10 self.expect_write(5, b"1") it.write(5, b"1") class TestRepositoryCache: @pytest.fixture def repository(self, tmpdir): self.repository_location = os.path.join(str(tmpdir), 'repository') with Repository(self.repository_location, exclusive=True, create=True) as repository: repository.put(H(1), b'1234') repository.put(H(2), b'5678') repository.put(H(3), bytes(100)) yield repository @pytest.fixture def cache(self, repository): return RepositoryCache(repository) def test_simple(self, cache: RepositoryCache): # Single get()s are not cached, since they are used for unique objects like archives. assert cache.get(H(1)) == b'1234' assert cache.misses == 1 assert cache.hits == 0 assert list(cache.get_many([H(1)])) == [b'1234'] assert cache.misses == 2 assert cache.hits == 0 assert list(cache.get_many([H(1)])) == [b'1234'] assert cache.misses == 2 assert cache.hits == 1 assert cache.get(H(1)) == b'1234' assert cache.misses == 2 assert cache.hits == 2 def test_backoff(self, cache: RepositoryCache): def query_size_limit(): cache.size_limit = 0 assert list(cache.get_many([H(1), H(2)])) == [b'1234', b'5678'] assert cache.misses == 2 assert cache.evictions == 0 iterator = cache.get_many([H(1), H(3), H(2)]) assert next(iterator) == b'1234' # Force cache to back off qsl = cache.query_size_limit cache.query_size_limit = query_size_limit cache.backoff() cache.query_size_limit = qsl # Evicted H(1) and H(2) assert cache.evictions == 2 assert H(1) not in cache.cache assert H(2) not in cache.cache assert next(iterator) == bytes(100) assert cache.slow_misses == 0 # Since H(2) was in the cache when we called get_many(), but has # been evicted during iterating the generator, it will be a slow miss. assert next(iterator) == b'5678' assert cache.slow_misses == 1 def test_enospc(self, cache: RepositoryCache): class enospc_open: def __init__(self, *args): pass def __enter__(self): return self def __exit__(self, exc_type, exc_val, exc_tb): pass def write(self, data): raise OSError(errno.ENOSPC, 'foo') def truncate(self, n=None): pass iterator = cache.get_many([H(1), H(2), H(3)]) assert next(iterator) == b'1234' with patch('builtins.open', enospc_open): assert next(iterator) == b'5678' assert cache.enospc == 1 # We didn't patch query_size_limit which would set size_limit to some low # value, so nothing was actually evicted. assert cache.evictions == 0 assert next(iterator) == bytes(100) @pytest.fixture def key(self, repository, monkeypatch): monkeypatch.setenv('BORG_PASSPHRASE', 'test') key = PlaintextKey.create(repository, TestKey.MockArgs()) key.compressor = CompressionSpec('none').compressor return key def _put_encrypted_object(self, key, repository, data): id_ = key.id_hash(data) repository.put(id_, key.encrypt(data)) return id_ @pytest.fixture def H1(self, key, repository): return self._put_encrypted_object(key, repository, b'1234') @pytest.fixture def H2(self, key, repository): return self._put_encrypted_object(key, repository, b'5678') @pytest.fixture def H3(self, key, repository): return self._put_encrypted_object(key, repository, bytes(100)) @pytest.fixture def decrypted_cache(self, key, repository): return cache_if_remote(repository, decrypted_cache=key, force_cache=True) def test_cache_corruption(self, decrypted_cache: RepositoryCache, H1, H2, H3): list(decrypted_cache.get_many([H1, H2, H3])) iterator = decrypted_cache.get_many([H1, H2, H3]) assert next(iterator) == (7, b'1234') with open(decrypted_cache.key_filename(H2), 'a+b') as fd: fd.seek(-1, io.SEEK_END) corrupted = (int.from_bytes(fd.read(), 'little') ^ 2).to_bytes(1, 'little') fd.seek(-1, io.SEEK_END) fd.write(corrupted) fd.truncate() with pytest.raises(IntegrityError): assert next(iterator) == (7, b'5678')