Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crtsh email values #676

Merged
merged 2 commits into from
Nov 9, 2022
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
8 changes: 4 additions & 4 deletions v2/pkg/subscraping/sources/crtsh/crtsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s *Source) Run(ctx context.Context, domain string, session *subscraping.Se
go func() {
defer close(results)

count := s.getSubdomainsFromSQL(domain, results)
count := s.getSubdomainsFromSQL(domain, session, results)
if count > 0 {
return
}
Expand All @@ -40,7 +40,7 @@ func (s *Source) Run(ctx context.Context, domain string, session *subscraping.Se
return results
}

func (s *Source) getSubdomainsFromSQL(domain string, results chan subscraping.Result) int {
func (s *Source) getSubdomainsFromSQL(domain string, session *subscraping.Session, results chan subscraping.Result) int {
db, err := sql.Open("postgres", "host=crt.sh user=guest dbname=certwatch sslmode=disable binary_parameters=yes")
if err != nil {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err}
Expand Down Expand Up @@ -73,7 +73,7 @@ func (s *Source) getSubdomainsFromSQL(domain string, results chan subscraping.Re
return count
}
count++
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Subdomain, Value: data}
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Subdomain, Value: session.Extractor.FindString(data)}
}
return count
}
Expand All @@ -98,7 +98,7 @@ func (s *Source) getSubdomainsFromHTTP(ctx context.Context, domain string, sessi

for _, subdomain := range subdomains {
for _, sub := range strings.Split(subdomain.NameValue, "\n") {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Subdomain, Value: sub}
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Subdomain, Value: session.Extractor.FindString(sub)}
}
}

Expand Down