fscan/adapters/legacy_plugins/smb2/plugin.go
ZacharyZcR f06bd3c1ac refactor: 最终整理插件目录结构,分离已迁移的老版本插件
目录结构:
- plugins/legacy/ - 存放已迁移到新架构的老版本插件
- adapters/legacy_plugins/ - 对应的适配器实现
- plugins/services/ - 新架构服务插件

已迁移的老版本插件:
- MS17010.go, MS17010-Exp.go - MS17010漏洞检测
- SmbGhost.go - SMBGhost漏洞检测
- SMB.go, SMB2.go - SMB服务检测
- RDP.go - RDP服务检测
- NetBIOS.go - NetBIOS信息收集
- Elasticsearch.go - Elasticsearch服务检测
- Base.go - 工具函数模块

架构特点:
- 老版本插件代码完全不变
- 通过适配器实现与新架构的桥接
- 清晰的职责分离和目录组织
- 为后续Web插件和本地插件整理预留空间

测试验证:✓ 所有功能正常
2025-08-09 16:29:21 +08:00

54 lines
1.6 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 smb2
import (
"github.com/shadow1ng/fscan/adapters"
"github.com/shadow1ng/fscan/plugins/base"
Plugins "github.com/shadow1ng/fscan/plugins/legacy"
)
// NewSmb2Plugin 创建SMB2弱密码检测插件
func NewSmb2Plugin() base.Plugin {
// 插件元数据
metadata := &base.PluginMetadata{
Name: "smb2",
Version: "1.0.0",
Author: "fscan-team",
Description: "SMB2服务弱密码检测和共享枚举 (支持NTLM哈希)",
Category: "service",
Ports: []int{445}, // SMB2端口
Protocols: []string{"tcp"},
Tags: []string{"smb2", "weak-password", "service", "brute-force", "ntlm"},
}
// 适配器选项
options := &adapters.LegacyPluginOptions{
CheckBruteFlag: true, // SMB2依赖暴力破解标志
IsVulnPlugin: false, // 这是服务检测插件,不是漏洞检测
IsInfoPlugin: true, // 包含信息收集功能
CustomPorts: []int{445}, // SMB2端口
}
// 创建适配器直接使用老版本的SmbScan2函数
return adapters.NewLegacyPlugin(metadata, Plugins.SmbScan2, options)
}
// init 自动注册SMB2插件
func init() {
// 创建插件工厂
metadata := &base.PluginMetadata{
Name: "smb2",
Version: "1.0.0",
Author: "fscan-team",
Description: "SMB2服务弱密码检测和共享枚举 (支持NTLM哈希)",
Category: "service",
Ports: []int{445},
Protocols: []string{"tcp"},
Tags: []string{"smb2", "weak-password", "service", "brute-force", "ntlm"},
}
factory := base.NewSimplePluginFactory(metadata, func() base.Plugin {
return NewSmb2Plugin()
})
base.GlobalPluginRegistry.Register("smb2", factory)
}