diff --git a/Common/i18n/init.go b/Common/i18n/init.go new file mode 100644 index 0000000..595bb37 --- /dev/null +++ b/Common/i18n/init.go @@ -0,0 +1,45 @@ +package i18n + +import ( + "github.com/shadow1ng/fscan/common/i18n/messages" +) + +/* +init.go - 国际化模块统一初始化 + +自动加载所有分类消息到全局管理器, +确保所有消息在程序启动时正确注册。 +*/ + +// init 统一初始化所有国际化消息 +func init() { + // 按类别依次加载所有消息 + loadAllMessages() +} + +// loadAllMessages 加载所有分类的消息 +func loadAllMessages() { + // 加载核心系统消息 + AddMessages(messages.CoreMessages) + + // 加载解析相关消息 + AddMessages(messages.ParseMessages) + + // 加载配置相关消息 + AddMessages(messages.ConfigMessages) + + // 加载扫描相关消息 + AddMessages(messages.ScanMessages) + + // 加载网络相关消息 + AddMessages(messages.NetworkMessages) + + // 加载输出相关消息 + AddMessages(messages.OutputMessages) + + // 加载通用错误消息 + AddMessages(messages.ErrorMessages) + + // 加载命令行参数消息 + AddMessages(messages.FlagMessages) +} \ No newline at end of file diff --git a/Common/i18n/messages.go b/Common/i18n/messages.go deleted file mode 100644 index 282ccec..0000000 --- a/Common/i18n/messages.go +++ /dev/null @@ -1,935 +0,0 @@ -package i18n - -/* -messages.go - 国际化消息定义 - -包含项目中所有的国际化消息,按功能模块分类组织, -支持中文和英文两种语言。 -*/ - -// ============================================================================= -// 核心消息库 -// ============================================================================= - -// coreMessages 核心消息映射 -var coreMessages = map[string]map[string]string{ - // ========================= 解析错误消息 ========================= - "parse_error_empty_input": { - LangZH: "输入参数为空", - LangEN: "Input parameters are empty", - }, - "parse_error_config_failed": { - LangZH: "解析配置失败: %v", - LangEN: "Failed to parse configuration: %v", - }, - "parse_error_parser_not_init": { - LangZH: "解析器未初始化", - LangEN: "Parser not initialized", - }, - "parse_error_credential_failed": { - LangZH: "凭据解析失败: %v", - LangEN: "Failed to parse credentials: %v", - }, - "parse_error_target_failed": { - LangZH: "目标解析失败: %v", - LangEN: "Failed to parse targets: %v", - }, - "parse_error_network_failed": { - LangZH: "网络解析失败: %v", - LangEN: "Failed to parse network configuration: %v", - }, - "parse_error_validation_failed": { - LangZH: "验证失败: %v", - LangEN: "Validation failed: %v", - }, - "parse_error_update_vars_failed": { - LangZH: "更新全局变量失败: %v", - LangEN: "Failed to update global variables: %v", - }, - "parse_error_target_empty": { - LangZH: "目标输入为空", - LangEN: "Target input is empty", - }, - "parse_error_credential_empty": { - LangZH: "凭据输入为空", - LangEN: "Credential input is empty", - }, - "parse_error_network_empty": { - LangZH: "网络配置为空", - LangEN: "Network configuration is empty", - }, - "parse_error_invalid_ip": { - LangZH: "无效的IP地址: %s", - LangEN: "Invalid IP address: %s", - }, - "parse_error_invalid_port": { - LangZH: "无效的端口: %s", - LangEN: "Invalid port: %s", - }, - "parse_error_invalid_url": { - LangZH: "无效的URL: %s", - LangEN: "Invalid URL: %s", - }, - "parse_error_file_not_found": { - LangZH: "文件未找到: %s", - LangEN: "File not found: %s", - }, - "parse_error_file_read_failed": { - LangZH: "读取文件失败: %s", - LangEN: "Failed to read file: %s", - }, - - // ========================= 配置相关消息 ========================= - "config_sync_start": { - LangZH: "开始同步配置", - LangEN: "Starting configuration sync", - }, - "config_sync_complete": { - LangZH: "配置同步完成", - LangEN: "Configuration sync completed", - }, - "config_validation_start": { - LangZH: "开始配置验证", - LangEN: "Starting configuration validation", - }, - "config_validation_complete": { - LangZH: "配置验证完成", - LangEN: "Configuration validation completed", - }, - "config_invalid_scan_mode": { - LangZH: "无效的扫描模式: %s", - LangEN: "Invalid scan mode: %s", - }, - "config_invalid_thread_num": { - LangZH: "无效的线程数: %d", - LangEN: "Invalid thread number: %d", - }, - "config_invalid_timeout": { - LangZH: "无效的超时时间: %v", - LangEN: "Invalid timeout: %v", - }, - "config_invalid_proxy": { - LangZH: "无效的代理配置: %s", - LangEN: "Invalid proxy configuration: %s", - }, - "config_missing_required": { - LangZH: "缺少必需的配置项: %s", - LangEN: "Missing required configuration: %s", - }, - "config_load_default": { - LangZH: "加载默认配置", - LangEN: "Loading default configuration", - }, - "config_override_detected": { - LangZH: "检测到配置覆盖: %s", - LangEN: "Configuration override detected: %s", - }, - - // ========================= 输出系统消息 ========================= - "output_init_start": { - LangZH: "初始化输出系统", - LangEN: "Initializing output system", - }, - "output_init_success": { - LangZH: "输出系统初始化成功", - LangEN: "Output system initialized successfully", - }, - "output_init_failed": { - LangZH: "输出系统初始化失败: %v", - LangEN: "Failed to initialize output system: %v", - }, - "output_format_invalid": { - LangZH: "无效的输出格式: %s", - LangEN: "Invalid output format: %s", - }, - "output_path_empty": { - LangZH: "输出路径为空", - LangEN: "Output path is empty", - }, - "output_not_init": { - LangZH: "输出系统未初始化", - LangEN: "Output system not initialized", - }, - "output_saving_result": { - LangZH: "保存扫描结果: %s -> %s", - LangEN: "Saving scan result: %s -> %s", - }, - "output_save_failed": { - LangZH: "保存结果失败: %v", - LangEN: "Failed to save result: %v", - }, - "output_closing": { - LangZH: "关闭输出系统", - LangEN: "Closing output system", - }, - "output_closed": { - LangZH: "输出系统已关闭", - LangEN: "Output system closed", - }, - "output_close_failed": { - LangZH: "关闭输出系统失败: %v", - LangEN: "Failed to close output system: %v", - }, - "output_config_nil": { - LangZH: "配置不能为空", - LangEN: "Configuration cannot be nil", - }, - "output_unsupported_format": { - LangZH: "不支持的输出格式: %s", - LangEN: "Unsupported output format: %s", - }, - "output_writer_init_failed": { - LangZH: "初始化写入器失败: %v", - LangEN: "Failed to initialize writer: %v", - }, - "output_writer_closed": { - LangZH: "写入器已关闭", - LangEN: "Writer is closed", - }, - "output_manager_not_init": { - LangZH: "输出管理器未初始化", - LangEN: "Output manager not initialized", - }, - "output_manager_closed": { - LangZH: "输出管理器已关闭", - LangEN: "Output manager is closed", - }, - "output_write_failed": { - LangZH: "写入结果失败: %v", - LangEN: "Failed to write result: %v", - }, - "output_flush_failed": { - LangZH: "刷新写入器失败: %v", - LangEN: "Failed to flush writer: %v", - }, - "output_create_file_failed": { - LangZH: "创建%s文件失败: %v", - LangEN: "Failed to create %s file: %v", - }, - "output_write_header_failed": { - LangZH: "写入CSV头部失败: %v", - LangEN: "Failed to write CSV header: %v", - }, - "output_open_file_failed": { - LangZH: "打开CSV文件失败: %v", - LangEN: "Failed to open CSV file: %v", - }, - "output_read_file_failed": { - LangZH: "读取CSV文件失败: %v", - LangEN: "Failed to read CSV file: %v", - }, - "output_parse_time_failed": { - LangZH: "无法解析时间: %s", - LangEN: "Failed to parse time: %s", - }, - - // ========================= 代理系统消息 ========================= - "proxy_init_start": { - LangZH: "初始化代理系统", - LangEN: "Initializing proxy system", - }, - "proxy_init_success": { - LangZH: "代理系统初始化成功", - LangEN: "Proxy system initialized successfully", - }, - "proxy_init_failed": { - LangZH: "初始化代理配置失败: %v", - LangEN: "Failed to initialize proxy configuration: %v", - }, - "proxy_config_sync_failed": { - LangZH: "代理配置同步失败: %v", - LangEN: "Failed to sync proxy configuration: %v", - }, - "proxy_enabled": { - LangZH: "代理已启用: %s %s", - LangEN: "Proxy enabled: %s %s", - }, - "proxy_disabled": { - LangZH: "代理已禁用", - LangEN: "Proxy disabled", - }, - "proxy_connection_failed": { - LangZH: "代理连接失败: %v", - LangEN: "Proxy connection failed: %v", - }, - "socks5_create_failed": { - LangZH: "创建SOCKS5连接失败: %v", - LangEN: "Failed to create SOCKS5 connection: %v", - }, - "tls_conn_failed": { - LangZH: "TLS连接失败: %v", - LangEN: "TLS connection failed: %v", - }, - - // ========================= 系统状态消息 ========================= - "status_scan_start": { - LangZH: "开始扫描", - LangEN: "Starting scan", - }, - "status_scan_complete": { - LangZH: "扫描完成", - LangEN: "Scan completed", - }, - "status_scan_progress": { - LangZH: "扫描进度: %d/%d", - LangEN: "Scan progress: %d/%d", - }, - "status_target_found": { - LangZH: "发现目标: %s", - LangEN: "Target found: %s", - }, - "status_service_detected": { - LangZH: "检测到服务: %s", - LangEN: "Service detected: %s", - }, - "status_vuln_found": { - LangZH: "发现漏洞: %s", - LangEN: "Vulnerability found: %s", - }, - "status_connection_failed": { - LangZH: "连接失败: %s", - LangEN: "Connection failed: %s", - }, - "status_timeout": { - LangZH: "连接超时: %s", - LangEN: "Connection timeout: %s", - }, - - // ========================= 目标解析消息 ========================= - "target_parse_start": { - LangZH: "开始解析目标", - LangEN: "Starting target parsing", - }, - "target_parse_complete": { - LangZH: "目标解析完成", - LangEN: "Target parsing completed", - }, - "target_hosts_found": { - LangZH: "目标主机: %s", - LangEN: "Target hosts: %s", - }, - "target_hosts_count": { - LangZH: "目标主机: %s ... (共%d个)", - LangEN: "Target hosts: %s ... (total %d)", - }, - "target_urls_found": { - LangZH: "目标URL: %s", - LangEN: "Target URLs: %s", - }, - "target_urls_count": { - LangZH: "目标URL: %s ... (共%d个)", - LangEN: "Target URLs: %s ... (total %d)", - }, - "target_ports_found": { - LangZH: "扫描端口: %s", - LangEN: "Scan ports: %s", - }, - "target_ports_count": { - LangZH: "扫描端口: %s ... (共%d个)", - LangEN: "Scan ports: %s ... (total %d)", - }, - "target_exclude_ports": { - LangZH: "排除端口: %s", - LangEN: "Exclude ports: %s", - }, - "target_local_mode": { - LangZH: "本地扫描模式", - LangEN: "Local scan mode", - }, - - // ========================= 网络配置消息 ========================= - "network_http_proxy": { - LangZH: "HTTP代理: %s", - LangEN: "HTTP proxy: %s", - }, - "network_socks5_proxy": { - LangZH: "Socks5代理: %s", - LangEN: "Socks5 proxy: %s", - }, - "network_timeout": { - LangZH: "连接超时: %v", - LangEN: "Connection timeout: %v", - }, - "network_web_timeout": { - LangZH: "Web超时: %v", - LangEN: "Web timeout: %v", - }, - - // ========================= 凭据相关消息 ========================= - "credential_username_count": { - LangZH: "用户名数量: %d", - LangEN: "Username count: %d", - }, - "credential_password_count": { - LangZH: "密码数量: %d", - LangEN: "Password count: %d", - }, - "credential_hash_count": { - LangZH: "Hash数量: %d", - LangEN: "Hash count: %d", - }, - - // ========================= 文件操作消息 ========================= - "file_read_start": { - LangZH: "开始读取文件: %s", - LangEN: "Starting to read file: %s", - }, - "file_read_complete": { - LangZH: "文件读取完成: %s", - LangEN: "File reading completed: %s", - }, - "file_read_error": { - LangZH: "读取文件错误: %s", - LangEN: "File reading error: %s", - }, - "file_not_exist": { - LangZH: "文件不存在: %s", - LangEN: "File does not exist: %s", - }, - "file_empty": { - LangZH: "文件为空: %s", - LangEN: "File is empty: %s", - }, - - // ========================= 验证相关消息 ========================= - "validation_start": { - LangZH: "开始配置验证", - LangEN: "Starting configuration validation", - }, - "validation_complete": { - LangZH: "配置验证完成", - LangEN: "Configuration validation completed", - }, - "validation_warning": { - LangZH: "验证警告: %s", - LangEN: "Validation warning: %s", - }, - "validation_error": { - LangZH: "验证错误: %s", - LangEN: "Validation error: %s", - }, - - // ========================= 通用错误消息 ========================= - "error_occurred": { - LangZH: "错误: %v", - LangEN: "Error: %v", - }, - "error_unknown": { - LangZH: "未知错误", - LangEN: "Unknown error", - }, - "error_not_implemented": { - LangZH: "功能未实现", - LangEN: "Feature not implemented", - }, - "error_permission_denied": { - LangZH: "权限不足", - LangEN: "Permission denied", - }, - "error_resource_busy": { - LangZH: "资源忙碌", - LangEN: "Resource busy", - }, - - // ========================= 通用状态消息 ========================= - "status_initializing": { - LangZH: "正在初始化...", - LangEN: "Initializing...", - }, - "status_processing": { - LangZH: "正在处理...", - LangEN: "Processing...", - }, - "status_completed": { - LangZH: "已完成", - LangEN: "Completed", - }, - "status_failed": { - LangZH: "失败", - LangEN: "Failed", - }, - "status_cancelled": { - LangZH: "已取消", - LangEN: "Cancelled", - }, - "status_ready": { - LangZH: "就绪", - LangEN: "Ready", - }, - - // ========================= Parsers包专用消息 ========================= - "parser_validation_input_empty": { - LangZH: "验证输入为空", - LangEN: "Validation input is empty", - }, - "parser_empty_input": { - LangZH: "输入参数为空", - LangEN: "Input parameters are empty", - }, - "parser_file_empty": { - LangZH: "文件名为空", - LangEN: "File name is empty", - }, - "parser_file_too_big": { - LangZH: "文件过大: %d bytes, 最大限制: %d bytes", - LangEN: "File too large: %d bytes, max limit: %d bytes", - }, - "parser_cannot_open_file": { - LangZH: "无法打开文件", - LangEN: "Cannot open file", - }, - "parser_file_not_exists": { - LangZH: "文件不存在或无法访问", - LangEN: "File does not exist or cannot be accessed", - }, - "parser_file_read_timeout": { - LangZH: "文件读取超时", - LangEN: "File read timeout", - }, - "parser_file_scan_failed": { - LangZH: "文件扫描失败", - LangEN: "File scan failed", - }, - "parser_username_too_long": { - LangZH: "用户名过长: %d字符,最大允许: %d", - LangEN: "Username too long: %d characters, max allowed: %d", - }, - "parser_username_invalid_chars": { - LangZH: "用户名包含非法字符", - LangEN: "Username contains invalid characters", - }, - "parser_password_empty": { - LangZH: "不允许空密码", - LangEN: "Empty passwords not allowed", - }, - "parser_password_too_long": { - LangZH: "密码过长: %d字符,最大允许: %d", - LangEN: "Password too long: %d characters, max allowed: %d", - }, - "parser_hash_empty": { - LangZH: "哈希值为空", - LangEN: "Hash value is empty", - }, - "parser_hash_invalid_format": { - LangZH: "哈希值格式无效,需要32位十六进制字符", - LangEN: "Invalid hash format, requires 32-character hexadecimal", - }, - "parser_proxy_url_invalid": { - LangZH: "代理URL格式无效: %v", - LangEN: "Invalid proxy URL format: %v", - }, - "parser_proxy_protocol_unsupported": { - LangZH: "不支持的代理协议: %s", - LangEN: "Unsupported proxy protocol: %s", - }, - "parser_proxy_host_empty": { - LangZH: "代理主机名为空", - LangEN: "Proxy hostname is empty", - }, - "parser_proxy_port_invalid": { - LangZH: "代理端口号无效: %s", - LangEN: "Invalid proxy port: %s", - }, - "parser_proxy_port_out_of_range": { - LangZH: "代理端口号超出范围: %d", - LangEN: "Proxy port out of range: %d", - }, - "parser_proxy_insecure": { - LangZH: "不允许使用不安全的HTTP代理", - LangEN: "Insecure HTTP proxy not allowed", - }, - "parser_user_agent_too_long": { - LangZH: "用户代理字符串过长", - LangEN: "User agent string too long", - }, - "parser_user_agent_invalid_chars": { - LangZH: "用户代理包含非法字符", - LangEN: "User agent contains invalid characters", - }, - "parser_cookie_too_long": { - LangZH: "Cookie字符串过长", - LangEN: "Cookie string too long", - }, - "parser_error_count_limit": { - LangZH: "错误数量过多,仅显示前%d个", - LangEN: "Too many errors, showing only first %d", - }, - "parser_no_scan_target": { - LangZH: "未指定任何扫描目标", - LangEN: "No scan targets specified", - }, - "parser_no_target_default": { - LangZH: "未指定扫描目标,将使用默认配置", - LangEN: "No scan targets specified, using default configuration", - }, - "parser_multiple_scan_modes": { - LangZH: "不能同时使用多种扫描模式", - LangEN: "Cannot use multiple scan modes simultaneously", - }, - "parser_proxy_ping_warning": { - LangZH: "使用代理时建议禁用Ping检测", - LangEN: "Recommend disabling Ping detection when using proxy", - }, - "parser_multiple_modes_conflict": { - LangZH: "不能同时指定多种扫描模式(主机扫描、URL扫描、本地模式)", - LangEN: "Cannot specify multiple scan modes (host scan, URL scan, local mode) simultaneously", - }, - "parser_proxy_ping_fail": { - LangZH: "代理模式下Ping检测可能失效", - LangEN: "Ping detection may fail in proxy mode", - }, - "parser_exclude_ports_invalid": { - LangZH: "排除端口无效", - LangEN: "Exclude ports invalid", - }, - "parser_many_targets_warning": { - LangZH: "大量目标(%d),可能耗时较长", - LangEN: "Large number of targets (%d), may take a long time", - }, - "parser_too_many_ports": { - LangZH: "端口数量过多", - LangEN: "Too many ports", - }, - "parser_timeout_too_short": { - LangZH: "超时过短", - LangEN: "Timeout too short", - }, - "parser_timeout_too_long": { - LangZH: "超时过长", - LangEN: "Timeout too long", - }, - "parser_invalid_scan_mode": { - LangZH: "无效的扫描模式: %s", - LangEN: "Invalid scan mode: %s", - }, - - // ========================= 扫描流程消息 ========================= - "scan_mode_service_selected": { - LangZH: "已选择服务扫描模式", - LangEN: "Service scan mode selected", - }, - "scan_info_start": { - LangZH: "开始信息扫描", - LangEN: "Starting information scan", - }, - "scan_host_start": { - LangZH: "开始主机扫描", - LangEN: "Starting host scan", - }, - "scan_vulnerability_start": { - LangZH: "开始漏洞扫描", - LangEN: "Starting vulnerability scan", - }, - "scan_no_service_plugins": { - LangZH: "未找到可用的服务插件", - LangEN: "No available service plugins found", - }, - "scan_vulnerability_plugins": { - LangZH: "使用漏洞扫描插件: %s", - LangEN: "Using vulnerability scan plugins: %s", - }, - "scan_no_vulnerability_plugins": { - LangZH: "未找到可用的漏洞扫描插件", - LangEN: "No available vulnerability scan plugins found", - }, - "scan_complete_ports_found": { - LangZH: "扫描完成, 发现 %d 个开放端口", - LangEN: "Scan completed, found %d open ports", - }, - "scan_alive_ports_count": { - LangZH: "存活端口数量: %d", - LangEN: "Alive ports count: %d", - }, - "scan_task_complete": { - LangZH: "扫描已完成: %d/%d", - LangEN: "Scan completed: %d/%d", - }, - - // ========================= 配置验证消息 ========================= - "config_web_timeout_warning": { - LangZH: "Web超时时间大于普通超时时间,可能导致不期望的行为", - LangEN: "Web timeout is larger than normal timeout, may cause unexpected behavior", - }, - - // ========================= Flag参数帮助消息 ========================= - "flag_host": { - LangZH: "目标主机: IP, IP段, IP段文件, 域名", - LangEN: "Target host: IP, IP range, IP file, domain", - }, - "flag_exclude_hosts": { - LangZH: "排除主机", - LangEN: "Exclude hosts", - }, - "flag_ports": { - LangZH: "端口: 默认1000个常用端口", - LangEN: "Ports: default 1000 common ports", - }, - "flag_exclude_ports": { - LangZH: "排除端口", - LangEN: "Exclude ports", - }, - "flag_hosts_file": { - LangZH: "主机文件", - LangEN: "Hosts file", - }, - "flag_ports_file": { - LangZH: "端口文件", - LangEN: "Ports file", - }, - "flag_scan_mode": { - LangZH: "扫描模式: all, portscan, tcpscan, udpscan等", - LangEN: "Scan mode: all, portscan, tcpscan, udpscan, etc.", - }, - "flag_thread_num": { - LangZH: "端口扫描线程数", - LangEN: "Port scan thread count", - }, - "flag_timeout": { - LangZH: "端口扫描超时时间", - LangEN: "Port scan timeout", - }, - "flag_module_thread_num": { - LangZH: "模块线程数", - LangEN: "Module thread count", - }, - "flag_global_timeout": { - LangZH: "全局超时时间", - LangEN: "Global timeout", - }, - "flag_live_top": { - LangZH: "存活主机显示数量", - LangEN: "Live hosts display count", - }, - "flag_disable_ping": { - LangZH: "禁用ping探测", - LangEN: "Disable ping detection", - }, - "flag_enable_fingerprint": { - LangZH: "启用指纹识别", - LangEN: "Enable fingerprinting", - }, - "flag_local_mode": { - LangZH: "本地扫描模式", - LangEN: "Local scan mode", - }, - "flag_username": { - LangZH: "用户名", - LangEN: "Username", - }, - "flag_password": { - LangZH: "密码", - LangEN: "Password", - }, - "flag_add_users": { - LangZH: "额外用户名", - LangEN: "Additional usernames", - }, - "flag_add_passwords": { - LangZH: "额外密码", - LangEN: "Additional passwords", - }, - "flag_users_file": { - LangZH: "用户名字典文件", - LangEN: "Username dictionary file", - }, - "flag_passwords_file": { - LangZH: "密码字典文件", - LangEN: "Password dictionary file", - }, - "flag_hash_file": { - LangZH: "哈希文件", - LangEN: "Hash file", - }, - "flag_hash_value": { - LangZH: "哈希值", - LangEN: "Hash value", - }, - "flag_domain": { - LangZH: "域名", - LangEN: "Domain name", - }, - "flag_ssh_key": { - LangZH: "SSH私钥文件", - LangEN: "SSH private key file", - }, - "flag_target_url": { - LangZH: "目标URL", - LangEN: "Target URL", - }, - "flag_urls_file": { - LangZH: "URL文件", - LangEN: "URLs file", - }, - "flag_cookie": { - LangZH: "HTTP Cookie", - LangEN: "HTTP Cookie", - }, - "flag_web_timeout": { - LangZH: "Web超时时间", - LangEN: "Web timeout", - }, - "flag_http_proxy": { - LangZH: "HTTP代理", - LangEN: "HTTP proxy", - }, - "flag_socks5_proxy": { - LangZH: "SOCKS5代理", - LangEN: "SOCKS5 proxy", - }, - "flag_poc_path": { - LangZH: "POC脚本路径", - LangEN: "POC script path", - }, - "flag_poc_name": { - LangZH: "POC名称", - LangEN: "POC name", - }, - "flag_poc_full": { - LangZH: "全量POC扫描", - LangEN: "Full POC scan", - }, - "flag_dns_log": { - LangZH: "DNS日志记录", - LangEN: "DNS logging", - }, - "flag_poc_num": { - LangZH: "POC并发数", - LangEN: "POC concurrency", - }, - "flag_no_poc": { - LangZH: "禁用POC扫描", - LangEN: "Disable POC scan", - }, - "flag_redis_file": { - LangZH: "Redis文件", - LangEN: "Redis file", - }, - "flag_redis_shell": { - LangZH: "Redis Shell", - LangEN: "Redis Shell", - }, - "flag_disable_redis": { - LangZH: "禁用Redis扫描", - LangEN: "Disable Redis scan", - }, - "flag_redis_write_path": { - LangZH: "Redis写入路径", - LangEN: "Redis write path", - }, - "flag_redis_write_content": { - LangZH: "Redis写入内容", - LangEN: "Redis write content", - }, - "flag_redis_write_file": { - LangZH: "Redis写入文件", - LangEN: "Redis write file", - }, - "flag_disable_brute": { - LangZH: "禁用暴力破解", - LangEN: "Disable brute force", - }, - "flag_max_retries": { - LangZH: "最大重试次数", - LangEN: "Maximum retries", - }, - "flag_output_file": { - LangZH: "输出文件", - LangEN: "Output file", - }, - "flag_output_format": { - LangZH: "输出格式: txt, json, csv", - LangEN: "Output format: txt, json, csv", - }, - "flag_disable_save": { - LangZH: "禁用结果保存", - LangEN: "Disable result saving", - }, - "flag_silent_mode": { - LangZH: "静默模式", - LangEN: "Silent mode", - }, - "flag_no_color": { - LangZH: "禁用颜色输出", - LangEN: "Disable color output", - }, - "flag_log_level": { - LangZH: "日志级别", - LangEN: "Log level", - }, - "flag_disable_progress": { - LangZH: "禁用进度条", - LangEN: "Disable progress bar", - }, - "flag_shellcode": { - LangZH: "Shellcode", - LangEN: "Shellcode", - }, - "flag_language": { - LangZH: "语言: zh, en", - LangEN: "Language: zh, en", - }, - "flag_help": { - LangZH: "显示帮助信息", - LangEN: "Show help information", - }, - "flag_version": { - LangZH: "显示版本信息", - LangEN: "Show version information", - }, - - // ========================= 扫描模式选择消息 ========================= - "scan_mode_local_selected": { - LangZH: "已选择本地扫描模式", - LangEN: "Local scan mode selected", - }, - "scan_mode_web_selected": { - LangZH: "已选择Web扫描模式", - LangEN: "Web scan mode selected", - }, - - // ========================= 扫描错误消息 ========================= - "scan_plugin_panic": { - LangZH: "[PANIC] 插件 %s 扫描 %s:%s 时崩溃: %v", - LangEN: "[PANIC] Plugin %s crashed while scanning %s:%s: %v", - }, - "scan_plugin_not_found": { - LangZH: "扫描类型 %v 无对应插件,已跳过", - LangEN: "No plugin found for scan type %v, skipped", - }, - "scan_plugin_error": { - LangZH: "扫描错误 %v:%v - %v", - LangEN: "Scan error %v:%v - %v", - }, - - // ========================= 进度条消息 ========================= - "progress_scanning_description": { - LangZH: "扫描进度", - LangEN: "Scanning Progress", - }, - "progress_port_scanning": { - LangZH: "端口扫描", - LangEN: "Port Scanning", - }, - "progress_scan_completed": { - LangZH: "扫描完成:", - LangEN: "Scan Completed:", - }, - "progress_port_scan_completed": { - LangZH: "端口扫描完成:", - LangEN: "Port Scan Completed:", - }, - "progress_open_ports": { - LangZH: "开放端口", - LangEN: "Open Ports", - }, -} - -// ============================================================================= -// 初始化函数 -// ============================================================================= - -// init 初始化核心消息到全局管理器 -func init() { - // 将所有核心消息添加到全局管理器 - AddMessages(coreMessages) -} \ No newline at end of file diff --git a/Common/i18n/messages/config.go b/Common/i18n/messages/config.go new file mode 100644 index 0000000..05153e1 --- /dev/null +++ b/Common/i18n/messages/config.go @@ -0,0 +1,79 @@ +package messages + +/* +config.go - 配置相关消息 + +包含配置管理、验证、同步等相关的 +国际化消息定义。 +*/ + +// ConfigMessages 配置相关消息 +var ConfigMessages = map[string]map[string]string{ + // ========================= 配置相关消息 ========================= + "config_sync_start": { + LangZH: "开始同步配置", + LangEN: "Starting configuration sync", + }, + "config_sync_complete": { + LangZH: "配置同步完成", + LangEN: "Configuration sync completed", + }, + "config_validation_start": { + LangZH: "开始配置验证", + LangEN: "Starting configuration validation", + }, + "config_validation_complete": { + LangZH: "配置验证完成", + LangEN: "Configuration validation completed", + }, + "config_invalid_scan_mode": { + LangZH: "无效的扫描模式: %s", + LangEN: "Invalid scan mode: %s", + }, + "config_invalid_thread_num": { + LangZH: "无效的线程数: %d", + LangEN: "Invalid thread number: %d", + }, + "config_invalid_timeout": { + LangZH: "无效的超时时间: %v", + LangEN: "Invalid timeout: %v", + }, + "config_invalid_proxy": { + LangZH: "无效的代理配置: %s", + LangEN: "Invalid proxy configuration: %s", + }, + "config_missing_required": { + LangZH: "缺少必需的配置项: %s", + LangEN: "Missing required configuration: %s", + }, + "config_load_default": { + LangZH: "加载默认配置", + LangEN: "Loading default configuration", + }, + "config_override_detected": { + LangZH: "检测到配置覆盖: %s", + LangEN: "Configuration override detected: %s", + }, + "config_web_timeout_warning": { + LangZH: "Web超时时间大于普通超时时间,可能导致不期望的行为", + LangEN: "Web timeout is larger than normal timeout, may cause unexpected behavior", + }, + + // ========================= 验证相关消息 ========================= + "validation_start": { + LangZH: "开始配置验证", + LangEN: "Starting configuration validation", + }, + "validation_complete": { + LangZH: "配置验证完成", + LangEN: "Configuration validation completed", + }, + "validation_warning": { + LangZH: "验证警告: %s", + LangEN: "Validation warning: %s", + }, + "validation_error": { + LangZH: "验证错误: %s", + LangEN: "Validation error: %s", + }, +} \ No newline at end of file diff --git a/Common/i18n/messages/constants.go b/Common/i18n/messages/constants.go new file mode 100644 index 0000000..ae1b3ef --- /dev/null +++ b/Common/i18n/messages/constants.go @@ -0,0 +1,13 @@ +package messages + +/* +constants.go - 消息包常量定义 + +包含消息包中使用的语言常量,避免循环导入问题。 +*/ + +// 语言常量 +const ( + LangZH = "zh" // 中文 + LangEN = "en" // 英文 +) \ No newline at end of file diff --git a/Common/i18n/messages/core.go b/Common/i18n/messages/core.go new file mode 100644 index 0000000..141b40b --- /dev/null +++ b/Common/i18n/messages/core.go @@ -0,0 +1,93 @@ +package messages + +/* +core.go - 核心系统消息 + +包含系统核心功能的国际化消息,包括扫描流程、 +系统状态、通用错误等基础消息。 +*/ + +// CoreMessages 核心系统消息 +var CoreMessages = map[string]map[string]string{ + // ========================= 系统状态消息 ========================= + "status_scan_start": { + LangZH: "开始扫描", + LangEN: "Starting scan", + }, + "status_scan_complete": { + LangZH: "扫描完成", + LangEN: "Scan completed", + }, + "status_scan_progress": { + LangZH: "扫描进度: %d/%d", + LangEN: "Scan progress: %d/%d", + }, + "status_target_found": { + LangZH: "发现目标: %s", + LangEN: "Target found: %s", + }, + "status_service_detected": { + LangZH: "检测到服务: %s", + LangEN: "Service detected: %s", + }, + "status_vuln_found": { + LangZH: "发现漏洞: %s", + LangEN: "Vulnerability found: %s", + }, + "status_connection_failed": { + LangZH: "连接失败: %s", + LangEN: "Connection failed: %s", + }, + "status_timeout": { + LangZH: "连接超时: %s", + LangEN: "Connection timeout: %s", + }, + + // ========================= 通用状态消息 ========================= + "status_initializing": { + LangZH: "正在初始化...", + LangEN: "Initializing...", + }, + "status_processing": { + LangZH: "正在处理...", + LangEN: "Processing...", + }, + "status_completed": { + LangZH: "已完成", + LangEN: "Completed", + }, + "status_failed": { + LangZH: "失败", + LangEN: "Failed", + }, + "status_cancelled": { + LangZH: "已取消", + LangEN: "Cancelled", + }, + "status_ready": { + LangZH: "就绪", + LangEN: "Ready", + }, + + // ========================= 文件操作消息 ========================= + "file_read_start": { + LangZH: "开始读取文件: %s", + LangEN: "Starting to read file: %s", + }, + "file_read_complete": { + LangZH: "文件读取完成: %s", + LangEN: "File reading completed: %s", + }, + "file_read_error": { + LangZH: "读取文件错误: %s", + LangEN: "File reading error: %s", + }, + "file_not_exist": { + LangZH: "文件不存在: %s", + LangEN: "File does not exist: %s", + }, + "file_empty": { + LangZH: "文件为空: %s", + LangEN: "File is empty: %s", + }, +} \ No newline at end of file diff --git a/Common/i18n/messages/error.go b/Common/i18n/messages/error.go new file mode 100644 index 0000000..4cb4490 --- /dev/null +++ b/Common/i18n/messages/error.go @@ -0,0 +1,33 @@ +package messages + +/* +error.go - 通用错误消息 + +包含通用错误、异常处理等相关的 +国际化消息定义。 +*/ + +// ErrorMessages 通用错误消息 +var ErrorMessages = map[string]map[string]string{ + // ========================= 通用错误消息 ========================= + "error_occurred": { + LangZH: "错误: %v", + LangEN: "Error: %v", + }, + "error_unknown": { + LangZH: "未知错误", + LangEN: "Unknown error", + }, + "error_not_implemented": { + LangZH: "功能未实现", + LangEN: "Feature not implemented", + }, + "error_permission_denied": { + LangZH: "权限不足", + LangEN: "Permission denied", + }, + "error_resource_busy": { + LangZH: "资源忙碌", + LangEN: "Resource busy", + }, +} \ No newline at end of file diff --git a/Common/i18n/messages/flag.go b/Common/i18n/messages/flag.go new file mode 100644 index 0000000..f075070 --- /dev/null +++ b/Common/i18n/messages/flag.go @@ -0,0 +1,237 @@ +package messages + +/* +flag.go - 命令行参数消息 + +包含命令行参数帮助信息等相关的 +国际化消息定义。 +*/ + +// FlagMessages 命令行参数消息 +var FlagMessages = map[string]map[string]string{ + // ========================= Flag参数帮助消息 ========================= + "flag_host": { + LangZH: "目标主机: IP, IP段, IP段文件, 域名", + LangEN: "Target host: IP, IP range, IP file, domain", + }, + "flag_exclude_hosts": { + LangZH: "排除主机", + LangEN: "Exclude hosts", + }, + "flag_ports": { + LangZH: "端口: 默认1000个常用端口", + LangEN: "Ports: default 1000 common ports", + }, + "flag_exclude_ports": { + LangZH: "排除端口", + LangEN: "Exclude ports", + }, + "flag_hosts_file": { + LangZH: "主机文件", + LangEN: "Hosts file", + }, + "flag_ports_file": { + LangZH: "端口文件", + LangEN: "Ports file", + }, + "flag_scan_mode": { + LangZH: "扫描模式: all, portscan, tcpscan, udpscan等", + LangEN: "Scan mode: all, portscan, tcpscan, udpscan, etc.", + }, + "flag_thread_num": { + LangZH: "端口扫描线程数", + LangEN: "Port scan thread count", + }, + "flag_timeout": { + LangZH: "端口扫描超时时间", + LangEN: "Port scan timeout", + }, + "flag_module_thread_num": { + LangZH: "模块线程数", + LangEN: "Module thread count", + }, + "flag_global_timeout": { + LangZH: "全局超时时间", + LangEN: "Global timeout", + }, + "flag_live_top": { + LangZH: "存活主机显示数量", + LangEN: "Live hosts display count", + }, + "flag_disable_ping": { + LangZH: "禁用ping探测", + LangEN: "Disable ping detection", + }, + "flag_enable_fingerprint": { + LangZH: "启用指纹识别", + LangEN: "Enable fingerprinting", + }, + "flag_local_mode": { + LangZH: "本地扫描模式", + LangEN: "Local scan mode", + }, + "flag_username": { + LangZH: "用户名", + LangEN: "Username", + }, + "flag_password": { + LangZH: "密码", + LangEN: "Password", + }, + "flag_add_users": { + LangZH: "额外用户名", + LangEN: "Additional usernames", + }, + "flag_add_passwords": { + LangZH: "额外密码", + LangEN: "Additional passwords", + }, + "flag_users_file": { + LangZH: "用户名字典文件", + LangEN: "Username dictionary file", + }, + "flag_passwords_file": { + LangZH: "密码字典文件", + LangEN: "Password dictionary file", + }, + "flag_hash_file": { + LangZH: "哈希文件", + LangEN: "Hash file", + }, + "flag_hash_value": { + LangZH: "哈希值", + LangEN: "Hash value", + }, + "flag_domain": { + LangZH: "域名", + LangEN: "Domain name", + }, + "flag_ssh_key": { + LangZH: "SSH私钥文件", + LangEN: "SSH private key file", + }, + "flag_target_url": { + LangZH: "目标URL", + LangEN: "Target URL", + }, + "flag_urls_file": { + LangZH: "URL文件", + LangEN: "URLs file", + }, + "flag_cookie": { + LangZH: "HTTP Cookie", + LangEN: "HTTP Cookie", + }, + "flag_web_timeout": { + LangZH: "Web超时时间", + LangEN: "Web timeout", + }, + "flag_http_proxy": { + LangZH: "HTTP代理", + LangEN: "HTTP proxy", + }, + "flag_socks5_proxy": { + LangZH: "SOCKS5代理", + LangEN: "SOCKS5 proxy", + }, + "flag_poc_path": { + LangZH: "POC脚本路径", + LangEN: "POC script path", + }, + "flag_poc_name": { + LangZH: "POC名称", + LangEN: "POC name", + }, + "flag_poc_full": { + LangZH: "全量POC扫描", + LangEN: "Full POC scan", + }, + "flag_dns_log": { + LangZH: "DNS日志记录", + LangEN: "DNS logging", + }, + "flag_poc_num": { + LangZH: "POC并发数", + LangEN: "POC concurrency", + }, + "flag_no_poc": { + LangZH: "禁用POC扫描", + LangEN: "Disable POC scan", + }, + "flag_redis_file": { + LangZH: "Redis文件", + LangEN: "Redis file", + }, + "flag_redis_shell": { + LangZH: "Redis Shell", + LangEN: "Redis Shell", + }, + "flag_disable_redis": { + LangZH: "禁用Redis扫描", + LangEN: "Disable Redis scan", + }, + "flag_redis_write_path": { + LangZH: "Redis写入路径", + LangEN: "Redis write path", + }, + "flag_redis_write_content": { + LangZH: "Redis写入内容", + LangEN: "Redis write content", + }, + "flag_redis_write_file": { + LangZH: "Redis写入文件", + LangEN: "Redis write file", + }, + "flag_disable_brute": { + LangZH: "禁用暴力破解", + LangEN: "Disable brute force", + }, + "flag_max_retries": { + LangZH: "最大重试次数", + LangEN: "Maximum retries", + }, + "flag_output_file": { + LangZH: "输出文件", + LangEN: "Output file", + }, + "flag_output_format": { + LangZH: "输出格式: txt, json, csv", + LangEN: "Output format: txt, json, csv", + }, + "flag_disable_save": { + LangZH: "禁用结果保存", + LangEN: "Disable result saving", + }, + "flag_silent_mode": { + LangZH: "静默模式", + LangEN: "Silent mode", + }, + "flag_no_color": { + LangZH: "禁用颜色输出", + LangEN: "Disable color output", + }, + "flag_log_level": { + LangZH: "日志级别", + LangEN: "Log level", + }, + "flag_disable_progress": { + LangZH: "禁用进度条", + LangEN: "Disable progress bar", + }, + "flag_shellcode": { + LangZH: "Shellcode", + LangEN: "Shellcode", + }, + "flag_language": { + LangZH: "语言: zh, en", + LangEN: "Language: zh, en", + }, + "flag_help": { + LangZH: "显示帮助信息", + LangEN: "Show help information", + }, + "flag_version": { + LangZH: "显示版本信息", + LangEN: "Show version information", + }, +} \ No newline at end of file diff --git a/Common/i18n/messages/network.go b/Common/i18n/messages/network.go new file mode 100644 index 0000000..ee7c7e5 --- /dev/null +++ b/Common/i18n/messages/network.go @@ -0,0 +1,67 @@ +package messages + +/* +network.go - 网络相关消息 + +包含网络配置、代理设置、连接管理等相关的 +国际化消息定义。 +*/ + +// NetworkMessages 网络相关消息 +var NetworkMessages = map[string]map[string]string{ + // ========================= 网络配置消息 ========================= + "network_http_proxy": { + LangZH: "HTTP代理: %s", + LangEN: "HTTP proxy: %s", + }, + "network_socks5_proxy": { + LangZH: "Socks5代理: %s", + LangEN: "Socks5 proxy: %s", + }, + "network_timeout": { + LangZH: "连接超时: %v", + LangEN: "Connection timeout: %v", + }, + "network_web_timeout": { + LangZH: "Web超时: %v", + LangEN: "Web timeout: %v", + }, + + // ========================= 代理系统消息 ========================= + "proxy_init_start": { + LangZH: "初始化代理系统", + LangEN: "Initializing proxy system", + }, + "proxy_init_success": { + LangZH: "代理系统初始化成功", + LangEN: "Proxy system initialized successfully", + }, + "proxy_init_failed": { + LangZH: "初始化代理配置失败: %v", + LangEN: "Failed to initialize proxy configuration: %v", + }, + "proxy_config_sync_failed": { + LangZH: "代理配置同步失败: %v", + LangEN: "Failed to sync proxy configuration: %v", + }, + "proxy_enabled": { + LangZH: "代理已启用: %s %s", + LangEN: "Proxy enabled: %s %s", + }, + "proxy_disabled": { + LangZH: "代理已禁用", + LangEN: "Proxy disabled", + }, + "proxy_connection_failed": { + LangZH: "代理连接失败: %v", + LangEN: "Proxy connection failed: %v", + }, + "socks5_create_failed": { + LangZH: "创建SOCKS5连接失败: %v", + LangEN: "Failed to create SOCKS5 connection: %v", + }, + "tls_conn_failed": { + LangZH: "TLS连接失败: %v", + LangEN: "TLS connection failed: %v", + }, +} \ No newline at end of file diff --git a/Common/i18n/messages/output.go b/Common/i18n/messages/output.go new file mode 100644 index 0000000..c89a410 --- /dev/null +++ b/Common/i18n/messages/output.go @@ -0,0 +1,109 @@ +package messages + +/* +output.go - 输出相关消息 + +包含输出系统、文件保存、格式化等相关的 +国际化消息定义。 +*/ + +// OutputMessages 输出相关消息 +var OutputMessages = map[string]map[string]string{ + // ========================= 输出系统消息 ========================= + "output_init_start": { + LangZH: "初始化输出系统", + LangEN: "Initializing output system", + }, + "output_init_success": { + LangZH: "输出系统初始化成功", + LangEN: "Output system initialized successfully", + }, + "output_init_failed": { + LangZH: "输出系统初始化失败: %v", + LangEN: "Failed to initialize output system: %v", + }, + "output_format_invalid": { + LangZH: "无效的输出格式: %s", + LangEN: "Invalid output format: %s", + }, + "output_path_empty": { + LangZH: "输出路径为空", + LangEN: "Output path is empty", + }, + "output_not_init": { + LangZH: "输出系统未初始化", + LangEN: "Output system not initialized", + }, + "output_saving_result": { + LangZH: "保存扫描结果: %s -> %s", + LangEN: "Saving scan result: %s -> %s", + }, + "output_save_failed": { + LangZH: "保存结果失败: %v", + LangEN: "Failed to save result: %v", + }, + "output_closing": { + LangZH: "关闭输出系统", + LangEN: "Closing output system", + }, + "output_closed": { + LangZH: "输出系统已关闭", + LangEN: "Output system closed", + }, + "output_close_failed": { + LangZH: "关闭输出系统失败: %v", + LangEN: "Failed to close output system: %v", + }, + "output_config_nil": { + LangZH: "配置不能为空", + LangEN: "Configuration cannot be nil", + }, + "output_unsupported_format": { + LangZH: "不支持的输出格式: %s", + LangEN: "Unsupported output format: %s", + }, + "output_writer_init_failed": { + LangZH: "初始化写入器失败: %v", + LangEN: "Failed to initialize writer: %v", + }, + "output_writer_closed": { + LangZH: "写入器已关闭", + LangEN: "Writer is closed", + }, + "output_manager_not_init": { + LangZH: "输出管理器未初始化", + LangEN: "Output manager not initialized", + }, + "output_manager_closed": { + LangZH: "输出管理器已关闭", + LangEN: "Output manager is closed", + }, + "output_write_failed": { + LangZH: "写入结果失败: %v", + LangEN: "Failed to write result: %v", + }, + "output_flush_failed": { + LangZH: "刷新写入器失败: %v", + LangEN: "Failed to flush writer: %v", + }, + "output_create_file_failed": { + LangZH: "创建%s文件失败: %v", + LangEN: "Failed to create %s file: %v", + }, + "output_write_header_failed": { + LangZH: "写入CSV头部失败: %v", + LangEN: "Failed to write CSV header: %v", + }, + "output_open_file_failed": { + LangZH: "打开CSV文件失败: %v", + LangEN: "Failed to open CSV file: %v", + }, + "output_read_file_failed": { + LangZH: "读取CSV文件失败: %v", + LangEN: "Failed to read CSV file: %v", + }, + "output_parse_time_failed": { + LangZH: "无法解析时间: %s", + LangEN: "Failed to parse time: %s", + }, +} \ No newline at end of file diff --git a/Common/i18n/messages/parse.go b/Common/i18n/messages/parse.go new file mode 100644 index 0000000..246f364 --- /dev/null +++ b/Common/i18n/messages/parse.go @@ -0,0 +1,279 @@ +package messages + +/* +parse.go - 解析相关消息 + +包含参数解析、目标解析、凭据解析等相关的 +国际化消息定义。 +*/ + +// ParseMessages 解析相关消息 +var ParseMessages = map[string]map[string]string{ + // ========================= 解析错误消息 ========================= + "parse_error_empty_input": { + LangZH: "输入参数为空", + LangEN: "Input parameters are empty", + }, + "parse_error_config_failed": { + LangZH: "解析配置失败: %v", + LangEN: "Failed to parse configuration: %v", + }, + "parse_error_parser_not_init": { + LangZH: "解析器未初始化", + LangEN: "Parser not initialized", + }, + "parse_error_credential_failed": { + LangZH: "凭据解析失败: %v", + LangEN: "Failed to parse credentials: %v", + }, + "parse_error_target_failed": { + LangZH: "目标解析失败: %v", + LangEN: "Failed to parse targets: %v", + }, + "parse_error_network_failed": { + LangZH: "网络解析失败: %v", + LangEN: "Failed to parse network configuration: %v", + }, + "parse_error_validation_failed": { + LangZH: "验证失败: %v", + LangEN: "Validation failed: %v", + }, + "parse_error_update_vars_failed": { + LangZH: "更新全局变量失败: %v", + LangEN: "Failed to update global variables: %v", + }, + "parse_error_target_empty": { + LangZH: "目标输入为空", + LangEN: "Target input is empty", + }, + "parse_error_credential_empty": { + LangZH: "凭据输入为空", + LangEN: "Credential input is empty", + }, + "parse_error_network_empty": { + LangZH: "网络配置为空", + LangEN: "Network configuration is empty", + }, + "parse_error_invalid_ip": { + LangZH: "无效的IP地址: %s", + LangEN: "Invalid IP address: %s", + }, + "parse_error_invalid_port": { + LangZH: "无效的端口: %s", + LangEN: "Invalid port: %s", + }, + "parse_error_invalid_url": { + LangZH: "无效的URL: %s", + LangEN: "Invalid URL: %s", + }, + "parse_error_file_not_found": { + LangZH: "文件未找到: %s", + LangEN: "File not found: %s", + }, + "parse_error_file_read_failed": { + LangZH: "读取文件失败: %s", + LangEN: "Failed to read file: %s", + }, + + // ========================= 目标解析消息 ========================= + "target_parse_start": { + LangZH: "开始解析目标", + LangEN: "Starting target parsing", + }, + "target_parse_complete": { + LangZH: "目标解析完成", + LangEN: "Target parsing completed", + }, + "target_hosts_found": { + LangZH: "目标主机: %s", + LangEN: "Target hosts: %s", + }, + "target_hosts_count": { + LangZH: "目标主机: %s ... (共%d个)", + LangEN: "Target hosts: %s ... (total %d)", + }, + "target_urls_found": { + LangZH: "目标URL: %s", + LangEN: "Target URLs: %s", + }, + "target_urls_count": { + LangZH: "目标URL: %s ... (共%d个)", + LangEN: "Target URLs: %s ... (total %d)", + }, + "target_ports_found": { + LangZH: "扫描端口: %s", + LangEN: "Scan ports: %s", + }, + "target_ports_count": { + LangZH: "扫描端口: %s ... (共%d个)", + LangEN: "Scan ports: %s ... (total %d)", + }, + "target_exclude_ports": { + LangZH: "排除端口: %s", + LangEN: "Exclude ports: %s", + }, + "target_local_mode": { + LangZH: "本地扫描模式", + LangEN: "Local scan mode", + }, + + // ========================= 凭据相关消息 ========================= + "credential_username_count": { + LangZH: "用户名数量: %d", + LangEN: "Username count: %d", + }, + "credential_password_count": { + LangZH: "密码数量: %d", + LangEN: "Password count: %d", + }, + "credential_hash_count": { + LangZH: "Hash数量: %d", + LangEN: "Hash count: %d", + }, + + // ========================= Parsers包专用消息 ========================= + "parser_validation_input_empty": { + LangZH: "验证输入为空", + LangEN: "Validation input is empty", + }, + "parser_empty_input": { + LangZH: "输入参数为空", + LangEN: "Input parameters are empty", + }, + "parser_file_empty": { + LangZH: "文件名为空", + LangEN: "File name is empty", + }, + "parser_file_too_big": { + LangZH: "文件过大: %d bytes, 最大限制: %d bytes", + LangEN: "File too large: %d bytes, max limit: %d bytes", + }, + "parser_cannot_open_file": { + LangZH: "无法打开文件", + LangEN: "Cannot open file", + }, + "parser_file_not_exists": { + LangZH: "文件不存在或无法访问", + LangEN: "File does not exist or cannot be accessed", + }, + "parser_file_read_timeout": { + LangZH: "文件读取超时", + LangEN: "File read timeout", + }, + "parser_file_scan_failed": { + LangZH: "文件扫描失败", + LangEN: "File scan failed", + }, + "parser_username_too_long": { + LangZH: "用户名过长: %d字符,最大允许: %d", + LangEN: "Username too long: %d characters, max allowed: %d", + }, + "parser_username_invalid_chars": { + LangZH: "用户名包含非法字符", + LangEN: "Username contains invalid characters", + }, + "parser_password_empty": { + LangZH: "不允许空密码", + LangEN: "Empty passwords not allowed", + }, + "parser_password_too_long": { + LangZH: "密码过长: %d字符,最大允许: %d", + LangEN: "Password too long: %d characters, max allowed: %d", + }, + "parser_hash_empty": { + LangZH: "哈希值为空", + LangEN: "Hash value is empty", + }, + "parser_hash_invalid_format": { + LangZH: "哈希值格式无效,需要32位十六进制字符", + LangEN: "Invalid hash format, requires 32-character hexadecimal", + }, + "parser_proxy_url_invalid": { + LangZH: "代理URL格式无效: %v", + LangEN: "Invalid proxy URL format: %v", + }, + "parser_proxy_protocol_unsupported": { + LangZH: "不支持的代理协议: %s", + LangEN: "Unsupported proxy protocol: %s", + }, + "parser_proxy_host_empty": { + LangZH: "代理主机名为空", + LangEN: "Proxy hostname is empty", + }, + "parser_proxy_port_invalid": { + LangZH: "代理端口号无效: %s", + LangEN: "Invalid proxy port: %s", + }, + "parser_proxy_port_out_of_range": { + LangZH: "代理端口号超出范围: %d", + LangEN: "Proxy port out of range: %d", + }, + "parser_proxy_insecure": { + LangZH: "不允许使用不安全的HTTP代理", + LangEN: "Insecure HTTP proxy not allowed", + }, + "parser_user_agent_too_long": { + LangZH: "用户代理字符串过长", + LangEN: "User agent string too long", + }, + "parser_user_agent_invalid_chars": { + LangZH: "用户代理包含非法字符", + LangEN: "User agent contains invalid characters", + }, + "parser_cookie_too_long": { + LangZH: "Cookie字符串过长", + LangEN: "Cookie string too long", + }, + "parser_error_count_limit": { + LangZH: "错误数量过多,仅显示前%d个", + LangEN: "Too many errors, showing only first %d", + }, + "parser_no_scan_target": { + LangZH: "未指定任何扫描目标", + LangEN: "No scan targets specified", + }, + "parser_no_target_default": { + LangZH: "未指定扫描目标,将使用默认配置", + LangEN: "No scan targets specified, using default configuration", + }, + "parser_multiple_scan_modes": { + LangZH: "不能同时使用多种扫描模式", + LangEN: "Cannot use multiple scan modes simultaneously", + }, + "parser_proxy_ping_warning": { + LangZH: "使用代理时建议禁用Ping检测", + LangEN: "Recommend disabling Ping detection when using proxy", + }, + "parser_multiple_modes_conflict": { + LangZH: "不能同时指定多种扫描模式(主机扫描、URL扫描、本地模式)", + LangEN: "Cannot specify multiple scan modes (host scan, URL scan, local mode) simultaneously", + }, + "parser_proxy_ping_fail": { + LangZH: "代理模式下Ping检测可能失效", + LangEN: "Ping detection may fail in proxy mode", + }, + "parser_exclude_ports_invalid": { + LangZH: "排除端口无效", + LangEN: "Exclude ports invalid", + }, + "parser_many_targets_warning": { + LangZH: "大量目标(%d),可能耗时较长", + LangEN: "Large number of targets (%d), may take a long time", + }, + "parser_too_many_ports": { + LangZH: "端口数量过多", + LangEN: "Too many ports", + }, + "parser_timeout_too_short": { + LangZH: "超时过短", + LangEN: "Timeout too short", + }, + "parser_timeout_too_long": { + LangZH: "超时过长", + LangEN: "Timeout too long", + }, + "parser_invalid_scan_mode": { + LangZH: "无效的扫描模式: %s", + LangEN: "Invalid scan mode: %s", + }, +} \ No newline at end of file diff --git a/Common/i18n/messages/scan.go b/Common/i18n/messages/scan.go new file mode 100644 index 0000000..9c9aa81 --- /dev/null +++ b/Common/i18n/messages/scan.go @@ -0,0 +1,97 @@ +package messages + +/* +scan.go - 扫描相关消息 + +包含扫描流程、模式选择、插件管理等相关的 +国际化消息定义。 +*/ + +// ScanMessages 扫描相关消息 +var ScanMessages = map[string]map[string]string{ + // ========================= 扫描流程消息 ========================= + "scan_mode_service_selected": { + LangZH: "已选择服务扫描模式", + LangEN: "Service scan mode selected", + }, + "scan_mode_local_selected": { + LangZH: "已选择本地扫描模式", + LangEN: "Local scan mode selected", + }, + "scan_mode_web_selected": { + LangZH: "已选择Web扫描模式", + LangEN: "Web scan mode selected", + }, + "scan_info_start": { + LangZH: "开始信息扫描", + LangEN: "Starting information scan", + }, + "scan_host_start": { + LangZH: "开始主机扫描", + LangEN: "Starting host scan", + }, + "scan_vulnerability_start": { + LangZH: "开始漏洞扫描", + LangEN: "Starting vulnerability scan", + }, + "scan_no_service_plugins": { + LangZH: "未找到可用的服务插件", + LangEN: "No available service plugins found", + }, + "scan_vulnerability_plugins": { + LangZH: "使用漏洞扫描插件: %s", + LangEN: "Using vulnerability scan plugins: %s", + }, + "scan_no_vulnerability_plugins": { + LangZH: "未找到可用的漏洞扫描插件", + LangEN: "No available vulnerability scan plugins found", + }, + "scan_complete_ports_found": { + LangZH: "扫描完成, 发现 %d 个开放端口", + LangEN: "Scan completed, found %d open ports", + }, + "scan_alive_ports_count": { + LangZH: "存活端口数量: %d", + LangEN: "Alive ports count: %d", + }, + "scan_task_complete": { + LangZH: "扫描已完成: %d/%d", + LangEN: "Scan completed: %d/%d", + }, + + // ========================= 扫描错误消息 ========================= + "scan_plugin_panic": { + LangZH: "[PANIC] 插件 %s 扫描 %s:%s 时崩溃: %v", + LangEN: "[PANIC] Plugin %s crashed while scanning %s:%s: %v", + }, + "scan_plugin_not_found": { + LangZH: "扫描类型 %v 无对应插件,已跳过", + LangEN: "No plugin found for scan type %v, skipped", + }, + "scan_plugin_error": { + LangZH: "扫描错误 %v:%v - %v", + LangEN: "Scan error %v:%v - %v", + }, + + // ========================= 进度条消息 ========================= + "progress_scanning_description": { + LangZH: "扫描进度", + LangEN: "Scanning Progress", + }, + "progress_port_scanning": { + LangZH: "端口扫描", + LangEN: "Port Scanning", + }, + "progress_scan_completed": { + LangZH: "扫描完成:", + LangEN: "Scan Completed:", + }, + "progress_port_scan_completed": { + LangZH: "端口扫描完成:", + LangEN: "Port Scan Completed:", + }, + "progress_open_ports": { + LangZH: "开放端口", + LangEN: "Open Ports", + }, +} \ No newline at end of file