mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2026-11-07 17:43:04 -10:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97348e02ef | ||
|
|
597f1b8e9e |
No files matched your search
@@ -63,6 +63,7 @@ func Cluster(list []*Template) [][]*Template {
|
||||
dns[hash] = []*Template{}
|
||||
}
|
||||
dns[hash] = append(dns[hash], template)
|
||||
gologger.Error().Msgf("Clustered DNS template: %s with hash: %d", template.ID, hash)
|
||||
} else {
|
||||
final = append(final, []*Template{template})
|
||||
}
|
||||
@@ -74,6 +75,7 @@ func Cluster(list []*Template) [][]*Template {
|
||||
http[hash] = []*Template{}
|
||||
}
|
||||
http[hash] = append(http[hash], template)
|
||||
gologger.Error().Msgf("Clustered HTTP template: %s with hash: %d", template.ID, hash)
|
||||
} else {
|
||||
final = append(final, []*Template{template})
|
||||
}
|
||||
@@ -84,6 +86,7 @@ func Cluster(list []*Template) [][]*Template {
|
||||
ssl[hash] = []*Template{}
|
||||
}
|
||||
ssl[hash] = append(ssl[hash], template)
|
||||
gologger.Error().Msgf("Clustered SSL template: %s with hash: %d", template.ID, hash)
|
||||
} else {
|
||||
final = append(final, []*Template{template})
|
||||
}
|
||||
@@ -92,7 +95,7 @@ func Cluster(list []*Template) [][]*Template {
|
||||
}
|
||||
}
|
||||
|
||||
// add all clusterd templates
|
||||
// add all clustered templates
|
||||
for _, templates := range http {
|
||||
final = append(final, templates)
|
||||
}
|
||||
@@ -103,6 +106,7 @@ func Cluster(list []*Template) [][]*Template {
|
||||
final = append(final, templates)
|
||||
}
|
||||
|
||||
gologger.Error().Msgf("Total clusters formed: %d", len(final))
|
||||
return final
|
||||
}
|
||||
|
||||
@@ -150,10 +154,12 @@ func ClusterTemplates(templatesList []*Template, options protocols.ExecutorOptio
|
||||
TotalRequests: len(cluster[0].RequestsHTTP) + len(cluster[0].RequestsDNS),
|
||||
})
|
||||
clusterCount += len(cluster)
|
||||
gologger.Error().Msgf("Created cluster with ID: %s containing %d templates", clusterID, len(cluster))
|
||||
} else {
|
||||
finalTemplatesList = append(finalTemplatesList, cluster...)
|
||||
}
|
||||
}
|
||||
gologger.Error().Msgf("Total templates after clustering: %d", len(finalTemplatesList))
|
||||
return finalTemplatesList, clusterCount
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,11 @@ func (s *Agent) Start(interval time.Duration) context.CancelFunc {
|
||||
ticker := time.NewTicker(interval)
|
||||
|
||||
go func() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
gologger.Error().Msgf("Recovered in Start: %v", r)
|
||||
}
|
||||
}()
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
@@ -70,6 +75,12 @@ func (s *Agent) Start(interval time.Duration) context.CancelFunc {
|
||||
|
||||
// monitorWorker is a worker for monitoring running goroutines
|
||||
func (s *Agent) monitorWorker(cancel context.CancelFunc) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
gologger.Error().Msgf("Recovered in monitorWorker: %v", r)
|
||||
}
|
||||
}()
|
||||
|
||||
current := runtime.NumGoroutine()
|
||||
if current != s.goroutineCount {
|
||||
s.goroutineCount = current
|
||||
|
||||
Reference in new issue
Block a user