Skip to content
Merged
Show file tree
Hide file tree
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
50 changes: 50 additions & 0 deletions v2/pkg/passive/sources_wo_auth_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package passive

import (
"context"
"reflect"
"strings"
"testing"

"github.com/stretchr/testify/assert"

"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/gologger/levels"
"github.com/projectdiscovery/subfinder/v2/pkg/subscraping"
)

func TestSourcesWithoutKeys(t *testing.T) {
domain := "hackerone.com"
timeout := 60

gologger.DefaultLogger.SetMaxLevel(levels.LevelDebug)

ctx := context.Background()
session, err := subscraping.NewSession(domain, "", 0, timeout)
assert.Nil(t, err)

var expected = subscraping.Result{Type: subscraping.Subdomain, Value: domain, Error: nil}

for _, source := range AllSources {
if source.NeedsKey() {
continue
}

t.Run(source.Name(), func(t *testing.T) {
var results []subscraping.Result

for result := range source.Run(ctx, domain, session) {
results = append(results, result)

assert.Equal(t, source.Name(), result.Source)

assert.Equal(t, expected.Type, result.Type)
assert.Equal(t, reflect.TypeOf(expected.Error), reflect.TypeOf(result.Error), result.Error)

assert.True(t, strings.HasSuffix(strings.ToLower(result.Value), strings.ToLower(expected.Value)))
}

assert.GreaterOrEqual(t, len(results), 1)
})
}
}
43 changes: 0 additions & 43 deletions v2/pkg/subscraping/sources/alienvault/alienvault_test.go

This file was deleted.

1 change: 1 addition & 0 deletions v2/pkg/subscraping/sources/crtsh/crtsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func (s *Source) Run(ctx context.Context, domain string, session *subscraping.Se

go func() {
defer close(results)

count := s.getSubdomainsFromSQL(domain, results)
if count > 0 {
return
Expand Down
44 changes: 0 additions & 44 deletions v2/pkg/subscraping/sources/hackertarget/hackertarget_test.go

This file was deleted.