mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-24 20:21:52 +08:00
refactor: 引入 ScanSession,替代全局状态穿透扫描管道 (Phase 1-3)
- 新增 common/session.go: ScanSession 结构体封装 Config/State/Params/Dialer - RunScan/Strategy/ExecuteScanTasks/executeScanTask 全部接收 session - Plugin 接口从 Scan(ctx, info, config, state) 改为 Scan(ctx, info, session) - 48 个插件实现统一更新签名 - Web API 构建 ScanSession 传给 RunScan - CLI 模式通过 Initialize() 创建 session
This commit is contained in:
+2
-2
@@ -11,7 +11,7 @@ import (
|
||||
// Plugin 统一插件接口
|
||||
type Plugin interface {
|
||||
Name() string
|
||||
Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *Result
|
||||
Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *Result
|
||||
}
|
||||
|
||||
// BasePlugin 基础插件结构,提供通用的name字段
|
||||
@@ -62,7 +62,7 @@ type Result struct {
|
||||
|
||||
// Exploiter 利用接口
|
||||
type Exploiter interface {
|
||||
Exploit(ctx context.Context, info *common.HostInfo, creds Credential, config *common.Config) *ExploitResult
|
||||
Exploit(ctx context.Context, info *common.HostInfo, creds Credential, session *common.ScanSession) *ExploitResult
|
||||
}
|
||||
|
||||
// ExploitResult 利用结果
|
||||
|
||||
@@ -53,7 +53,7 @@ func NewAVDetectPlugin() *AVDetectPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行AV/EDR检测 - 直接、有效
|
||||
func (p *AVDetectPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *AVDetectPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
var output strings.Builder
|
||||
var detectedAVs []string
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ func NewCleanerPlugin() *CleanerPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行系统痕迹清理 - 直接、简单
|
||||
func (p *CleanerPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *CleanerPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
var output strings.Builder
|
||||
var filesCleared, dirsCleared, sysCleared int
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ func NewCronTaskPlugin() *CronTaskPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行计划任务持久化 - 直接实现
|
||||
func (p *CronTaskPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *CronTaskPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
var output strings.Builder
|
||||
|
||||
if runtime.GOOS != "linux" {
|
||||
|
||||
@@ -41,7 +41,9 @@ func NewDCInfoPlugin() *DCInfoPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行域控信息收集 - 直接实现
|
||||
func (p *DCInfoPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *DCInfoPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
var output strings.Builder
|
||||
|
||||
output.WriteString("=== 域控制器信息收集 ===\n")
|
||||
|
||||
@@ -35,7 +35,8 @@ func NewDownloaderPlugin() *DownloaderPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行文件下载任务 - 直接实现
|
||||
func (p *DownloaderPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *DownloaderPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
var output strings.Builder
|
||||
|
||||
// 从config获取配置
|
||||
|
||||
@@ -30,7 +30,7 @@ func NewEnvInfoPlugin() *EnvInfoPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行环境变量收集 - 直接、有效
|
||||
func (p *EnvInfoPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *EnvInfoPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
var output strings.Builder
|
||||
var sensitiveVars []string
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ func NewFileInfoPlugin() *FileInfoPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行本地文件扫描 - 直接、简单、有效
|
||||
func (p *FileInfoPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *FileInfoPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
var foundFiles []string
|
||||
|
||||
// 扫描关键敏感文件位置 - 删除复杂的配置系统
|
||||
|
||||
@@ -37,7 +37,9 @@ func NewForwardShellPlugin() *ForwardShellPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行正向Shell服务 - 直接实现
|
||||
func (p *ForwardShellPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *ForwardShellPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
var output strings.Builder
|
||||
|
||||
// 从config获取配置
|
||||
|
||||
@@ -36,7 +36,8 @@ func NewKeyloggerPlugin() *KeyloggerPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行键盘记录 - 直接实现
|
||||
func (p *KeyloggerPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *KeyloggerPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
var output strings.Builder
|
||||
|
||||
// 从config获取配置
|
||||
|
||||
@@ -33,7 +33,8 @@ func NewLDPreloadPlugin() *LDPreloadPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行LD_PRELOAD持久化 - 直接实现
|
||||
func (p *LDPreloadPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *LDPreloadPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
var output strings.Builder
|
||||
|
||||
if runtime.GOOS != "linux" {
|
||||
|
||||
@@ -83,7 +83,9 @@ func NewMiniDumpPlugin() *MiniDumpPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行内存转储 - 直接实现
|
||||
func (p *MiniDumpPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *MiniDumpPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
common.LogError(i18n.Tr("minidump_panic", r))
|
||||
|
||||
@@ -40,7 +40,9 @@ func NewReverseShellPlugin() *ReverseShellPlugin {
|
||||
// GetName 实现Plugin接口
|
||||
|
||||
// Scan 执行反弹Shell - 直接实现
|
||||
func (p *ReverseShellPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *ReverseShellPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
var output strings.Builder
|
||||
|
||||
// 从config获取配置
|
||||
|
||||
@@ -33,7 +33,8 @@ func NewShellEnvPlugin() *ShellEnvPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行Shell环境变量持久化 - 直接实现
|
||||
func (p *ShellEnvPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *ShellEnvPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
var output strings.Builder
|
||||
|
||||
if runtime.GOOS != "linux" {
|
||||
|
||||
@@ -36,7 +36,9 @@ func NewSocks5ProxyPlugin() *Socks5ProxyPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行SOCKS5代理扫描 - 直接实现
|
||||
func (p *Socks5ProxyPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *Socks5ProxyPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
var output strings.Builder
|
||||
|
||||
// 从config获取配置
|
||||
|
||||
@@ -33,7 +33,8 @@ func NewSystemdServicePlugin() *SystemdServicePlugin {
|
||||
}
|
||||
|
||||
// Scan 执行系统服务持久化 - 直接实现
|
||||
func (p *SystemdServicePlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *SystemdServicePlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
var output strings.Builder
|
||||
|
||||
if runtime.GOOS != "linux" {
|
||||
|
||||
@@ -33,7 +33,7 @@ func NewSystemInfoPlugin() *SystemInfoPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行系统信息收集 - 直接、简单、有效
|
||||
func (p *SystemInfoPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *SystemInfoPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
var output strings.Builder
|
||||
|
||||
output.WriteString("=== 系统信息收集 ===\n")
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
// Plugin 本地插件接口 - 不需要端口概念
|
||||
type Plugin interface {
|
||||
Name() string
|
||||
Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result
|
||||
Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result
|
||||
}
|
||||
|
||||
// RegisterLocalPlugin 注册本地插件 - 自动标记local类型
|
||||
|
||||
@@ -32,7 +32,9 @@ func NewWinRegistryPlugin() *WinRegistryPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行Windows注册表持久化 - 直接实现
|
||||
func (p *WinRegistryPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *WinRegistryPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
var output strings.Builder
|
||||
|
||||
if runtime.GOOS != "windows" {
|
||||
|
||||
@@ -33,7 +33,9 @@ func NewWinSchTaskPlugin() *WinSchTaskPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行Windows计划任务持久化 - 直接实现
|
||||
func (p *WinSchTaskPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *WinSchTaskPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
var output strings.Builder
|
||||
|
||||
// 从config获取配置
|
||||
|
||||
@@ -33,7 +33,9 @@ func NewWinServicePlugin() *WinServicePlugin {
|
||||
}
|
||||
|
||||
// Scan 执行Windows服务持久化 - 直接实现
|
||||
func (p *WinServicePlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *WinServicePlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
var output strings.Builder
|
||||
|
||||
// 从config获取配置
|
||||
|
||||
@@ -33,7 +33,9 @@ func NewWinStartupPlugin() *WinStartupPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行Windows启动文件夹持久化 - 直接实现
|
||||
func (p *WinStartupPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *WinStartupPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
var output strings.Builder
|
||||
|
||||
// 从config获取配置
|
||||
|
||||
@@ -33,7 +33,9 @@ func NewWinWMIPlugin() *WinWMIPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行Windows WMI事件订阅持久化 - 直接实现
|
||||
func (p *WinWMIPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *WinWMIPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
var output strings.Builder
|
||||
|
||||
// 从config获取配置
|
||||
|
||||
@@ -25,7 +25,9 @@ func NewActiveMQPlugin() *ActiveMQPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *ActiveMQPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *ActiveMQPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
if config.DisableBrute {
|
||||
|
||||
@@ -24,7 +24,9 @@ func NewCassandraPlugin() *CassandraPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *CassandraPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *CassandraPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
if config.DisableBrute {
|
||||
|
||||
@@ -25,7 +25,9 @@ func NewElasticsearchPlugin() *ElasticsearchPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *ElasticsearchPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *ElasticsearchPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
if config.DisableBrute {
|
||||
|
||||
@@ -36,7 +36,9 @@ func NewFindNetPlugin() *FindNetPlugin {
|
||||
// GetPorts 实现Plugin接口
|
||||
|
||||
// Scan 执行FindNet扫描 - Windows网络信息收集
|
||||
func (p *FindNetPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *FindNetPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
// 检查是否为RPC端口
|
||||
|
||||
@@ -24,7 +24,9 @@ func NewFTPPlugin() *FTPPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *FTPPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *FTPPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
if config.DisableBrute {
|
||||
return p.identifyService(info, config, state)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,9 @@ func NewKafkaPlugin() *KafkaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *KafkaPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *KafkaPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
if config.DisableBrute {
|
||||
return p.identifyService(ctx, info, config, state)
|
||||
}
|
||||
|
||||
@@ -23,7 +23,9 @@ func NewLDAPPlugin() *LDAPPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *LDAPPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *LDAPPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
if config.DisableBrute {
|
||||
return p.identifyService(ctx, info, config, state)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,9 @@ func NewMemcachedPlugin() *MemcachedPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *MemcachedPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *MemcachedPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
if config.DisableBrute {
|
||||
|
||||
@@ -28,7 +28,9 @@ func NewMongoDBPlugin() *MongoDBPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *MongoDBPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *MongoDBPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
if config.DisableBrute {
|
||||
|
||||
@@ -34,7 +34,9 @@ func NewMS17010Plugin() *MS17010Plugin {
|
||||
// GetPorts 实现Plugin接口
|
||||
|
||||
// Scan 执行MS17-010扫描
|
||||
func (p *MS17010Plugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *MS17010Plugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
// 如果禁用暴力破解,也禁用漏洞检测
|
||||
if config.DisableBrute {
|
||||
return &ScanResult{
|
||||
|
||||
@@ -25,7 +25,9 @@ func NewMSSQLPlugin() *MSSQLPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *MSSQLPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *MSSQLPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
if config.DisableBrute {
|
||||
return p.identifyService(ctx, info, config, state)
|
||||
}
|
||||
|
||||
@@ -36,7 +36,9 @@ func NewMySQLPlugin() *MySQLPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *MySQLPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *MySQLPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
if config.DisableBrute {
|
||||
return p.identifyService(info, config)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,9 @@ func NewNeo4jPlugin() *Neo4jPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Neo4jPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *Neo4jPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
if config.DisableBrute {
|
||||
|
||||
@@ -29,7 +29,9 @@ func NewNetBIOSPlugin() *NetBIOSPlugin {
|
||||
// GetPorts 实现Plugin接口
|
||||
|
||||
// Scan 执行NetBIOS扫描 - 收集Windows主机和域信息
|
||||
func (p *NetBIOSPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *NetBIOSPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
// 检查端口类型
|
||||
|
||||
@@ -24,7 +24,9 @@ func NewOraclePlugin() *OraclePlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *OraclePlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *OraclePlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
if config.DisableBrute {
|
||||
|
||||
@@ -25,7 +25,9 @@ func NewPostgreSQLPlugin() *PostgreSQLPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *PostgreSQLPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *PostgreSQLPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
if config.DisableBrute {
|
||||
|
||||
@@ -26,7 +26,9 @@ func NewRabbitMQPlugin() *RabbitMQPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *RabbitMQPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *RabbitMQPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
if config.DisableBrute {
|
||||
|
||||
@@ -28,7 +28,9 @@ func NewRDPPlugin() *RDPPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行RDP扫描 - 系统指纹识别 + 真实暴力破解
|
||||
func (p *RDPPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *RDPPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
// 配置grdp日志级别
|
||||
|
||||
@@ -31,7 +31,9 @@ func NewRedisPlugin() *RedisPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行Redis扫描
|
||||
func (p *RedisPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *RedisPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
// 如果禁用暴力破解,只做服务识别
|
||||
|
||||
@@ -28,7 +28,9 @@ func NewRsyncPlugin() *RsyncPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *RsyncPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *RsyncPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
if config.DisableBrute {
|
||||
|
||||
@@ -24,7 +24,9 @@ func NewSmbPlugin() *SmbPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *SmbPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *plugins.Result {
|
||||
func (p *SmbPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
// 检查端口
|
||||
|
||||
@@ -25,7 +25,9 @@ func NewSMTPPlugin() *SMTPPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *SMTPPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *SMTPPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
if config.DisableBrute {
|
||||
|
||||
@@ -34,7 +34,9 @@ func NewSSHPlugin() *SSHPlugin {
|
||||
}
|
||||
|
||||
// Scan 执行SSH扫描
|
||||
func (p *SSHPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *SSHPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
// 如果指定了SSH密钥,优先使用密钥认证
|
||||
|
||||
@@ -50,7 +50,9 @@ func NewTelnetPlugin() *TelnetPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *TelnetPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *TelnetPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
if config.DisableBrute {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
// 插件接口定义 - 统一命名风格
|
||||
type Plugin interface {
|
||||
Name() string
|
||||
Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult
|
||||
Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult
|
||||
}
|
||||
|
||||
type ScanResult = plugins.Result
|
||||
|
||||
@@ -24,7 +24,9 @@ func NewVNCPlugin() *VNCPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *VNCPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *ScanResult {
|
||||
func (p *VNCPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
||||
config := session.Config
|
||||
state := session.State
|
||||
target := info.Target()
|
||||
|
||||
// 检查未授权访问
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
// WebPlugin Web插件接口 - 使用智能HTTP检测,不需要预定义端口
|
||||
type WebPlugin interface {
|
||||
Name() string
|
||||
Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *WebScanResult
|
||||
Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *WebScanResult
|
||||
}
|
||||
|
||||
// WebScanResult Web扫描结果类型别名
|
||||
|
||||
@@ -87,7 +87,8 @@ func NewWebPocPlugin() *WebPocPlugin {
|
||||
// Scan 执行Web POC扫描
|
||||
// 注意:非全量模式下,POC扫描由webtitle插件在指纹识别后触发,此插件不执行
|
||||
// 全量模式(-full)下,此插件独立执行全量POC扫描
|
||||
func (p *WebPocPlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *WebScanResult {
|
||||
func (p *WebPocPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *WebScanResult {
|
||||
config := session.Config
|
||||
if config.POC.Disabled {
|
||||
return &WebScanResult{
|
||||
Success: false,
|
||||
|
||||
@@ -39,7 +39,8 @@ func NewWebTitlePlugin() *WebTitlePlugin {
|
||||
}
|
||||
|
||||
// Scan 执行WebTitle扫描
|
||||
func (p *WebTitlePlugin) Scan(ctx context.Context, info *common.HostInfo, config *common.Config, state *common.State) *WebScanResult {
|
||||
func (p *WebTitlePlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *WebScanResult {
|
||||
config := session.Config
|
||||
title, status, length, server, fingerprints, url, err := p.getWebTitle(ctx, info, config)
|
||||
if err != nil {
|
||||
return &WebScanResult{
|
||||
|
||||
Reference in New Issue
Block a user