mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-24 20:21:52 +08:00
fix: 修复 Hub 广播 data race 和端口扫描潜在死锁,清理死代码
- hub.go: broadcast 路径 RLock 改 Lock,修复并发 delete/close 竞争 - port_scan.go: pool.Invoke 失败时释放 wg 和 semaphore,防止死锁 - web_scanner.go: 删除只写不读的 fingerprintCache - webtitle.go: 移除对已删除 SetFingerprints 的调用 - keylogger.go: 删除未使用的 stopChan 和 isRunning 字段
This commit is contained in:
@@ -23,8 +23,6 @@ import (
|
||||
// - 保持原有功能逻辑
|
||||
type KeyloggerPlugin struct {
|
||||
plugins.BasePlugin
|
||||
isRunning bool
|
||||
stopChan chan struct{}
|
||||
keyBuffer []string
|
||||
bufferMutex sync.RWMutex
|
||||
}
|
||||
@@ -33,7 +31,6 @@ type KeyloggerPlugin struct {
|
||||
func NewKeyloggerPlugin() *KeyloggerPlugin {
|
||||
return &KeyloggerPlugin{
|
||||
BasePlugin: plugins.NewBasePlugin("keylogger"),
|
||||
stopChan: make(chan struct{}),
|
||||
keyBuffer: make([]string, 0),
|
||||
}
|
||||
}
|
||||
@@ -100,10 +97,6 @@ func (p *KeyloggerPlugin) Scan(ctx context.Context, info *common.HostInfo, confi
|
||||
|
||||
// startKeylogging 启动键盘记录
|
||||
func (p *KeyloggerPlugin) startKeylogging(ctx context.Context, outputFile string) error {
|
||||
p.isRunning = true
|
||||
defer func() {
|
||||
p.isRunning = false
|
||||
}()
|
||||
|
||||
// 根据平台启动相应的键盘记录
|
||||
var err error
|
||||
|
||||
@@ -192,11 +192,6 @@ func (p *WebTitlePlugin) identifyFingerprintsMulti(info *common.HostInfo, baseUR
|
||||
// 调用指纹识别
|
||||
fingerprints := WebScan.InfoCheck(baseURL, &checkDataList)
|
||||
|
||||
// 存入缓存
|
||||
if len(fingerprints) > 0 {
|
||||
core.SetFingerprints(info.Host, info.Port, fingerprints)
|
||||
}
|
||||
|
||||
// 非全量模式下,基于指纹触发POC扫描
|
||||
if !config.POC.Full && !config.POC.Disabled {
|
||||
p.triggerPocScan(info, fingerprints, config)
|
||||
|
||||
Reference in New Issue
Block a user