refactor: 精准修复插件系统三个设计问题

经Linus式架构审计,发现并修复插件系统中的具体问题:

## 核心修复

### 1. 消除local插件GetPorts()方法冗余
- 删除21个local插件中无意义的GetPorts()方法
- 简化local.Plugin接口:移除端口概念
- 理由:本地插件不涉及网络,端口概念完全多余

### 2. 消除web插件GetPorts()方法冗余
- 删除2个web插件中无用的GetPorts()方法
- 简化web.WebPlugin接口:专注智能HTTP检测
- 理由:Web插件使用动态HTTP检测,预定义端口无价值

### 3. 统一插件命名规范
- 统一所有插件接口使用Name()方法(符合Go惯例)
- 消除GetName()与Name()不一致问题
- 简化适配器:不再需要方法名转换

## 技术改进

接口精简:
- local插件:GetName() + GetPorts() → Name()
- web插件:GetName() + GetPorts() → Name()
- services插件:GetName() → Name()(保留GetPorts(),业务必需)

代码减少:
- 删除23个无用GetPorts()方法
- 重命名52个Name()方法
- 简化3个插件接口定义

## 影响范围

修改文件:55个插件文件
代码变更:-155行 +61行(净减少94行)
功能影响:零破坏性,保持所有业务逻辑不变

这是基于业务需求分析的精准重构,消除真正多余的部分,
保持系统架构合理性和向后兼容性。
This commit is contained in:
ZacharyZcR 2025-08-26 20:38:39 +08:00
parent 120bd9f341
commit 8f54702c02
55 changed files with 61 additions and 155 deletions

View File

@ -50,14 +50,10 @@ func NewAVDetectPlugin() *AVDetectPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *AVDetectPlugin) GetName() string { func (p *AVDetectPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *AVDetectPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行AV/EDR检测 - 直接、有效 // Scan 执行AV/EDR检测 - 直接、有效
func (p *AVDetectPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *AVDetectPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -29,14 +29,10 @@ func NewCleanerPlugin() *CleanerPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *CleanerPlugin) GetName() string { func (p *CleanerPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *CleanerPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行系统痕迹清理 - 直接、简单 // Scan 执行系统痕迹清理 - 直接、简单
func (p *CleanerPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *CleanerPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -40,14 +40,10 @@ func NewCronTaskPlugin() *CronTaskPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *CronTaskPlugin) GetName() string { func (p *CronTaskPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *CronTaskPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行计划任务持久化 - 直接实现 // Scan 执行计划任务持久化 - 直接实现
func (p *CronTaskPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *CronTaskPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -39,14 +39,10 @@ func NewDCInfoPlugin() *DCInfoPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *DCInfoPlugin) GetName() string { func (p *DCInfoPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *DCInfoPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行域控信息收集 - 直接实现 // Scan 执行域控信息收集 - 直接实现
func (p *DCInfoPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *DCInfoPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -40,14 +40,10 @@ func NewDownloaderPlugin() *DownloaderPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *DownloaderPlugin) GetName() string { func (p *DownloaderPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *DownloaderPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行文件下载任务 - 直接实现 // Scan 执行文件下载任务 - 直接实现
func (p *DownloaderPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *DownloaderPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -28,14 +28,10 @@ func NewEnvInfoPlugin() *EnvInfoPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *EnvInfoPlugin) GetName() string { func (p *EnvInfoPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *EnvInfoPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行环境变量收集 - 直接、有效 // Scan 执行环境变量收集 - 直接、有效
func (p *EnvInfoPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *EnvInfoPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -30,14 +30,10 @@ func NewFileInfoPlugin() *FileInfoPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *FileInfoPlugin) GetName() string { func (p *FileInfoPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *FileInfoPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行本地文件扫描 - 直接、简单、有效 // Scan 执行本地文件扫描 - 直接、简单、有效
func (p *FileInfoPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *FileInfoPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -40,14 +40,10 @@ func NewForwardShellPlugin() *ForwardShellPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *ForwardShellPlugin) GetName() string { func (p *ForwardShellPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *ForwardShellPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行正向Shell服务 - 直接实现 // Scan 执行正向Shell服务 - 直接实现
func (p *ForwardShellPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *ForwardShellPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -43,14 +43,10 @@ func NewKeyloggerPlugin() *KeyloggerPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *KeyloggerPlugin) GetName() string { func (p *KeyloggerPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *KeyloggerPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行键盘记录 - 直接实现 // Scan 执行键盘记录 - 直接实现
func (p *KeyloggerPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *KeyloggerPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -39,14 +39,10 @@ func NewLDPreloadPlugin() *LDPreloadPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *LDPreloadPlugin) GetName() string { func (p *LDPreloadPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *LDPreloadPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行LD_PRELOAD持久化 - 直接实现 // Scan 执行LD_PRELOAD持久化 - 直接实现
func (p *LDPreloadPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *LDPreloadPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -82,14 +82,10 @@ func NewMiniDumpPlugin() *MiniDumpPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *MiniDumpPlugin) GetName() string { func (p *MiniDumpPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *MiniDumpPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行内存转储 - 直接实现 // Scan 执行内存转储 - 直接实现
func (p *MiniDumpPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *MiniDumpPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -56,14 +56,10 @@ func NewReverseShellPlugin() *ReverseShellPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *ReverseShellPlugin) GetName() string { func (p *ReverseShellPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *ReverseShellPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行反弹Shell - 直接实现 // Scan 执行反弹Shell - 直接实现
func (p *ReverseShellPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *ReverseShellPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -39,14 +39,10 @@ func NewShellEnvPlugin() *ShellEnvPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *ShellEnvPlugin) GetName() string { func (p *ShellEnvPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *ShellEnvPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行Shell环境变量持久化 - 直接实现 // Scan 执行Shell环境变量持久化 - 直接实现
func (p *ShellEnvPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *ShellEnvPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -39,14 +39,10 @@ func NewSocks5ProxyPlugin() *Socks5ProxyPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *Socks5ProxyPlugin) GetName() string { func (p *Socks5ProxyPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *Socks5ProxyPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行SOCKS5代理扫描 - 直接实现 // Scan 执行SOCKS5代理扫描 - 直接实现
func (p *Socks5ProxyPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *Socks5ProxyPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -39,14 +39,10 @@ func NewSystemdServicePlugin() *SystemdServicePlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *SystemdServicePlugin) GetName() string { func (p *SystemdServicePlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *SystemdServicePlugin) GetPorts() []int {
return []int{}
}
// Scan 执行系统服务持久化 - 直接实现 // Scan 执行系统服务持久化 - 直接实现
func (p *SystemdServicePlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *SystemdServicePlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -30,14 +30,10 @@ func NewSystemInfoPlugin() *SystemInfoPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *SystemInfoPlugin) GetName() string { func (p *SystemInfoPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *SystemInfoPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行系统信息收集 - 直接、简单、有效 // Scan 执行系统信息收集 - 直接、简单、有效
func (p *SystemInfoPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *SystemInfoPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -9,10 +9,9 @@ import (
"github.com/shadow1ng/fscan/plugins" "github.com/shadow1ng/fscan/plugins"
) )
// 向后兼容的类型别名 // 本地插件接口 - 不需要端口概念
type Plugin interface { type Plugin interface {
GetName() string Name() string
GetPorts() []int
Scan(ctx context.Context, info *common.HostInfo) *ScanResult Scan(ctx context.Context, info *common.HostInfo) *ScanResult
} }
@ -40,7 +39,7 @@ type localPluginAdapter struct {
} }
func (a *localPluginAdapter) Name() string { func (a *localPluginAdapter) Name() string {
return a.localPlugin.GetName() return a.localPlugin.Name()
} }
func (a *localPluginAdapter) Scan(ctx context.Context, info *common.HostInfo) *plugins.Result { func (a *localPluginAdapter) Scan(ctx context.Context, info *common.HostInfo) *plugins.Result {

View File

@ -38,14 +38,10 @@ func NewWinRegistryPlugin() *WinRegistryPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *WinRegistryPlugin) GetName() string { func (p *WinRegistryPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *WinRegistryPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行Windows注册表持久化 - 直接实现 // Scan 执行Windows注册表持久化 - 直接实现
func (p *WinRegistryPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *WinRegistryPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -38,14 +38,10 @@ func NewWinSchTaskPlugin() *WinSchTaskPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *WinSchTaskPlugin) GetName() string { func (p *WinSchTaskPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *WinSchTaskPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行Windows计划任务持久化 - 直接实现 // Scan 执行Windows计划任务持久化 - 直接实现
func (p *WinSchTaskPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *WinSchTaskPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -38,14 +38,10 @@ func NewWinServicePlugin() *WinServicePlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *WinServicePlugin) GetName() string { func (p *WinServicePlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *WinServicePlugin) GetPorts() []int {
return []int{}
}
// Scan 执行Windows服务持久化 - 直接实现 // Scan 执行Windows服务持久化 - 直接实现
func (p *WinServicePlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *WinServicePlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -38,14 +38,10 @@ func NewWinStartupPlugin() *WinStartupPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *WinStartupPlugin) GetName() string { func (p *WinStartupPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *WinStartupPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行Windows启动文件夹持久化 - 直接实现 // Scan 执行Windows启动文件夹持久化 - 直接实现
func (p *WinStartupPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *WinStartupPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -38,14 +38,10 @@ func NewWinWMIPlugin() *WinWMIPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *WinWMIPlugin) GetName() string { func (p *WinWMIPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - local插件不需要端口
func (p *WinWMIPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行Windows WMI事件订阅持久化 - 直接实现 // Scan 执行Windows WMI事件订阅持久化 - 直接实现
func (p *WinWMIPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult { func (p *WinWMIPlugin) Scan(ctx context.Context, info *common.HostInfo) *ScanResult {

View File

@ -22,7 +22,7 @@ func NewActiveMQPlugin() *ActiveMQPlugin {
} }
} }
func (p *ActiveMQPlugin) GetName() string { func (p *ActiveMQPlugin) Name() string {
return p.name return p.name
} }

View File

@ -23,7 +23,7 @@ func NewCassandraPlugin() *CassandraPlugin {
} }
} }
func (p *CassandraPlugin) GetName() string { func (p *CassandraPlugin) Name() string {
return p.name return p.name
} }

View File

@ -25,7 +25,7 @@ func NewElasticsearchPlugin() *ElasticsearchPlugin {
} }
} }
func (p *ElasticsearchPlugin) GetName() string { func (p *ElasticsearchPlugin) Name() string {
return p.name return p.name
} }

View File

@ -30,7 +30,7 @@ func NewFindNetPlugin() *FindNetPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *FindNetPlugin) GetName() string { func (p *FindNetPlugin) Name() string {
return p.name return p.name
} }

View File

@ -21,7 +21,7 @@ func NewFTPPlugin() *FTPPlugin {
} }
} }
func (p *FTPPlugin) GetName() string { func (p *FTPPlugin) Name() string {
return p.name return p.name
} }

View File

@ -21,7 +21,7 @@ func NewKafkaPlugin() *KafkaPlugin {
} }
} }
func (p *KafkaPlugin) GetName() string { func (p *KafkaPlugin) Name() string {
return p.name return p.name
} }

View File

@ -20,7 +20,7 @@ func NewLDAPPlugin() *LDAPPlugin {
} }
} }
func (p *LDAPPlugin) GetName() string { func (p *LDAPPlugin) Name() string {
return p.name return p.name
} }

View File

@ -22,7 +22,7 @@ func NewMemcachedPlugin() *MemcachedPlugin {
} }
} }
func (p *MemcachedPlugin) GetName() string { func (p *MemcachedPlugin) Name() string {
return p.name return p.name
} }

View File

@ -22,7 +22,7 @@ func NewMongoDBPlugin() *MongoDBPlugin {
} }
} }
func (p *MongoDBPlugin) GetName() string { func (p *MongoDBPlugin) Name() string {
return p.name return p.name
} }

View File

@ -31,7 +31,7 @@ func NewMS17010Plugin() *MS17010Plugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *MS17010Plugin) GetName() string { func (p *MS17010Plugin) Name() string {
return p.name return p.name
} }

View File

@ -23,7 +23,7 @@ func NewMSSQLPlugin() *MSSQLPlugin {
} }
} }
func (p *MSSQLPlugin) GetName() string { func (p *MSSQLPlugin) Name() string {
return p.name return p.name
} }

View File

@ -23,7 +23,7 @@ func NewMySQLPlugin() *MySQLPlugin {
} }
} }
func (p *MySQLPlugin) GetName() string { func (p *MySQLPlugin) Name() string {
return p.name return p.name
} }

View File

@ -23,7 +23,7 @@ func NewNeo4jPlugin() *Neo4jPlugin {
} }
} }
func (p *Neo4jPlugin) GetName() string { func (p *Neo4jPlugin) Name() string {
return p.name return p.name
} }

View File

@ -26,7 +26,7 @@ func NewNetBIOSPlugin() *NetBIOSPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *NetBIOSPlugin) GetName() string { func (p *NetBIOSPlugin) Name() string {
return p.name return p.name
} }

View File

@ -19,7 +19,7 @@ func NewOraclePlugin() *OraclePlugin {
} }
} }
func (p *OraclePlugin) GetName() string { func (p *OraclePlugin) Name() string {
return p.name return p.name
} }

View File

@ -23,7 +23,7 @@ func NewPostgreSQLPlugin() *PostgreSQLPlugin {
} }
} }
func (p *PostgreSQLPlugin) GetName() string { func (p *PostgreSQLPlugin) Name() string {
return p.name return p.name
} }

View File

@ -23,7 +23,7 @@ func NewRabbitMQPlugin() *RabbitMQPlugin {
} }
} }
func (p *RabbitMQPlugin) GetName() string { func (p *RabbitMQPlugin) Name() string {
return p.name return p.name
} }

View File

@ -25,7 +25,7 @@ func NewRDPPlugin() *RDPPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *RDPPlugin) GetName() string { func (p *RDPPlugin) Name() string {
return p.name return p.name
} }

View File

@ -27,7 +27,7 @@ func NewRedisPlugin() *RedisPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *RedisPlugin) GetName() string { func (p *RedisPlugin) Name() string {
return p.name return p.name
} }

View File

@ -23,7 +23,7 @@ func NewRsyncPlugin() *RsyncPlugin {
} }
} }
func (p *RsyncPlugin) GetName() string { func (p *RsyncPlugin) Name() string {
return p.name return p.name
} }

View File

@ -24,7 +24,7 @@ func NewSmbPlugin() *SmbPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *SmbPlugin) GetName() string { func (p *SmbPlugin) Name() string {
return p.name return p.name
} }

View File

@ -24,7 +24,7 @@ func NewSmb2Plugin() *Smb2Plugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *Smb2Plugin) GetName() string { func (p *Smb2Plugin) Name() string {
return p.name return p.name
} }

View File

@ -110,7 +110,7 @@ func NewSmbGhostPlugin() *SmbGhostPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *SmbGhostPlugin) GetName() string { func (p *SmbGhostPlugin) Name() string {
return p.name return p.name
} }

View File

@ -27,7 +27,7 @@ func NewSMBInfoPlugin() *SMBInfoPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *SMBInfoPlugin) GetName() string { func (p *SMBInfoPlugin) Name() string {
return p.name return p.name
} }

View File

@ -24,7 +24,7 @@ func NewSMTPPlugin() *SMTPPlugin {
} }
} }
func (p *SMTPPlugin) GetName() string { func (p *SMTPPlugin) Name() string {
return p.name return p.name
} }

View File

@ -22,7 +22,7 @@ func NewSNMPPlugin() *SNMPPlugin {
} }
} }
func (p *SNMPPlugin) GetName() string { func (p *SNMPPlugin) Name() string {
return p.name return p.name
} }

View File

@ -29,7 +29,7 @@ func NewSSHPlugin() *SSHPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *SSHPlugin) GetName() string { func (p *SSHPlugin) Name() string {
return p.name return p.name
} }

View File

@ -22,7 +22,7 @@ func NewTelnetPlugin() *TelnetPlugin {
} }
} }
func (p *TelnetPlugin) GetName() string { func (p *TelnetPlugin) Name() string {
return p.name return p.name
} }

View File

@ -7,9 +7,9 @@ import (
"github.com/shadow1ng/fscan/plugins" "github.com/shadow1ng/fscan/plugins"
) )
// 插件接口定义 // 插件接口定义 - 统一命名风格
type Plugin interface { type Plugin interface {
GetName() string Name() string
GetPorts() []int GetPorts() []int
Scan(ctx context.Context, info *common.HostInfo) *ScanResult Scan(ctx context.Context, info *common.HostInfo) *ScanResult
} }
@ -43,7 +43,7 @@ type servicePluginAdapter struct {
} }
func (a *servicePluginAdapter) Name() string { func (a *servicePluginAdapter) Name() string {
return a.servicePlugin.GetName() return a.servicePlugin.Name()
} }
func (a *servicePluginAdapter) Scan(ctx context.Context, info *common.HostInfo) *plugins.Result { func (a *servicePluginAdapter) Scan(ctx context.Context, info *common.HostInfo) *plugins.Result {

View File

@ -24,7 +24,7 @@ func NewVNCPlugin() *VNCPlugin {
} }
} }
func (p *VNCPlugin) GetName() string { func (p *VNCPlugin) Name() string {
return p.name return p.name
} }

View File

@ -7,10 +7,9 @@ import (
"github.com/shadow1ng/fscan/plugins" "github.com/shadow1ng/fscan/plugins"
) )
// 向后兼容的类型别名 // Web插件接口 - 使用智能HTTP检测不需要预定义端口
type WebPlugin interface { type WebPlugin interface {
GetName() string Name() string
GetPorts() []int
Scan(ctx context.Context, info *common.HostInfo) *WebScanResult Scan(ctx context.Context, info *common.HostInfo) *WebScanResult
} }
@ -33,7 +32,7 @@ type webPluginAdapter struct {
} }
func (a *webPluginAdapter) Name() string { func (a *webPluginAdapter) Name() string {
return a.webPlugin.GetName() return a.webPlugin.Name()
} }
func (a *webPluginAdapter) Scan(ctx context.Context, info *common.HostInfo) *plugins.Result { func (a *webPluginAdapter) Scan(ctx context.Context, info *common.HostInfo) *plugins.Result {

View File

@ -21,14 +21,10 @@ func NewWebPocPlugin() *WebPocPlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *WebPocPlugin) GetName() string { func (p *WebPocPlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - Web插件不需要预定义端口依赖全局检测器
func (p *WebPocPlugin) GetPorts() []int {
return []int{}
}
// Scan 执行Web POC扫描 // Scan 执行Web POC扫描
func (p *WebPocPlugin) Scan(ctx context.Context, info *common.HostInfo) *WebScanResult { func (p *WebPocPlugin) Scan(ctx context.Context, info *common.HostInfo) *WebScanResult {

View File

@ -27,14 +27,10 @@ func NewWebTitlePlugin() *WebTitlePlugin {
} }
// GetName 实现Plugin接口 // GetName 实现Plugin接口
func (p *WebTitlePlugin) GetName() string { func (p *WebTitlePlugin) Name() string {
return p.name return p.name
} }
// GetPorts 实现Plugin接口 - Web插件不需要预定义端口
func (p *WebTitlePlugin) GetPorts() []int {
return []int{}
}
// Scan 执行WebTitle扫描 // Scan 执行WebTitle扫描
func (p *WebTitlePlugin) Scan(ctx context.Context, info *common.HostInfo) *WebScanResult { func (p *WebTitlePlugin) Scan(ctx context.Context, info *common.HostInfo) *WebScanResult {