package elasticsearch import ( "github.com/shadow1ng/fscan/plugins/adapters" "github.com/shadow1ng/fscan/plugins/base" LegacyPlugins "github.com/shadow1ng/fscan/plugins/legacy" ) // 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 := &adapters.LegacyPluginOptions{ CheckBruteFlag: true, // Elasticsearch依赖暴力破解标志 IsVulnPlugin: false, // 这是服务检测插件,虽然包含安全检查 IsInfoPlugin: true, // 包含信息收集功能 CustomPorts: []int{9200, 9300}, // Elasticsearch端口 } // 创建适配器,直接使用老版本的ElasticScan函数 return adapters.NewLegacyPlugin(metadata, LegacyPlugins.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) }