Skip to content

Commit

Permalink
fix: add missing service.go changes for vulnerability collection
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Nov 20, 2024
1 parent 0bc1f5a commit 1db353c
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions pkg/stage/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,14 @@ func (sd *ServiceDetector) checkURL(url string, port int) *ServiceInfo {
defer wg.Done()
for poc := range pocChan {
result := sd.pocExecutor.ExecutePOC(poc, url)
if result.Vulnerable {
vulnMux.Lock()
if info.Vulnerabilities == nil {
info.Vulnerabilities = make([]POCResult, 0)
}
info.Vulnerabilities = append(info.Vulnerabilities, result)
vulnMux.Unlock()

vulnMux.Lock()
if info.Vulnerabilities == nil {
info.Vulnerabilities = make([]POCResult, 0)
}
info.Vulnerabilities = append(info.Vulnerabilities, result)
vulnMux.Unlock()

}
}()
}
Expand Down Expand Up @@ -696,7 +696,6 @@ func (sd *ServiceDetector) detectUDP(ip string, port int) []ServiceInfo {
return results
}


func headerToString(h http.Header) string {
var sb strings.Builder
for key, values := range h {
Expand Down Expand Up @@ -1064,11 +1063,11 @@ func (sd *ServiceDetector) loadServicePOCs(serviceType string) (map[string]*POC,
continue
}

if poc.Name == "" {
poc.Name = strings.TrimSuffix(file.Name(), ".yml")
if poc.CVEID == "" {
poc.CVEID = strings.TrimSuffix(file.Name(), ".yml")
}

pocs[poc.Name] = &poc
pocs[poc.CVEID] = &poc
}

sd.pocCache[serviceType] = pocs
Expand Down

0 comments on commit 1db353c

Please sign in to comment.