Skip to content

Conversation

@avof1ow
Copy link

@avof1ow avof1ow commented Sep 19, 2025

Точка входа:
app.py - точка входа в приложение. Запускает GUI.

Файл с зависимостями:
requirements.txt

Модули интерфейса:
Файл Описание
gui/main_window.py Основное окно приложения (логика интерфейса).
gui/styles.py Файл с настройкой стилей.
gui/widgets.py Файл с настройкой виджетов.
Модули шифрования:
Файл Описание
core/crypto.py Реализация RSA-AES: генерация ключей, шифрование/дешифрование.
core/exceptions.py Исключения для обработки ошибок крипто-операций.
core/init.py Модуль пакета core, создающий единую точку доступа к функциям и классам.
Вспомогательные утилиты:
Файл Описание
utils/file_io.py Безопасное чтение/запись бинарных и текстовых файлов.
utils/config_manager.py Управление настройками приложения (тема, пути к файлам).
utils/init.py Модуль пакета utils, создающий единую точку доступа к функциям и классам.
config/settings.json JSON-file с настройками.
config/init.py Модуль пакета config, cодержит константы путей для удобного импорта в других модулях.
Остальные файлы:
Ключи:

Ключ Описание
keys/private.pem Приватный RSA-ключ, предназначен для дешифровки симметричного AES-ключа, зашифрованного публичным (public.pem) ключом.
keys/public.pem Публичный RSA-ключ.
keys/encrypted_key.bin Зашифрованный AES-ключ.
Текстовые файлы:

Текст Описание
src/plain_text.txt Исходный текст
src/encrypted.bin Зашифрованный, при помощи public ключа, текст
src/decrypted.txt Расшифрованный, при помощи private ключа, текст

@github-actions github-actions bot added In progress Код в процессе проверки Lab 3 Лабораторная 3 "Построение гибридной криптосистемы" labels Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

сделать clean up кода

Comment on lines 63 to 67
if self.filetypes:
if self.is_save:
path = filedialog.asksaveasfilename(
initialdir=initial_dir,
filetypes=self.filetypes,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

для выбора режима использовать match/case

Comment on lines 1 to 6
import tkinter as tk
from tkinter import filedialog
import ttkbootstrap as ttk
from ttkbootstrap.constants import PRIMARY, OUTLINE
from pathlib import Path
from typing import Tuple, Optional

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не соответствует PEP

Comment on lines 67 to 68
except Exception:
return None No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

вы ловите исключения и никак их не обрабатываете

Comment on lines 17 to 24
# Конфигурация цветов
colors = {
"background": "#f0f0f0",
"accent": "#4a6ea9",
"text": "#333333",
"tab_background": "#d9d9d9",
"field_background": "white",
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

вынести в файл с настройками

def _browse(self) -> None:
"""Открывает диалоговое окно для выбора файла."""
initial_dir = Path.home()
if self.path_var.get():

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

у вас для этого целая функция есть

Comment on lines +1 to +4
import json
from pathlib import Path
from typing import Any, Optional

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не соответствует PEP

from .file_io import read_file, write_file
from .config_manager import ConfigManager

__all__ = ['read_file', 'write_file', 'ConfigManager'] No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. зачем вы объявляете глобальную переменную?
  2. почему это исполняемый файл? в нем нет кода, только импорт библиотек
  3. подумайте еще раз

Comment on lines 5 to 18
class KeyGenerationError(CryptoError):
"""Исключение при генерации ключей."""


class EncryptionError(CryptoError):
"""Исключение при шифровании данных."""


class DecryptionError(CryptoError):
"""Исключение при дешифровании данных."""


class FileOperationError(CryptoError):
"""Исключение при операциях с файлами (чтение/запись).""" No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нет ни одного вызова для этих исключений

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

замечания аналогично ISB_LAB_3/utils/init.py

from .config_manager import ConfigManager
from .file_io import read_file, write_file

__all__ = ["ConfigManager", "read_file", "write_file"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не исправлено

  1. зачем вы объявляете глобальную переменную?
  2. почему это исполняемый файл? в нем нет кода, только импорт библиотек
  3. подумайте еще раз

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не исправлено

Comment on lines +6 to +23
class KeyGenerationError(CryptoError):
"""Исключение при генерации ключей."""
pass


class EncryptionError(CryptoError):
"""Исключение при шифровании данных."""
pass


class DecryptionError(CryptoError):
"""Исключение при дешифровании данных."""
pass


class FileOperationError(CryptoError):
"""Исключение при операциях с файлами (чтение/запись)."""
pass

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не исправлено

нет ни одного вызова для этих исключений

Comment on lines 1 to 9
from .hybrid import generate_rsa_keys, hybrid_encrypt, hybrid_decrypt
from .exceptions import CryptoError

__all__ = [
'generate_rsa_keys',
'hybrid_encrypt',
'hybrid_decrypt',
'CryptoError',
] No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а зачем вам этот исполняемый модуль? что вы здесь делаете?
Проимпортировали библиотеки, нигде их не используете.
Создали глобальную переменную, которую тоже нигде не используете. И вообще зачем вам этот список переменных?

Comment on lines 80 to 81
with open(self.config_path, "w", encoding="utf-8") as file:
json.dump(config, file, indent=4, ensure_ascii=False)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

добавьте обработку исключений

from .config_manager import ConfigManager
from .file_io import read_file, write_file

__all__ = ["ConfigManager", "read_file", "write_file"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не исправлено

Copy link

@Daria-creator-lab Daria-creator-lab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

In progress Код в процессе проверки Lab 3 Лабораторная 3 "Построение гибридной криптосистемы"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants