fscan/core/Registry.go
ZacharyZcR da981cdbce refactor: 正确组织平台特定插件注册
- 将avdetect从跨平台插件移至Windows特有插件
- 将dcinfo从跨平台插件移至Windows特有插件
- 优化Registry.go插件分类和注释
- 确保平台特定功能在正确的registry文件中注册

插件分布:
- Registry.go: 真正跨平台的服务和本地插件
- registry_windows.go: Windows特有的系统功能和持久化插件
- registry_linux.go: Linux特有的持久化插件
2025-08-12 18:16:07 +08:00

101 lines
4.4 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 core
import (
"fmt"
"github.com/shadow1ng/fscan/common"
"github.com/shadow1ng/fscan/plugins/base"
// 导入跨平台服务插件(可在所有平台上运行)
_ "github.com/shadow1ng/fscan/plugins/services/activemq"
_ "github.com/shadow1ng/fscan/plugins/services/cassandra"
_ "github.com/shadow1ng/fscan/plugins/services/ftp"
_ "github.com/shadow1ng/fscan/plugins/services/imap"
_ "github.com/shadow1ng/fscan/plugins/services/kafka"
_ "github.com/shadow1ng/fscan/plugins/services/ldap"
_ "github.com/shadow1ng/fscan/plugins/services/memcached"
_ "github.com/shadow1ng/fscan/plugins/services/modbus"
_ "github.com/shadow1ng/fscan/plugins/services/mongodb"
_ "github.com/shadow1ng/fscan/plugins/services/mssql"
_ "github.com/shadow1ng/fscan/plugins/services/mysql"
_ "github.com/shadow1ng/fscan/plugins/services/neo4j"
_ "github.com/shadow1ng/fscan/plugins/services/oracle"
_ "github.com/shadow1ng/fscan/plugins/services/pop3"
_ "github.com/shadow1ng/fscan/plugins/services/postgresql"
_ "github.com/shadow1ng/fscan/plugins/services/rabbitmq"
_ "github.com/shadow1ng/fscan/plugins/services/redis"
_ "github.com/shadow1ng/fscan/plugins/services/rsync"
_ "github.com/shadow1ng/fscan/plugins/services/smtp"
_ "github.com/shadow1ng/fscan/plugins/services/snmp"
_ "github.com/shadow1ng/fscan/plugins/services/ssh"
_ "github.com/shadow1ng/fscan/plugins/services/telnet"
_ "github.com/shadow1ng/fscan/plugins/services/vnc"
// 导入跨平台Legacy插件
_ "github.com/shadow1ng/fscan/plugins/legacy/elasticsearch" // 跨平台服务
_ "github.com/shadow1ng/fscan/plugins/legacy/findnet" // 网络发现
_ "github.com/shadow1ng/fscan/plugins/legacy/ms17010" // Windows SMB漏洞但扫描器可跨平台
_ "github.com/shadow1ng/fscan/plugins/legacy/netbios" // NetBIOS协议主要Windows但可跨平台扫描
_ "github.com/shadow1ng/fscan/plugins/legacy/rdp" // RDP协议扫描可跨平台
_ "github.com/shadow1ng/fscan/plugins/legacy/smb" // SMB协议扫描可跨平台
_ "github.com/shadow1ng/fscan/plugins/legacy/smb2" // SMBv2协议扫描可跨平台
_ "github.com/shadow1ng/fscan/plugins/legacy/smbghost" // SMBGhost漏洞扫描可跨平台
// 导入Web插件适配器
_ "github.com/shadow1ng/fscan/plugins/legacy/webtitle"
_ "github.com/shadow1ng/fscan/plugins/legacy/webpoc"
// 导入跨平台本地插件(可在所有平台上运行)
_ "github.com/shadow1ng/fscan/plugins/local/cleaner" // 系统痕迹清理
_ "github.com/shadow1ng/fscan/plugins/local/downloader" // 文件下载
_ "github.com/shadow1ng/fscan/plugins/local/fileinfo" // 文件信息收集
_ "github.com/shadow1ng/fscan/plugins/local/forwardshell" // 正向Shell
_ "github.com/shadow1ng/fscan/plugins/local/keylogger" // 键盘记录主要Windows但支持跨平台
_ "github.com/shadow1ng/fscan/plugins/local/reverseshell" // 反弹Shell
_ "github.com/shadow1ng/fscan/plugins/local/socks5proxy" // SOCKS5代理
)
// =============================================================================
// 新一代插件注册系统 (New Architecture)
// 完全基于工厂模式和自动发现的现代化插件架构
// =============================================================================
// InitializePluginSystem 初始化插件系统
func InitializePluginSystem() error {
common.LogInfo("初始化新一代插件系统...")
// 统计已注册的插件
registeredPlugins := base.GlobalPluginRegistry.GetAll()
common.LogInfo(fmt.Sprintf("已注册插件数量: %d", len(registeredPlugins)))
// 显示已注册的插件列表
if len(registeredPlugins) > 0 {
common.LogInfo("已注册插件:")
for _, name := range registeredPlugins {
metadata := base.GlobalPluginRegistry.GetMetadata(name)
if metadata != nil {
common.LogInfo(fmt.Sprintf(" - %s v%s (%s)",
metadata.Name, metadata.Version, metadata.Category))
}
}
}
common.LogInfo("插件系统初始化完成")
return nil
}
// 已移除未使用的 GetAllPlugins 方法
// 已移除未使用的 GetPluginMetadata 方法
// 已移除未使用的 CreatePlugin 方法
// 已移除未使用的 GetPluginsByCategory 方法
// 已移除未使用的 GetPluginsByPort 方法
// init 自动初始化插件系统
func init() {
if err := InitializePluginSystem(); err != nil {
common.LogError("插件系统初始化失败: " + err.Error())
}
}