Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
dogancanbakir committed Jan 11, 2024
1 parent 34d351e commit 146eebe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 1 addition & 4 deletions v2/examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ import (
"context"
"io"
"log"
"strconv"

"github.com/projectdiscovery/subfinder/v2/pkg/runner"
contextutil "github.com/projectdiscovery/utils/context"
)

func main() {
Expand All @@ -33,8 +31,7 @@ func main() {

output := &bytes.Buffer{}
// To run subdomain enumeration on a single domain
ctx, _ := contextutil.WithValues(context.Background(), contextutil.ContextArg("All"), contextutil.ContextArg(strconv.FormatBool(subfinderOpts.All)))
if err = subfinder.EnumerateSingleDomainWithCtx(ctx, "hackerone.com", []io.Writer{output}); err != nil {
if err = subfinder.EnumerateSingleDomainWithCtx(context.Background(), "hackerone.com", []io.Writer{output}); err != nil {
log.Fatalf("failed to enumerate single domain: %v", err)
}

Expand Down
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 @@ -63,10 +63,10 @@ func (s *Source) getSubdomainsFromSQL(ctx context.Context, domain string, sessio
defer db.Close()

limitClause := ""
all := ctx.Value(contextutil.ContextArg("All")).(contextutil.ContextArg)
allBool, _ := strconv.ParseBool(string(all))
if !allBool {
limitClause = "LIMIT 10000"
if all, ok := ctx.Value(contextutil.ContextArg("All")).(contextutil.ContextArg); ok {
if allBool, err := strconv.ParseBool(string(all)); err == nil && !allBool {
limitClause = "LIMIT 10000"
}
}

query := fmt.Sprintf(`WITH ci AS (
Expand Down

0 comments on commit 146eebe

Please sign in to comment.