Ajout protection mot de passe et installeur Windows complet

- Mot de passe SHA-256 au lancement (3 tentatives, saisie masquee)
- install.bat : installeur/desinstalleur/mise a jour tout-en-un
  - Telecharge et installe Git portable si absent
  - Telecharge et installe Python 3.12 embarque si absent
  - Installe pip et les dependances automatiquement
  - Clone le depot Gitea
  - Cree raccourcis Bureau et Menu Demarrer
  - Mise a jour en 1 clic (git pull + pip upgrade)
  - Desinstallation complete avec confirmation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jules
2026-03-20 11:01:39 +01:00
parent e3dfd90933
commit b9f7b38f43
2 changed files with 393 additions and 2 deletions

34
main.py
View File

@@ -3,12 +3,38 @@
import sys
import os
import hashlib
# Ajouter le repertoire racine au path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from PyQt6.QtWidgets import QApplication
from app.main_window import MainWindow
from PyQt6.QtWidgets import QApplication, QInputDialog, QMessageBox, QLineEdit
# Hash SHA-256 du mot de passe — jamais en clair dans le code
_PASSWORD_HASH = "f3dd6962a99a2fe2e03cd8e5cfa7dafb12570bdcca1b6590e27d95dcccdf1f58"
def _hash_password(pwd):
return hashlib.sha256(pwd.encode("utf-8")).hexdigest()
def _check_auth():
"""Demander le mot de passe au lancement."""
max_attempts = 3
for attempt in range(max_attempts):
pwd, ok = QInputDialog.getText(
None,
"Copydev Imposing Tool",
f"Mot de passe requis ({max_attempts - attempt} essai(s) restant(s)) :",
QLineEdit.EchoMode.Password,
)
if not ok:
return False
if _hash_password(pwd) == _PASSWORD_HASH:
return True
if attempt < max_attempts - 1:
QMessageBox.warning(None, "Erreur", "Mot de passe incorrect.")
QMessageBox.critical(None, "Acces refuse", "Trop de tentatives. L'application va se fermer.")
return False
def main():
@@ -16,6 +42,10 @@ def main():
app.setApplicationName("Copydev Imposing Tool")
app.setOrganizationName("Copydev")
if not _check_auth():
sys.exit(1)
from app.main_window import MainWindow
window = MainWindow()
window.show()
sys.exit(app.exec())