From 4b482b603d0a1095e1b839da18cc3adbe67750fb Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Fri, 8 Aug 2025 08:58:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DFTP=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E5=92=8C=E5=88=A9=E7=94=A8=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在Core/Registry.go中添加FTP插件导入,确保插件正确注册 - 完善FTP插件的i18n消息支持,添加完整的中英文消息 - 修复FTP利用器错误处理逻辑,改进错误报告机制 - 添加FTP测试环境docker-compose配置文件 修复后FTP插件支持: - 服务识别和版本检测 - 弱密码扫描和匿名登录检测 - 目录枚举、文件上传下载测试等利用功能 --- Common/i18n/messages/plugins.go | 70 +++++++++++++++++++++++++++++++ Core/Registry.go | 1 + Plugins/services/ftp/exploiter.go | 8 +--- TestDocker/FTP/docker-compose.yml | 16 +++++++ 4 files changed, 88 insertions(+), 7 deletions(-) create mode 100644 TestDocker/FTP/docker-compose.yml diff --git a/Common/i18n/messages/plugins.go b/Common/i18n/messages/plugins.go index 90602ba..0bb0e67 100644 --- a/Common/i18n/messages/plugins.go +++ b/Common/i18n/messages/plugins.go @@ -518,4 +518,74 @@ var PluginMessages = map[string]map[string]string{ LangZH: "配置转储", LangEN: "Configuration Dump", }, + + // ========================= FTP插件消息 ========================= + "ftp_scan_start": { + LangZH: "开始FTP扫描: %s", + LangEN: "Starting FTP scan: %s", + }, + "ftp_anonymous_success": { + LangZH: "FTP匿名访问: %s", + LangEN: "FTP anonymous access: %s", + }, + "ftp_weak_pwd_success": { + LangZH: "FTP弱密码: %s [%s:%s]", + LangEN: "FTP weak password: %s [%s:%s]", + }, + "ftp_service_identified": { + LangZH: "FTP服务识别成功: %s - %s", + LangEN: "FTP service identified: %s - %s", + }, + "ftp_connection_failed": { + LangZH: "FTP连接失败: %v", + LangEN: "FTP connection failed: %v", + }, + "ftp_auth_failed": { + LangZH: "FTP认证失败: %v", + LangEN: "FTP authentication failed: %v", + }, + + // FTP利用方法消息 + "ftp_exploit_dir_enum": { + LangZH: "FTP目录枚举成功", + LangEN: "FTP directory enumeration successful", + }, + "ftp_exploit_file_download": { + LangZH: "FTP文件下载测试成功", + LangEN: "FTP file download test successful", + }, + "ftp_exploit_file_upload": { + LangZH: "FTP文件上传测试成功", + LangEN: "FTP file upload test successful", + }, + "ftp_directory_found": { + LangZH: "发现FTP目录: %s", + LangEN: "FTP directories found: %s", + }, + "ftp_file_found": { + LangZH: "发现FTP文件: %s", + LangEN: "FTP files found: %s", + }, + "ftp_upload_success": { + LangZH: "FTP文件上传成功: %s", + LangEN: "FTP file upload successful: %s", + }, + "ftp_download_success": { + LangZH: "FTP文件下载成功: %s", + LangEN: "FTP file download successful: %s", + }, + + // FTP利用方法名称 + "exploit_method_name_directory_enumeration": { + LangZH: "目录枚举", + LangEN: "Directory Enumeration", + }, + "exploit_method_name_file_download_test": { + LangZH: "文件下载测试", + LangEN: "File Download Test", + }, + "exploit_method_name_file_upload_test": { + LangZH: "文件上传测试", + LangEN: "File Upload Test", + }, } \ No newline at end of file diff --git a/Core/Registry.go b/Core/Registry.go index 6cfc25a..ad37fe7 100644 --- a/Core/Registry.go +++ b/Core/Registry.go @@ -7,6 +7,7 @@ import ( // 导入新架构插件,触发自动注册 _ "github.com/shadow1ng/fscan/plugins/services/activemq" + _ "github.com/shadow1ng/fscan/plugins/services/ftp" _ "github.com/shadow1ng/fscan/plugins/services/mysql" _ "github.com/shadow1ng/fscan/plugins/services/redis" _ "github.com/shadow1ng/fscan/plugins/services/ssh" diff --git a/Plugins/services/ftp/exploiter.go b/Plugins/services/ftp/exploiter.go index add03c2..82f830e 100644 --- a/Plugins/services/ftp/exploiter.go +++ b/Plugins/services/ftp/exploiter.go @@ -97,13 +97,7 @@ func (e *FTPExploiter) executeWithConnection(ctx context.Context, info *common.H // 执行方法 output, err := method(ctx, ftpConn, target) if err != nil { - return &base.ExploitResult{ - Success: false, - Error: err, - Type: base.ExploitDataExtraction, - Method: methodName, - Output: fmt.Sprintf("执行失败: %v", err), - }, nil + return nil, fmt.Errorf("执行失败: %v", err) } return &base.ExploitResult{ diff --git a/TestDocker/FTP/docker-compose.yml b/TestDocker/FTP/docker-compose.yml new file mode 100644 index 0000000..461c1c4 --- /dev/null +++ b/TestDocker/FTP/docker-compose.yml @@ -0,0 +1,16 @@ +version: '3' +services: + ftp: + image: bogem/ftp + container_name: ftp-test + environment: + - FTP_USER=admin + - FTP_PASS=123456 + - PASV_ADDRESS=127.0.0.1 + - PASV_MIN_PORT=30000 + - PASV_MAX_PORT=30100 + ports: + - "21:21" + - "20:20" + - "30000-30100:30000-30100" + restart: unless-stopped \ No newline at end of file