mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-09-14 14:06:44 +08:00

目录结构: - 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插件和本地插件整理预留空间 测试验证:✓ 所有功能正常
54 lines
1.6 KiB
Go
54 lines
1.6 KiB
Go
package smbghost
|
||
|
||
import (
|
||
"github.com/shadow1ng/fscan/adapters"
|
||
"github.com/shadow1ng/fscan/plugins/base"
|
||
Plugins "github.com/shadow1ng/fscan/plugins/legacy"
|
||
)
|
||
|
||
// NewSmbGhostPlugin 创建SMBGhost漏洞检测插件
|
||
func NewSmbGhostPlugin() base.Plugin {
|
||
// 插件元数据
|
||
metadata := &base.PluginMetadata{
|
||
Name: "smbghost",
|
||
Version: "1.0.0",
|
||
Author: "fscan-team",
|
||
Description: "SMBGhost (CVE-2020-0796) 远程代码执行漏洞检测",
|
||
Category: "vulnerability",
|
||
Ports: []int{445}, // SMB端口
|
||
Protocols: []string{"tcp"},
|
||
Tags: []string{"smb", "smbghost", "cve-2020-0796", "vulnerability"},
|
||
}
|
||
|
||
// 适配器选项
|
||
options := &adapters.LegacyPluginOptions{
|
||
CheckBruteFlag: false, // SMBGhost不依赖暴力破解标志
|
||
IsVulnPlugin: true, // 这是漏洞检测插件
|
||
IsInfoPlugin: false,
|
||
CustomPorts: []int{445}, // 固定使用SMB端口
|
||
}
|
||
|
||
// 创建适配器,直接使用老版本的SmbGhost函数
|
||
return adapters.NewLegacyPlugin(metadata, Plugins.SmbGhost, options)
|
||
}
|
||
|
||
// init 自动注册SmbGhost插件
|
||
func init() {
|
||
// 创建插件工厂
|
||
metadata := &base.PluginMetadata{
|
||
Name: "smbghost",
|
||
Version: "1.0.0",
|
||
Author: "fscan-team",
|
||
Description: "SMBGhost (CVE-2020-0796) 远程代码执行漏洞检测",
|
||
Category: "vulnerability",
|
||
Ports: []int{445},
|
||
Protocols: []string{"tcp"},
|
||
Tags: []string{"smb", "smbghost", "cve-2020-0796", "vulnerability"},
|
||
}
|
||
|
||
factory := base.NewSimplePluginFactory(metadata, func() base.Plugin {
|
||
return NewSmbGhostPlugin()
|
||
})
|
||
|
||
base.GlobalPluginRegistry.Register("smbghost", factory)
|
||
} |