fscan/Plugins/legacy/elasticsearch/plugin.go
ZacharyZcR d57e5d519d feat: 实现老版本插件适配器架构,无缝接入新插件系统
核心改进:
- 创建LegacyPlugin适配器基础框架,支持老版本插件接入新架构
- 实现适配器模式,保持老版本插件代码完全不变
- 支持不同类型插件的能力配置(漏洞检测、信息收集、服务检测)

已适配插件:
- MS17010: SMB远程代码执行漏洞检测 (EternalBlue)
- SmbGhost: CVE-2020-0796 远程代码执行漏洞检测
- SMB/SMB2: SMB服务弱密码检测和共享枚举
- RDP: 远程桌面服务弱密码检测
- NetBIOS: 信息收集和主机名解析
- Elasticsearch: 弱密码检测和未授权访问检测

技术特点:
- 零代码修改:老版本插件完全不需要修改
- 完整接口实现:适配Plugin、Scanner、Exploiter接口
- 灵活配置:支持暴力破解标志检查、插件类型配置
- 统一管理:通过新的插件注册表统一管理所有插件

测试验证:✓ 所有适配器插件正常工作,与新架构完美集成
2025-08-09 16:15:55 +08:00

54 lines
1.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package elasticsearch
import (
"github.com/shadow1ng/fscan/plugins/adapter"
"github.com/shadow1ng/fscan/plugins/base"
Plugins "github.com/shadow1ng/fscan/plugins"
)
// NewElasticsearchPlugin 创建Elasticsearch弱密码检测插件
func NewElasticsearchPlugin() base.Plugin {
// 插件元数据
metadata := &base.PluginMetadata{
Name: "elasticsearch",
Version: "1.0.0",
Author: "fscan-team",
Description: "Elasticsearch搜索引擎弱密码检测和未授权访问检测",
Category: "service",
Ports: []int{9200, 9300}, // Elasticsearch端口
Protocols: []string{"tcp"},
Tags: []string{"elasticsearch", "weak-password", "unauthorized", "service"},
}
// 适配器选项
options := &adapter.LegacyPluginOptions{
CheckBruteFlag: true, // Elasticsearch依赖暴力破解标志
IsVulnPlugin: false, // 这是服务检测插件,虽然包含安全检查
IsInfoPlugin: true, // 包含信息收集功能
CustomPorts: []int{9200, 9300}, // Elasticsearch端口
}
// 创建适配器直接使用老版本的ElasticScan函数
return adapter.NewLegacyPlugin(metadata, Plugins.ElasticScan, options)
}
// init 自动注册Elasticsearch插件
func init() {
// 创建插件工厂
metadata := &base.PluginMetadata{
Name: "elasticsearch",
Version: "1.0.0",
Author: "fscan-team",
Description: "Elasticsearch搜索引擎弱密码检测和未授权访问检测",
Category: "service",
Ports: []int{9200, 9300},
Protocols: []string{"tcp"},
Tags: []string{"elasticsearch", "weak-password", "unauthorized", "service"},
}
factory := base.NewSimplePluginFactory(metadata, func() base.Plugin {
return NewElasticsearchPlugin()
})
base.GlobalPluginRegistry.Register("elasticsearch", factory)
}