Pastebin
Retrouvez, créez et partagez vos snippets en temps réel.
Rechercher un Pastebin
Aucun paste trouvé.
Créer un paste
Pastebin
Blog
gufhg
import sys import random import traceback try: from PyQt5.QtWidgets import (QApplication, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton, QFrame, QMessageBox) from PyQt5.QtCore import Qt, QTimer from PyQt5.QtGui import QFont, QColor, QLinearGradient, QPainter, QBrush except ImportError as e: print("Erreur d'importation PyQt5:", e) print("Installez PyQt5 avec: pip install PyQt5") input("Appuyez sur Entrée pour quitter...") sys.exit(1) class CircularProgress(QWidget): def __init__(self, parent=None): super().__init__(parent) self.progress = 0 self.setMinimumSize(150, 150) def setProgress(self, value): self.progress = value self.update() def paintEvent(self, event): painter = QPainter(self) painter.setRenderHint(QPainter.Antialiasing) painter.setPen(Qt.NoPen) painter.setBrush(QColor(51, 65, 85)) painter.drawEllipse(10, 10, 130, 130) gradient = QLinearGradient(0, 0, 150, 150) gradient.setColorAt(0, QColor(59, 130, 246)) gradient.setColorAt(1, QColor(37, 99, 235)) painter.setBrush(QBrush(gradient)) rect = self.rect().adjusted(10, 10, -10, -10) span_angle = int(self.progress * 3.6 * 16) painter.drawPie(rect, 90 * 16, -span_angle) painter.setBrush(QColor(30, 41, 59)) painter.drawEllipse(30, 30, 90, 90) painter.setPen(Qt.white) painter.setFont(QFont('Arial', 24, QFont.Bold)) painter.drawText(rect, Qt.AlignCenter, f"{int(self.progress)}%") class CheckMyComputer(QMainWindow): def __init__(self): super().__init__() self.scanning = False self.progress = 0 self.virus_found = False self.files_scanned = 0 self.phase = "idle" self.files = [ 'C:\\Windows\\System32\\kernel.dll', 'C:\\Program Files\\Chrome\\chrome.exe', 'C:\\Windows\\explorer.exe', 'C:\\Users\\Documents\\report.pdf', 'C:\\AppData\\Local\\cache.dat', 'C:\\Windows\\System32\\drivers\\tcpip.sys', 'C:\\Program Files\\Office\\winword.exe', 'C:\\Windows\\System32\\ntoskrnl.exe', ] self.timer = QTimer() self.timer.timeout.connect(self.update_scan) self.initUI() def initUI(self): self.setWindowTitle('CheckMyComputer Pro') self.setFixedSize(700, 800) self.setStyleSheet(""" QMainWindow { background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #0f172a, stop:0.5 #1e3a8a, stop:1 #0f172a); } """) central_widget = QWidget() self.setCentralWidget(central_widget) layout = QVBoxLayout(central_widget) layout.setSpacing(20) layout.setContentsMargins(30, 30, 30, 30) header = self.create_header() layout.addWidget(header) self.content_area = QWidget() self.content_layout = QVBoxLayout(self.content_area) layout.addWidget(self.content_area) footer = self.create_footer() layout.addWidget(footer) self.show_idle_screen() def create_header(self): header = QFrame() header.setStyleSheet(""" QFrame { background: rgba(30, 41, 59, 180); border-radius: 15px; border: 1px solid rgba(71, 85, 105, 100); } """) layout = QHBoxLayout(header) layout.setContentsMargins(20, 15, 20, 15) icon_label = QLabel('🛡️') icon_label.setFont(QFont('Arial', 32)) layout.addWidget(icon_label) title_widget = QWidget() title_layout = QVBoxLayout(title_widget) title_layout.setSpacing(2) title_layout.setContentsMargins(0, 0, 0, 0) title = QLabel('CheckMyComputer') title.setFont(QFont('Arial', 24, QFont.Bold)) title.setStyleSheet('color: white;') subtitle = QLabel('Advanced Security Suite') subtitle.setFont(QFont('Arial', 10)) subtitle.setStyleSheet('color: #60a5fa;') title_layout.addWidget(title) title_layout.addWidget(subtitle) layout.addWidget(title_widget) layout.addStretch() status = QLabel('● Active') status.setFont(QFont('Arial', 10, QFont.Bold)) status.setStyleSheet(""" color: #4ade80; background: rgba(34, 197, 94, 30); padding: 8px 15px; border-radius: 8px; border: 1px solid rgba(34, 197, 94, 50); """) layout.addWidget(status) return header def create_footer(self): footer = QFrame() footer.setStyleSheet(""" QFrame { background: rgba(30, 41, 59, 120); border-radius: 10px; } """) layout = QHBoxLayout(footer) layout.setContentsMargins(15, 10, 15, 10) left_label = QLabel('● CheckMyComputer Pro v2.5.1') left_label.setFont(QFont('Arial', 9)) left_label.setStyleSheet('color: #94a3b8;') right_label = QLabel('© 2025 Security Suite') right_label.setFont(QFont('Arial', 9)) right_label.setStyleSheet('color: #64748b;') layout.addWidget(left_label) layout.addStretch() layout.addWidget(right_label) return footer def clear_content(self): while self.content_layout.count(): child = self.content_layout.takeAt(0) if child.widget(): child.widget().deleteLater() def show_idle_screen(self): self.clear_content() self.phase = "idle" icon = QLabel('🛡️') icon.setFont(QFont('Arial', 80)) icon.setAlignment(Qt.AlignCenter) self.content_layout.addWidget(icon) title = QLabel('Système de protection avancé') title.setFont(QFont('Arial', 20, QFont.Bold)) title.setStyleSheet('color: white;') title.setAlignment(Qt.AlignCenter) self.content_layout.addWidget(title) subtitle = QLabel('Analyse approfondie en temps réel • Détection intelligente des menaces') subtitle.setFont(QFont('Arial', 11)) subtitle.setStyleSheet('color: #94a3b8;') subtitle.setAlignment(Qt.AlignCenter) subtitle.setWordWrap(True) self.content_layout.addWidget(subtitle) stats_widget = QWidget() stats_layout = QHBoxLayout(stats_widget) stats_layout.setSpacing(10) for stat_text, stat_value in [('Détection', '99.9%'), ('Protection', '24/7'), ('Latence', '0ms')]: stat = self.create_stat_box(stat_text, stat_value) stats_layout.addWidget(stat) self.content_layout.addWidget(stats_widget) scan_btn = QPushButton('Démarrer l\'analyse complète') scan_btn.setFont(QFont('Arial', 12, QFont.Bold)) scan_btn.setCursor(Qt.PointingHandCursor) scan_btn.setStyleSheet(""" QPushButton { background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #2563eb, stop:1 #1d4ed8); color: white; padding: 15px 40px; border-radius: 12px; border: none; } QPushButton:hover { background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #3b82f6, stop:1 #2563eb); } """) scan_btn.clicked.connect(self.start_scan) self.content_layout.addWidget(scan_btn, alignment=Qt.AlignCenter) self.content_layout.addStretch() def create_stat_box(self, label_text, value_text): box = QFrame() box.setStyleSheet(""" QFrame { background: rgba(51, 65, 85, 80); border-radius: 10px; border: 1px solid rgba(71, 85, 105, 80); padding: 15px; } """) layout = QVBoxLayout(box) value = QLabel(value_text) value.setFont(QFont('Arial', 18, QFont.Bold)) value.setStyleSheet('color: white;') value.setAlignment(Qt.AlignCenter) label = QLabel(label_text) label.setFont(QFont('Arial', 9)) label.setStyleSheet('color: #94a3b8;') label.setAlignment(Qt.AlignCenter) layout.addWidget(value) layout.addWidget(label) return box def show_scanning_screen(self): self.clear_content() self.phase = "scanning" self.circular_progress = CircularProgress() self.content_layout.addWidget(self.circular_progress, alignment=Qt.AlignCenter) title = QLabel('Analyse en cours...') title.setFont(QFont('Arial', 18, QFont.Bold)) title.setStyleSheet('color: white;') title.setAlignment(Qt.AlignCenter) self.content_layout.addWidget(title) self.file_label = QLabel('') self.file_label.setFont(QFont('Courier', 9)) self.file_label.setStyleSheet('color: #94a3b8;') self.file_label.setAlignment(Qt.AlignCenter) self.content_layout.addWidget(self.file_label) stats_box = QFrame() stats_box.setStyleSheet(""" QFrame { background: rgba(51, 65, 85, 80); border-radius: 10px; border: 1px solid rgba(71, 85, 105, 80); padding: 20px; } """) stats_layout = QHBoxLayout(stats_box) left_widget = QWidget() left_layout = QVBoxLayout(left_widget) left_layout.setSpacing(5) files_label = QLabel('Fichiers analysés') files_label.setFont(QFont('Arial', 9)) files_label.setStyleSheet('color: #94a3b8;') self.files_count_label = QLabel('0') self.files_count_label.setFont(QFont('Arial', 20, QFont.Bold)) self.files_count_label.setStyleSheet('color: white;') left_layout.addWidget(files_label) left_layout.addWidget(self.files_count_label) right_widget = QWidget() right_layout = QVBoxLayout(right_widget) right_layout.setSpacing(5) threats_label = QLabel('Menaces détectées') threats_label.setFont(QFont('Arial', 9)) threats_label.setStyleSheet('color: #94a3b8;') self.threats_count_label = QLabel('0') self.threats_count_label.setFont(QFont('Arial', 20, QFont.Bold)) self.threats_count_label.setStyleSheet('color: #4ade80;') right_layout.addWidget(threats_label) right_layout.addWidget(self.threats_count_label) stats_layout.addWidget(left_widget) stats_layout.addWidget(right_widget) self.content_layout.addWidget(stats_box) self.virus_alert = QFrame() self.virus_alert.setStyleSheet(""" QFrame { background: rgba(239, 68, 68, 20); border-radius: 10px; border: 1px solid rgba(239, 68, 68, 50); padding: 15px; } """) virus_layout = QHBoxLayout(self.virus_alert) warning_icon = QLabel('⚠️') warning_icon.setFont(QFont('Arial', 20)) virus_layout.addWidget(warning_icon) virus_text_widget = QWidget() virus_text_layout = QVBoxLayout(virus_text_widget) virus_text_layout.setSpacing(3) virus_text_layout.setContentsMargins(0, 0, 0, 0) virus_title = QLabel('Menace détectée !') virus_title.setFont(QFont('Arial', 11, QFont.Bold)) virus_title.setStyleSheet('color: #f87171;') virus_name = QLabel('Trojan.Win32.Malware') virus_name.setFont(QFont('Courier', 9)) virus_name.setStyleSheet('color: #cbd5e1;') virus_level = QLabel('Niveau de danger : Élevé') virus_level.setFont(QFont('Arial', 8)) virus_level.setStyleSheet('color: #94a3b8;') virus_text_layout.addWidget(virus_title) virus_text_layout.addWidget(virus_name) virus_text_layout.addWidget(virus_level) virus_layout.addWidget(virus_text_widget) virus_layout.addStretch() self.virus_alert.hide() self.content_layout.addWidget(self.virus_alert) self.content_layout.addStretch() def show_quarantine_screen(self): self.clear_content() self.phase = "quarantine" icon = QLabel('🔒') icon.setFont(QFont('Arial', 64)) icon.setAlignment(Qt.AlignCenter) self.content_layout.addWidget(icon) title = QLabel('Mise en quarantaine') title.setFont(QFont('Arial', 18, QFont.Bold)) title.setStyleSheet('color: white;') title.setAlignment(Qt.AlignCenter) self.content_layout.addWidget(title) info_box = QFrame() info_box.setStyleSheet(""" QFrame { background: rgba(249, 115, 22, 20); border-radius: 10px; border: 1px solid rgba(249, 115, 22, 50); padding: 20px; } """) info_layout = QVBoxLayout(info_box) info_title = QLabel('🔒 Isolation du fichier infecté') info_title.setFont(QFont('Arial', 11, QFont.Bold)) info_title.setStyleSheet('color: #fb923c;') info_title.setAlignment(Qt.AlignCenter) file_box = QLabel('C:\\AppData\\Temp\\svchost32.exe') file_box.setFont(QFont('Courier', 9)) file_box.setStyleSheet(""" color: #cbd5e1; background: rgba(51, 65, 85, 100); padding: 10px; border-radius: 5px; """) file_box.setAlignment(Qt.AlignCenter) file_box.setWordWrap(True) dots = QLabel('• • •') dots.setFont(QFont('Arial', 16, QFont.Bold)) dots.setStyleSheet('color: #fb923c;') dots.setAlignment(Qt.AlignCenter) info_layout.addWidget(info_title) info_layout.addWidget(file_box) info_layout.addWidget(dots) self.content_layout.addWidget(info_box) self.content_layout.addStretch() def show_destroy_screen(self): self.clear_content() self.phase = "destroy" icon = QLabel('🗑️') icon.setFont(QFont('Arial', 64)) icon.setAlignment(Qt.AlignCenter) self.content_layout.addWidget(icon) title = QLabel('Élimination de la menace') title.setFont(QFont('Arial', 18, QFont.Bold)) title.setStyleSheet('color: white;') title.setAlignment(Qt.AlignCenter) self.content_layout.addWidget(title) info_box = QFrame() info_box.setStyleSheet(""" QFrame { background: rgba(239, 68, 68, 20); border-radius: 10px; border: 1px solid rgba(239, 68, 68, 50); padding: 20px; } """) info_layout = QVBoxLayout(info_box) info_title = QLabel('💥 Suppression définitive en cours') info_title.setFont(QFont('Arial', 11, QFont.Bold)) info_title.setStyleSheet('color: #f87171;') info_title.setAlignment(Qt.AlignCenter) steps = QLabel('✓ Analyse des signatures\n✓ Nettoyage de la mémoire\n✓ Suppression des traces\n⟳ Sécurisation du système...') steps.setFont(QFont('Arial', 10)) steps.setStyleSheet('color: #cbd5e1;') info_layout.addWidget(info_title) info_layout.addWidget(steps) self.content_layout.addWidget(info_box) self.content_layout.addStretch() def show_complete_screen(self): self.clear_content() self.phase = "complete" icon = QLabel('✅') icon.setFont(QFont('Arial', 64)) icon.setAlignment(Qt.AlignCenter) self.content_layout.addWidget(icon) title = QLabel('Menace neutralisée') title.setFont(QFont('Arial', 20, QFont.Bold)) title.setStyleSheet('color: white;') title.setAlignment(Qt.AlignCenter) self.content_layout.addWidget(title) threat_box = QFrame() threat_box.setStyleSheet(""" QFrame { background: rgba(239, 68, 68, 20); border-radius: 10px; border: 1px solid rgba(239, 68, 68, 50); padding: 20px; } """) threat_layout = QVBoxLayout(threat_box) threat_header = QLabel('⚠️ Menace détectée et éliminée') threat_header.setFont(QFont('Arial', 11, QFont.Bold)) threat_header.setStyleSheet('color: #f87171;') threat_info = QLabel( 'Type: Trojan.Win32.Malware\n\n' 'Fichier:\n' 'C:\\AppData\\Temp\\svchost32.exe\n\n' 'Action: Mis en quarantaine puis supprimé' ) threat_info.setFont(QFont('Arial', 9)) threat_info.setStyleSheet('color: #cbd5e1;') threat_layout.addWidget(threat_header) threat_layout.addWidget(threat_info) self.content_layout.addWidget(threat_box) success_box = QFrame() success_box.setStyleSheet(""" QFrame { background: rgba(34, 197, 94, 20); border-radius: 10px; border: 1px solid rgba(34, 197, 94, 50); padding: 20px; } """) success_layout = QVBoxLayout(success_box) success_title = QLabel('✓ Système sécurisé') success_title.setFont(QFont('Arial', 11, QFont.Bold)) success_title.setStyleSheet('color: #4ade80;') success_text = QLabel('Votre ordinateur est maintenant protégé.\nAucune autre menace détectée.') success_text.setFont(QFont('Arial', 9)) success_text.setStyleSheet('color: #cbd5e1;') success_layout.addWidget(success_title) success_layout.addWidget(success_text) self.content_layout.addWidget(success_box) buttons_widget = QWidget() buttons_layout = QHBoxLayout(buttons_widget) buttons_layout.setSpacing(10) new_scan_btn = QPushButton('Nouvelle analyse') new_scan_btn.setFont(QFont('Arial', 10, QFont.Bold)) new_scan_btn.setCursor(Qt.PointingHandCursor) new_scan_btn.setStyleSheet(""" QPushButton { background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #2563eb, stop:1 #1d4ed8); color: white; padding: 12px 25px; border-radius: 10px; border: none; } QPushButton:hover { background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #3b82f6, stop:1 #2563eb); } """) new_scan_btn.clicked.connect(self.show_idle_screen) close_btn = QPushButton('Fermer') close_btn.setFont(QFont('Arial', 10, QFont.Bold)) close_btn.setCursor(Qt.PointingHandCursor) close_btn.setStyleSheet(""" QPushButton { background: #475569; color: white; padding: 12px 25px; border-radius: 10px; border: 1px solid #64748b; } QPushButton:hover { background: #64748b; } """) close_btn.clicked.connect(self.close) buttons_layout.addWidget(new_scan_btn) buttons_layout.addWidget(close_btn) self.content_layout.addWidget(buttons_widget, alignment=Qt.AlignCenter) self.content_layout.addStretch() def start_scan(self): self.scanning = True self.progress = 0 self.virus_found = False self.files_scanned = 0 self.show_scanning_screen() self.timer.start(80) def update_scan(self): if self.progress < 100: self.progress += 1.5 self.files_scanned += random.randint(1, 3) if self.progress >= 58 and not self.virus_found: self.virus_found = True self.threats_count_label.setText('1') self.threats_count_label.setStyleSheet('color: #f87171;') self.file_label.setText('C:\\AppData\\Temp\\svchost32.exe') self.virus_alert.show() else: self.file_label.setText(random.choice(self.files)) self.circular_progress.setProgress(min(self.progress, 100)) self.files_count_label.setText(str(self.files_scanned)) else: self.timer.stop() QTimer.singleShot(500, self.show_quarantine_screen) QTimer.singleShot(3000, self.show_destroy_screen) QTimer.singleShot(5500, self.show_complete_screen) def main(): try: app = QApplication(sys.argv) window = CheckMyComputer() window.show() sys.exit(app.exec_()) except Exception as e: print(f"Erreur fatale: {e}") print(traceback.format_exc()) input("Appuyez sur Entrée pour quitter...") if __name__ == '__main__': main()
Créé il y a 3 semaines.