From 27de0ed41ffdc345b0f59b09b5f28023a3640fad Mon Sep 17 00:00:00 2001 From: kromskii2 Date: Mon, 13 Jan 2025 16:14:37 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20=D1=88=D0=B8=D1=84=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=84=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2=20=D1=81=20=D0=B8?= =?UTF-8?q?=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=D0=BC=20=D0=BF=D0=B0=D1=80=D0=BE=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=B8=20=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D1=8E?= =?UTF-8?q?=20=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B9=D0=BD=D1=8B=D1=85=20?= =?UTF-8?q?=D0=B8=D0=BC=D0=B5=D0=BD=20=D1=84=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- d3xp4-FXsI.ink | 1 + main.py | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ porno.ink | 1 + porno.txt | 1 + пароль.txt | 1 + 5 files changed, 67 insertions(+) create mode 100644 d3xp4-FXsI.ink create mode 100644 porno.ink create mode 100644 porno.txt create mode 100644 пароль.txt diff --git a/d3xp4-FXsI.ink b/d3xp4-FXsI.ink new file mode 100644 index 0000000..70bab3f --- /dev/null +++ b/d3xp4-FXsI.ink @@ -0,0 +1 @@ +gAAAAABnhNNYfYPaUGa_k4cjNnSRxmvwLETJxjcuwQwzsmGvYRpJq9tdCMFL1yRid-bJCGgTTcZPej6x8zieJrscCAptWqUpI9YJowrO7C57UxC-z_SmXZU= \ No newline at end of file diff --git a/main.py b/main.py index e69de29..1bd67be 100644 --- a/main.py +++ b/main.py @@ -0,0 +1,63 @@ +import os +from cryptography.fernet import Fernet +import base64 +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC +import random +import string + +def get_filename(filepath): + return os.path.basename(filepath) + +def generate_random_letters(length=4): + return ''.join(random.choices(string.ascii_letters, k=length)) + +def generate_filename(): + random_part = generate_random_letters() + return f"d3xp4-{random_part}.ink" + +def encrypt_file(password, filepath): + # Генерация ключа на основе пароля + kdf = PBKDF2HMAC( + algorithm=hashes.SHA256(), + length=32, + salt=b'salt_', + iterations=100000, + ) + key = base64.urlsafe_b64encode(kdf.derive(password.encode())) + f = Fernet(key) + + # Чтение и шифрование файла + with open(filepath, 'rb') as file: + file_data = file.read() + encrypted_data = f.encrypt(file_data) + + # Генерируем новое имя файла + new_filename = generate_filename() + + # Сохраняем в корневой папке проекта + encrypted_filepath = os.path.join(os.path.dirname(__file__), new_filename) + + with open(encrypted_filepath, 'wb') as file: + file.write(encrypted_data) + + return encrypted_filepath + +def main(): + password = "12qwaszx3edc44" + filepath = "/Users/user/Documents/GitHub/safe/porno.txt" + + filename = get_filename(filepath) + print(f"Шифруется файл: {filename}") + + try: + encrypted_file = encrypt_file(password, filepath) + print(f"Файл успешно зашифрован: {encrypted_file}") + except Exception as e: + print(f"Ошибка при шифровании: {str(e)}") + + filename = generate_filename() + print(f"Сгенерированное имя файла: {filename}") + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/porno.ink b/porno.ink new file mode 100644 index 0000000..2951c38 --- /dev/null +++ b/porno.ink @@ -0,0 +1 @@ +gAAAAABnhNJ_s5L5VurUCe-iq7aGVNgxflKw4r52FzC-Pv72Ji7YXfLYY3_uCmHYXcmB1Jmnp7WS2L_SL8MEYhqjFX5c4hU92RU9iCE07z58kTvy-8sHSU4= \ No newline at end of file diff --git a/porno.txt b/porno.txt new file mode 100644 index 0000000..60c4958 --- /dev/null +++ b/porno.txt @@ -0,0 +1 @@ +Русичка <3 !!!!!!!! \ No newline at end of file diff --git a/пароль.txt b/пароль.txt new file mode 100644 index 0000000..3e38e41 --- /dev/null +++ b/пароль.txt @@ -0,0 +1 @@ +12qwaszx3edc44 \ No newline at end of file