Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuque_security committed Feb 19, 2025
1 parent a1103c8 commit 36cf0ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
16 changes: 9 additions & 7 deletions common/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,13 +519,15 @@ func (r *Runner) writeResult(f *os.File, result HttpResult) {
fpString += ":" + fp.Version
}
}
r.Options.Callback(CallbackScanResult{
TargetURL: result.URL,
StatusCode: result.StatusCode,
Title: result.Title,
Fingerprint: fpString,
Vulnerabilities: vuls,
})
if r.Options.Callback != nil {
r.Options.Callback(CallbackScanResult{
TargetURL: result.URL,
StatusCode: result.StatusCode,
Title: result.Title,
Fingerprint: fpString,
Vulnerabilities: vuls,
})
}
}
if len(result.Advisories) > 0 {
fmt.Println("\n存在漏洞:")
Expand Down
6 changes: 3 additions & 3 deletions common/websocket/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ func (s *WSServer) handleMessages(conn *websocket.Conn) {
for {
_, message, err := conn.ReadMessage()
if err != nil {
if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {
gologger.Errorf("读取消息错误: %v\n", err)
}
break
}
var scanReq ScanRequest
Expand Down Expand Up @@ -94,7 +91,10 @@ func (s *WSServer) handleScanRequest(conn *websocket.Conn, req *ScanRequest) {
case "netscan":
opts.Target = req.Target
}
mu := sync.Mutex{}
processFunc := func(data interface{}) {
mu.Lock()
defer mu.Unlock()
switch v := data.(type) {
case runner.CallbackScanResult:
s.SendMessage(conn, WSMsgTypeScanResult, v)
Expand Down

0 comments on commit 36cf0ea

Please sign in to comment.