Files
GOD-CWAK/main.py
Dr Jones 05a32015db Add PyInstaller Windows release build system.
Frozen builds resolve paths correctly, stage portable onedir output, and zip releases for distribution.
2026-05-22 19:20:06 -07:00

135 lines
3.4 KiB
Python

#!/usr/bin/env python3
"""
GODCWAK v1.0
GPU-accelerated password recovery tool with proxy rotation.
Usage:
python main.py
GODCWAK.bat
"""
import logging
import sys
import os
# Project root on sys.path when running from source (PyInstaller bundles modules directly)
if not getattr(sys, "frozen", False):
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from config import ensure_dirs, DATA_DIR, APP_NAME, APP_VERSION
ensure_dirs()
_handlers = [logging.StreamHandler()]
if getattr(sys, "frozen", False):
_log_file = DATA_DIR / "godcwak.log"
_handlers.append(logging.FileHandler(_log_file, encoding="utf-8"))
logging.basicConfig(
level=logging.INFO,
format="[%(asctime)s] %(levelname)s: %(message)s",
datefmt="%H:%M:%S",
handlers=_handlers,
)
logger = logging.getLogger(__name__)
def _fatal(message: str, exc: Exception | None = None):
"""Show a visible error in dev (console) and in frozen builds (dialog + log file)."""
if exc is not None:
logger.error(message, exc_info=exc)
else:
logger.error(message)
if getattr(sys, "frozen", False):
try:
import tkinter as tk
from tkinter import messagebox
root = tk.Tk()
root.withdraw()
messagebox.showerror(APP_NAME, message)
root.destroy()
except Exception:
pass
else:
input("\nPress Enter to exit...")
sys.exit(1)
def check_dependencies():
"""Check that critical dependencies are available."""
missing = []
try:
import customtkinter
except ImportError:
missing.append("customtkinter")
try:
import requests
except ImportError:
missing.append("requests")
try:
import numpy
except ImportError:
missing.append("numpy")
# bug #27: add aiohttp and aiohttp_socks to required checks
try:
import aiohttp
except ImportError:
missing.append("aiohttp")
try:
import aiohttp_socks
except ImportError:
missing.append("aiohttp-socks")
# GPU libraries are optional
try:
import cupy
logger.info("✅ CuPy detected — GPU acceleration available")
except ImportError:
logger.warning("⚠️ CuPy not installed — GPU acceleration disabled")
logger.warning(" Install with: pip install cupy-cuda12x")
try:
import numba
logger.info("✅ Numba detected")
except ImportError:
logger.warning("⚠️ Numba not installed — some optimizations disabled")
if missing:
logger.error(f"Missing required dependencies: {', '.join(missing)}")
logger.error("Install with: pip install -r requirements.txt")
return False
return True
def main():
"""Application entry point."""
logger.info("=" * 60)
logger.info(f" {APP_NAME} v{APP_VERSION}")
if getattr(sys, "frozen", False):
logger.info(" (packaged build)")
logger.info("=" * 60)
if not check_dependencies():
_fatal("Missing required dependencies. Reinstall the application or run pip install -r requirements.txt")
try:
from src.gui.app import GODCWAKApp
app = GODCWAKApp()
logger.info("Application started successfully")
app.mainloop()
except Exception as e:
_fatal(f"Fatal error: {e}", exc=e)
if __name__ == "__main__":
main()