Add files via upload

This commit is contained in:
宗宸·谢尔比 2025-02-01 16:41:59 +08:00 committed by GitHub
parent dca4590ede
commit 747e06f205
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,6 +9,7 @@ from PyQt5.QtCore import Qt, QSize, QThread, pyqtSignal
from PyQt5.QtGui import QFont, QColor, QPalette, QLinearGradient from PyQt5.QtGui import QFont, QColor, QPalette, QLinearGradient
import config import config
import glob import glob
from config import THEMES
# 配置参数(需要用户自行修改) # 配置参数(需要用户自行修改)
DEEPSEEK_API_KEY = config.DEEPSEEK_API_KEY DEEPSEEK_API_KEY = config.DEEPSEEK_API_KEY
API_ENDPOINT = "https://api.deepseek.com/v1/chat/completions" API_ENDPOINT = "https://api.deepseek.com/v1/chat/completions"
@ -542,10 +543,32 @@ class CyberSecurityApp(QMainWindow):
main_widget = QWidget() main_widget = QWidget()
self.setCentralWidget(main_widget) self.setCentralWidget(main_widget)
# 创建主布局
main_layout = QVBoxLayout(main_widget)
# 添加标签页组件
self.tab_widget = QTabWidget() self.tab_widget = QTabWidget()
main_layout = QHBoxLayout(main_widget)
main_layout.addWidget(self.tab_widget) main_layout.addWidget(self.tab_widget)
# 创建底部主题选择器容器
bottom_widget = QWidget()
bottom_layout = QHBoxLayout(bottom_widget)
bottom_layout.setContentsMargins(5, 5, 5, 5)
# 添加弹簧以推动主题选择器到右侧
bottom_layout.addStretch()
# 添加主题选择下拉框
theme_label = QLabel("主题:")
self.theme_selector = QComboBox()
self.theme_selector.addItems(list(THEMES.keys()))
self.theme_selector.currentTextChanged.connect(self.change_theme)
bottom_layout.addWidget(theme_label)
bottom_layout.addWidget(self.theme_selector)
main_layout.addWidget(bottom_widget)
self.create_traffic_analysis_tab() self.create_traffic_analysis_tab()
self.create_js_audit_tab() self.create_js_audit_tab()
self.create_process_analysis_tab() self.create_process_analysis_tab()
@ -840,60 +863,117 @@ class CyberSecurityApp(QMainWindow):
self.trans_btn.setEnabled(True) self.trans_btn.setEnabled(True)
self.trans_output.setPlainText(result) self.trans_output.setPlainText(result)
self.show_status("翻译完成", "#2ed573") self.show_status("翻译完成", "#2ed573")
def get_stylesheet(self): def change_theme(self, theme_name):
return """ if theme_name in THEMES:
QMainWindow { theme = THEMES[theme_name]
background-color: #1a1a2e; self.setStyleSheet(self.get_stylesheet(theme))
}
QLabel { def get_stylesheet(self, theme=None):
color: #e94560; if theme is None:
padding: 5px; theme = THEMES["深色主题"]
} return f"""
QTextEdit { QMainWindow, QWidget, QFrame {{
background-color: #16213e; background-color: {theme['main_bg']};
color: #e6e6e6; color: {theme['text_color']};
border: 2px solid #0f3460;
border-radius: 5px;
padding: 10px;
font-family: 'Menlo'; font-family: 'Menlo';
} }}
QPushButton { QPushButton {{
background-color: #e94560; background-color: {theme['accent_color']};
color: white; color: white;
border: none; border: none;
padding: 12px 24px; padding: 8px 16px;
border-radius: 5px; border-radius: 4px;
font-size: 14px; font-size: 13px;
font-weight: bold; font-weight: 500;
} min-width: 100px;
QPushButton:hover { margin: 4px;
background-color: #ff6b6b; }}
} QPushButton:hover {{
QPushButton:pressed { background-color: {theme['button_hover']};
background-color: #ff4757; }}
} QPushButton:pressed {{
QScrollArea { background-color: {theme['button_pressed']};
background-color: #16213e; }}
border: 1px solid #0f3460; QTextEdit {{
border-radius: 5px; background-color: {theme['secondary_bg']};
} color: {theme['text_color']};
QTabWidget::pane { border: 1px solid {theme['border_color']};
border: 1px solid #0f3460; border-radius: 4px;
background-color: #16213e; padding: 8px;
} font-family: Menlo, Consolas, monospace;
QTabBar::tab { font-size: 12px;
background: #1a1a2e; line-height: 1.4;
color: #e94560; }}
padding: 10px; QLabel {{
border: 1px solid #0f3460; color: {theme['text_color']};
border-bottom-color: #16213e; padding: 4px;
font-size: 13px;
margin-bottom: 2px;
}}
QScrollArea {{
background-color: transparent;
border: none;
}}
QTabWidget::pane {{
border: 1px solid {theme['border_color']};
border-radius: 4px;
background-color: {theme['secondary_bg']};
top: -1px;
}}
QTabBar::tab {{
background: {theme['main_bg']};
color: {theme['text_color']};
padding: 8px 16px;
border: 1px solid {theme['border_color']};
border-bottom: none;
border-top-left-radius: 4px; border-top-left-radius: 4px;
border-top-right-radius: 4px; border-top-right-radius: 4px;
} margin-right: 2px;
QTabBar::tab:selected { font-size: 12px;
background: #16213e; }}
border-bottom-color: #e94560; QTabBar::tab:selected {{
} background: {theme['secondary_bg']};
border-bottom: 2px solid {theme['accent_color']};
}}
QTabBar::tab:hover {{
background-color: {theme['button_hover']};
}}
QComboBox {{
background-color: {theme['secondary_bg']};
color: {theme['text_color']};
border: 1px solid {theme['border_color']};
border-radius: 4px;
padding: 4px 8px;
min-width: 120px;
}}
QComboBox:hover {{
border-color: {theme['accent_color']};
}}
QComboBox::drop-down {{
border: none;
width: 16px;
}}
QComboBox::down-arrow {{
width: 0;
height: 0;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid {theme['text_color']};
margin-top: 2px;
margin-right: 4px;
}}
QProgressBar {{
border: 1px solid {theme['border_color']};
border-radius: 4px;
background-color: {theme['main_bg']};
text-align: center;
height: 16px;
margin: 8px 0;
}}
QProgressBar::chunk {{
background-color: {theme['accent_color']};
border-radius: 3px;
}}
""" """
def start_traffic_analysis(self): def start_traffic_analysis(self):