diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 93466da..fdde8ae 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,9 +16,9 @@ jobs: uses: golangci/golangci-lint-action@v1 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.29 + version: v1.31 args: --timeout 5m - working-directory: v2/cmd/subfinder/ + working-directory: v2/ # Optional: working directory, useful for monorepos # working-directory: somedir diff --git a/.golangci.yml b/.golangci.yml index 1fcf952..576ead9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -111,6 +111,6 @@ linters: # golangci.com configuration # https://github.com/golangci/golangci/wiki/Configuration service: - golangci-lint-version: 1.29.x # use the fixed version to not introduce new linters unexpectedly + golangci-lint-version: 1.31.x # use the fixed version to not introduce new linters unexpectedly prepare: - echo "here I can run custom commands, but no preparation needed for this repo" diff --git a/v2/go.mod b/v2/go.mod index 866e956..ce58e6b 100644 --- a/v2/go.mod +++ b/v2/go.mod @@ -15,6 +15,7 @@ require ( github.com/projectdiscovery/fdmax v0.0.2 github.com/projectdiscovery/gologger v1.0.1 github.com/rs/xid v1.2.1 + github.com/stretchr/testify v1.5.1 github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a // indirect golang.org/x/net v0.0.0-20200925080053-05aa5d4ee321 // indirect diff --git a/v2/go.sum b/v2/go.sum index 502812a..26beaaa 100644 --- a/v2/go.sum +++ b/v2/go.sum @@ -1,4 +1,5 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026 h1:BpJ2o0OR5FV7vrkDYfXYVJQeMNWa8RhklZOpW2ITAIQ= @@ -23,6 +24,7 @@ github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9 github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/projectdiscovery/chaos-client v0.1.6 h1:AbIN7xUszjUi7FxI4qUVSqJ3um+6eImE/xstbNS0A1M= github.com/projectdiscovery/chaos-client v0.1.6/go.mod h1:F5omaoJh/vMvWnZhKD4zFFA5ti+RPwUletwepKSyfxk= @@ -35,6 +37,7 @@ github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 h1:nrZ3ySNYwJbSpD6ce9duiP+QkD3JuLCcWkdaehUS/3Y= github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80/go.mod h1:iFyPdL66DjUD96XmzVL3ZntbzcflLnznH0fr99w5VqE= @@ -63,6 +66,7 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/v2/pkg/runner/enumerate.go b/v2/pkg/runner/enumerate.go index 5b09833..3183ecf 100644 --- a/v2/pkg/runner/enumerate.go +++ b/v2/pkg/runner/enumerate.go @@ -61,11 +61,10 @@ func (r *Runner) EnumerateSingleDomain(ctx context.Context, domain, output strin if _, ok := uniqueMap[subdomain]; !ok { sourceMap[subdomain] = make(map[string]struct{}) - } // Log the verbose message about the found subdomain per source - if _, ok := sourceMap[subdomain][result.Source]; !ok{ + if _, ok := sourceMap[subdomain][result.Source]; !ok { gologger.Verbosef("%s\n", result.Source, subdomain) } @@ -127,7 +126,7 @@ func (r *Runner) EnumerateSingleDomain(ctx context.Context, domain, output strin err = outputter.WriteHostNoWildcard(foundResults, os.Stdout) } else { if r.options.CaptureSources { - err = outputter.WriteSourceHost(sourceMap,os.Stdout) + err = outputter.WriteSourceHost(sourceMap, os.Stdout) } else { err = outputter.WriteHost(uniqueMap, os.Stdout) } diff --git a/v2/pkg/runner/outputter.go b/v2/pkg/runner/outputter.go index e71263d..b64af38 100644 --- a/v2/pkg/runner/outputter.go +++ b/v2/pkg/runner/outputter.go @@ -23,14 +23,8 @@ type jsonResult struct { Source string `json:"source"` } -type jsonSourceResultIP struct { - Host string `json:"host"` - IP string `json:"ip"` - Sources []string `json:"sources"` -} - type jsonSourceResult struct { - Host string `json:"host"` + Host string `json:"host"` Sources []string `json:"sources"` } @@ -244,4 +238,4 @@ func writeSourcePlainHost(sourceMap map[string]map[string]struct{}, writer io.Wr sb.Reset() } return bufwriter.Flush() -} \ No newline at end of file +} diff --git a/v2/pkg/subscraping/sources/sonarsearch/sonarsearch.go b/v2/pkg/subscraping/sources/sonarsearch/sonarsearch.go index 436b670..851dafb 100644 --- a/v2/pkg/subscraping/sources/sonarsearch/sonarsearch.go +++ b/v2/pkg/subscraping/sources/sonarsearch/sonarsearch.go @@ -18,11 +18,11 @@ func (s *Source) Run(ctx context.Context, domain string, session *subscraping.Se go func() { defer close(results) - getUrl := fmt.Sprintf("https://sonar.omnisint.io/subdomains/%s?page=", domain) + getURL := fmt.Sprintf("https://sonar.omnisint.io/subdomains/%s?page=", domain) page := 0 var subdomains []string for { - resp, err := session.SimpleGet(ctx, getUrl+strconv.Itoa(page)) + resp, err := session.SimpleGet(ctx, getURL+strconv.Itoa(page)) if err != nil { results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err} session.DiscardHTTPResponse(resp)