Skip to content

Commit

Permalink
refactor: update dorkgen to v1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sundowndev committed Nov 14, 2022
1 parent a5e2494 commit 9642734
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 168 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.1.3
github.com/stretchr/testify v1.7.1
github.com/sundowndev/dorkgen v1.2.0
github.com/sundowndev/dorkgen v1.3.1
github.com/swaggo/swag v1.7.0
google.golang.org/api v0.92.0
gopkg.in/h2non/gock.v1 v1.0.16
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/sundowndev/dorkgen v1.2.0 h1:dnB3tyV0n0IJ60KkaID35zoHRDvCbtJLcX9pLudQsgM=
github.com/sundowndev/dorkgen v1.2.0/go.mod h1:7CCMM/9plw5FEpuUgdqO+shHhKon1+T3TzcKGaDKyqk=
github.com/sundowndev/dorkgen v1.3.1 h1:piBvKO8gCGK0nEcUPHkdTEaKveKr442B83Hf0pyBNkw=
github.com/sundowndev/dorkgen v1.3.1/go.mod h1:n6ViY6jWWp/T5JpHdFqtlMKCMHx56i/i1Xk/kDSgjYQ=
github.com/swaggo/swag v1.7.0 h1:5bCA/MTLQoIqDXXyHfOpMeDvL9j68OY/udlK4pQoo4E=
github.com/swaggo/swag v1.7.0/go.mod h1:BdPIL73gvS9NBsdi7M1JOxLvlbfvNRaBP8m6WT6Aajo=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
Expand Down
27 changes: 14 additions & 13 deletions lib/remote/googlecse_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"github.com/sundowndev/dorkgen"
"github.com/sundowndev/dorkgen/googlesearch"
"github.com/sundowndev/phoneinfoga/v2/lib/number"
"google.golang.org/api/customsearch/v1"
"google.golang.org/api/googleapi"
Expand Down Expand Up @@ -160,17 +161,17 @@ func (s *googleCSEScanner) isRateLimit(theError error) bool {
}

func (s *googleCSEScanner) generateDorkQueries(number number.Number) (results []*GoogleSearchDork) {
var dorks = []*dorkgen.GoogleSearch{
(&dorkgen.GoogleSearch{}).
Intext(number.International).
var dorks = []*googlesearch.GoogleSearch{
dorkgen.NewGoogleSearch().
InText(number.International).
Or().
Intext(number.E164).
InText(number.E164).
Or().
Intext(number.RawLocal).
InText(number.RawLocal).
Or().
Intext(number.Local),
(&dorkgen.GoogleSearch{}).
Group((&dorkgen.GoogleSearch{}).
InText(number.Local),
dorkgen.NewGoogleSearch().
Group(dorkgen.NewGoogleSearch().
Ext("doc").
Or().
Ext("docx").
Expand All @@ -196,20 +197,20 @@ func (s *googleCSEScanner) generateDorkQueries(number number.Number) (results []
Ext("txt").
Or().
Ext("xls")).
Intext(number.International).
InText(number.International).
Or().
Intext(number.E164).
InText(number.E164).
Or().
Intext(number.RawLocal).
InText(number.RawLocal).
Or().
Intext(number.Local),
InText(number.Local),
}

for _, dork := range dorks {
results = append(results, &GoogleSearchDork{
Number: number.E164,
Dork: dork.String(),
URL: dork.ToURL(),
URL: dork.URL(),
})
}

Expand Down
Loading

0 comments on commit 9642734

Please sign in to comment.