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