Skip to content

Commit

Permalink
refactor: Crtsh output filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
enenumxela committed Nov 15, 2023
1 parent da4a3bd commit 395218d
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions pkg/scraper/sources/crtsh/crtsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,22 @@ func (source *Source) Run(_ *sources.Configuration, domain string) <-chan source

for index := range getNameValuesResData {
record := getNameValuesResData[index]
subdomains := strings.Split(record.NameValue, "\n")

for _, value := range strings.Split(record.NameValue, "\n") {
match := regex.FindAllString(value, -1)
for index := range subdomains {
subdomain := subdomains[index]

for _, subdomain := range match {
result := sources.Result{
Type: sources.Subdomain,
Source: source.Name(),
Value: subdomain,
}
if !regex.MatchString(subdomain) {
continue
}

results <- result
result := sources.Result{
Type: sources.Subdomain,
Source: source.Name(),
Value: subdomain,
}

results <- result
}
}
}()
Expand Down

0 comments on commit 395218d

Please sign in to comment.