Files
fscan/plugins/services/types.go
T
ZacharyZcR a1588a321f feat: SDK agent integration + UDP plugin framework + SNMP plugin
SDK enhancements for endpoint agent embedding:
- ScanWithController for pause/resume and live stats
- OnProgress callback for periodic progress reporting
- TaskID injection into every scan result
- ScanController with goroutine-safe pause/resume/stats
- Multi-target stats aggregation (race-free)

UDP plugin infrastructure:
- PluginTypeUDP registry with dedicated dispatch path
- DialUDP on ScanSession with rate limiting and packet counting
- UDP plugins bypass TCP port scan, probe targets directly
- FilterService excludes UDP plugins from TCP port matching

SNMP plugin (first UDP plugin):
- SNMPv2c GetRequest probe for sysDescr detection
- Community string brute force (public/private/community/etc)
- Pure stdlib implementation (encoding/asn1)
- Registered as safe default plugin on port 161/UDP

Tests: 95.7% SDK coverage, race-free, 50+ new test cases
2026-05-18 23:11:39 +08:00

36 lines
982 B
Go

package services
import (
"context"
"github.com/shadow1ng/fscan/common"
"github.com/shadow1ng/fscan/plugins"
)
// 插件接口定义 - 统一命名风格
type Plugin interface {
Name() string
Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult
}
type ScanResult = plugins.Result
type ExploitResult = plugins.ExploitResult
type Exploiter = plugins.Exploiter
type Credential = plugins.Credential
// RegisterPluginWithPorts 高效注册:直接传递端口信息,避免实例创建
func RegisterPluginWithPorts(name string, factory func() Plugin, ports []int) {
plugins.RegisterWithPorts(name, func() plugins.Plugin {
return factory()
}, ports)
}
// RegisterUDPPluginWithPorts 注册UDP协议插件
func RegisterUDPPluginWithPorts(name string, factory func() Plugin, ports []int) {
plugins.RegisterUDPWithPorts(name, func() plugins.Plugin {
return factory()
}, ports)
}
var GenerateCredentials = plugins.GenerateCredentials