fix: 修复FTP插件注册和利用功能问题

- 在Core/Registry.go中添加FTP插件导入,确保插件正确注册
- 完善FTP插件的i18n消息支持,添加完整的中英文消息
- 修复FTP利用器错误处理逻辑,改进错误报告机制
- 添加FTP测试环境docker-compose配置文件

修复后FTP插件支持:
- 服务识别和版本检测
- 弱密码扫描和匿名登录检测
- 目录枚举、文件上传下载测试等利用功能
This commit is contained in:
ZacharyZcR 2025-08-08 08:58:36 +08:00
parent 83afd0f994
commit 4b482b603d
4 changed files with 88 additions and 7 deletions

View File

@ -518,4 +518,74 @@ var PluginMessages = map[string]map[string]string{
LangZH: "配置转储", LangZH: "配置转储",
LangEN: "Configuration Dump", 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",
},
} }

View File

@ -7,6 +7,7 @@ import (
// 导入新架构插件,触发自动注册 // 导入新架构插件,触发自动注册
_ "github.com/shadow1ng/fscan/plugins/services/activemq" _ "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/mysql"
_ "github.com/shadow1ng/fscan/plugins/services/redis" _ "github.com/shadow1ng/fscan/plugins/services/redis"
_ "github.com/shadow1ng/fscan/plugins/services/ssh" _ "github.com/shadow1ng/fscan/plugins/services/ssh"

View File

@ -97,13 +97,7 @@ func (e *FTPExploiter) executeWithConnection(ctx context.Context, info *common.H
// 执行方法 // 执行方法
output, err := method(ctx, ftpConn, target) output, err := method(ctx, ftpConn, target)
if err != nil { if err != nil {
return &base.ExploitResult{ return nil, fmt.Errorf("执行失败: %v", err)
Success: false,
Error: err,
Type: base.ExploitDataExtraction,
Method: methodName,
Output: fmt.Sprintf("执行失败: %v", err),
}, nil
} }
return &base.ExploitResult{ return &base.ExploitResult{

View File

@ -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