这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion v2/pkg/runner/enumerate.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (r *Runner) EnumerateSingleDomainWithCtx(ctx context.Context, domain string
uniqueMap := make(map[string]resolve.HostEntry)
// Create a map to track sources for each host
sourceMap := make(map[string]map[string]struct{})
skippedCounts := make(map[string]int)
// Process the results in a separate goroutine
go func() {
for result := range passiveResults {
Expand All @@ -58,6 +59,7 @@ func (r *Runner) EnumerateSingleDomainWithCtx(ctx context.Context, domain string
case subscraping.Subdomain:
// Validate the subdomain found and remove wildcards from
if !strings.HasSuffix(result.Value, "."+domain) {
skippedCounts[result.Source]++
continue
}
subdomain := strings.ReplaceAll(strings.ToLower(result.Value), "*.", "")
Expand All @@ -77,6 +79,7 @@ func (r *Runner) EnumerateSingleDomainWithCtx(ctx context.Context, domain string
// Check if the subdomain is a duplicate. If not,
// send the subdomain for resolution.
if _, ok := uniqueMap[subdomain]; ok {
skippedCounts[result.Source]++
continue
}

Expand Down Expand Up @@ -164,7 +167,17 @@ func (r *Runner) EnumerateSingleDomainWithCtx(ctx context.Context, domain string

if r.options.Statistics {
gologger.Info().Msgf("Printing source statistics for %s", domain)
printStatistics(r.passiveAgent.GetStatistics())
statistics := r.passiveAgent.GetStatistics()
// This is a hack to remove the skipped count from the statistics
// as we don't want to show it in the statistics.
// TODO: Design a better way to do this.
for source, count := range skippedCounts {
if stat, ok := statistics[source]; ok {
stat.Results -= count
statistics[source] = stat
}
}
printStatistics(statistics)
}

return nil
Expand Down