add comments

This commit is contained in:
pvlnes 2026-05-02 18:36:53 +03:00
parent 1a27b1a074
commit bf59eb51a4

View File

@ -1,13 +1,10 @@
#!/usr/bin/env python3
"""
Generates data.enc from data.json using AES-256-GCM + PBKDF2.
Re-run whenever you change data.json or rotate the password.
Usage on the server:
nix-shell -p python3Packages.cryptography --run "python3 encrypt.py"
"""
import json, os, base64, getpass
from pathlib import Path
# Скрипт который мы шифруем наш файл с proxy (data.json)
# Зачем? Да все просто. Оч впадлу писать какой-то бэк, да я и не программист и не ебу за бэстпрактики
# Отдаем пользователю на фронте шифрованный файл с прокси, пользак вводит пароль и JS его расшифровывает
# Добавился новый прокси? Пересоздаем файл - готово. Также можно легко менять пароль
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers.aead import AESGCM