fscan/plugins/web/init.go
ZacharyZcR 8a79f3cf0f refactor: 简化Web插件系统并移除冗余代码
- 更新插件初始化器集成三个插件系统(Service、Web、Local)
- 清理WebPOC插件:移除重复端口检测和模拟漏洞数据
- 简化WebTitle插件:去除过度设计的WebInfo结构和技术检测
- 移除Web插件系统中的冗余辅助函数
- 统一插件接口实现,提升代码一致性
2025-08-26 16:30:46 +08:00

52 lines
1.1 KiB
Go

package web
import (
"context"
"sync"
"github.com/shadow1ng/fscan/common"
)
// WebPlugin Web扫描插件接口
type WebPlugin interface {
GetName() string
GetPorts() []int
Scan(ctx context.Context, info *common.HostInfo) *WebScanResult
}
// WebScanResult Web扫描结果
type WebScanResult struct {
Success bool
Title string // 网页标题
Status int // HTTP状态码
Server string // 服务器信息
Length int // 响应长度
VulInfo string // 漏洞信息(如果有)
Error error
}
// Web插件注册表
var (
webPluginRegistry = make(map[string]func() WebPlugin)
webPluginMutex sync.RWMutex
)
// RegisterWebPlugin 注册Web插件
func RegisterWebPlugin(name string, creator func() WebPlugin) {
webPluginMutex.Lock()
defer webPluginMutex.Unlock()
webPluginRegistry[name] = creator
}
// GetAllWebPlugins 获取所有已注册Web插件的名称
func GetAllWebPlugins() []string {
webPluginMutex.RLock()
defer webPluginMutex.RUnlock()
var plugins []string
for name := range webPluginRegistry {
plugins = append(plugins, name)
}
return plugins
}