#!/usr/bin/env python3 """ UCLV ESET NOD32 Update Feature Mirror server for ESET antivirus updates within university network """ import os import sys import json import shutil import logging import argparse import subprocess from pathlib import Path from datetime import datetime from typing import Dict, List, Optional import http.server import socketserver import threading logging.basicConfig( level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s' ) logger = logging.getLogger( name )
manager = UCLVESETManager()
echo "Creating update configuration..." if [[ "$OSTYPE" == "linux-gnu"* ]]; then sudo mkdir -p /etc/eset/ cat | sudo tee /etc/eset/updater.conf << EOF [updater] server = http://$SERVER_IP:$PORT update_interval = 360 EOF echo "Configuration saved to /etc/eset/updater.conf" fi For Windows (run in PowerShell as Admin) if [[ "$OSTYPE" == "msys"* ]]; then powershell -Command " New-ItemProperty -Path 'HKLM:\SOFTWARE\ESET\ESET Security\CurrentVersion\Info' -Name 'UpdateServer' -Value 'http://$SERVER_IP:$PORT' -PropertyType String -Force " fi
echo "ESET NOD32 configured to use UCLV mirror server" SCRIPT uclv eset nod32 update
chmod +x setup_client.sh
def create_directory_structure(self): """Create necessary directories for update storage""" self.update_dir.mkdir(parents=True, exist_ok=True) # Create product-specific directories for product in self.config["products"]: (self.update_dir / product).mkdir(parents=True, exist_ok=True) # Create log directory (self.update_dir / "logs").mkdir(exist_ok=True) logger.info(f"Directory structure created at self.update_dir")
echo "Configurando ESET NOD32 para usar el mirror de UCLV..." cat > eset_uclv_config.reg << EOF Windows Registry Editor Version 5.00 help="Setup mirror server") parser.add_argument("--start"
with open(package_dir / "README.txt", "w") as f: f.write(readme_content) logger.info(f"Deployment package created in package_dir") return package_dir def main(): parser = argparse.ArgumentParser(description="UCLV ESET NOD32 Update Mirror Server") parser.add_argument("--setup", action="store_true", help="Setup mirror server") parser.add_argument("--start", action="store_true", help="Start update server") parser.add_argument("--verify", action="store_true", help="Verify update files") parser.add_argument("--download", action="store_true", help="Force download updates") parser.add_argument("--generate-package", action="store_true", help="Generate deployment package") parser.add_argument("--config", type=str, default="eset_config.json", help="Configuration file path")
echo "Configuración generada exitosamente" echo "Para Windows: Importe el archivo eset_uclv_config.reg" echo "Para Linux: Copie eset_update_config a /etc/eset/" cat > setup_client.sh << 'SCRIPT' #!/bin/bash Client setup script for UCLV ESET NOD32 read -p "Enter update server IP or hostname: " SERVER_IP read -p "Enter update port [8080]: " PORT PORT=$PORT:-8080
def cleanup_old_files(self): """Remove old update files to save space""" max_files = self.config.get("max_log_files", 10) log_dir = self.update_dir / "logs" if log_dir.exists(): log_files = sorted(log_dir.glob("*.json")) for old_file in log_files[:-max_files]: old_file.unlink() logger.info(f"Removed old log file: old_file") help="Start update server") parser.add_argument("--verify"
The system is designed specifically for UCLV's network infrastructure and includes proper error handling, logging, and easy deployment options for the university environment.
class ESETUpdateServer: """ESET NOD32 update mirror server for UCLV"""
For support: IT Department - UCLV Generated: datetime.now() """
if args.setup: manager.setup_mirror_server() elif args.start: manager.start_server() elif args.verify: verification = manager.server.verify_updates() print(json.dumps(verification, indent=4)) elif args.download: manager.server.download_updates() elif args.generate_package: manager.generate_deployment_package() else: parser.print_help() if == " main ": main()
def start_server(self): """Start the update server""" logger.info("Starting UCLV ESET NOD32 update server") # Start HTTP server in a separate thread http_thread = threading.Thread(target=self.server.start_http_server, daemon=True) http_thread.start() # Start sync loop in main thread self.server.run_sync_loop()