Merge branch 'master' of github.com:sundowndev/dorkgen

pull/5/head
sundowndev 2020-04-25 14:30:21 +01:00
commit 9f25d8fb92
4 changed files with 14 additions and 8 deletions

View File

@ -46,7 +46,7 @@ func main() {
// dork := &dorkgen.Bing{}
dork.Site("example.com").Intext("text").ToString()
// returns: site:example.com "text"
// returns: site:example.com intext:"text"
}
```
@ -57,7 +57,7 @@ dork.Site("facebook.com").Or().Site("twitter.com").ToString()
// returns: site:facebook.com OR site:twitter.com
dork.Intext("facebook").And().Intext("twitter").ToString()
// returns: "facebook" AND "twitter"
// returns: intext:"facebook" AND intext:"twitter"
```
#### Exclude results

View File

@ -15,6 +15,7 @@ const (
extTag = "ext:"
excludeTag = "-"
intitleTag = "intitle:"
intextTag = "intext:"
)
// GoogleSearch is the Google implementation for Dorkgen
@ -65,7 +66,7 @@ func (e *GoogleSearch) Or() *GoogleSearch {
// Intext searches for the occurrences of keywords all at once or one at a time.
func (e *GoogleSearch) Intext(text string) *GoogleSearch {
e.tags = append(e.tags, concat("", text, true))
e.tags = append(e.tags, concat(intextTag, text, true))
return e
}

View File

@ -38,7 +38,7 @@ func TestInit(t *testing.T) {
Intext("text").
ToString()
assert.Equal(result, "\"text\"", "they should be equal")
assert.Equal(result, "intext:\"text\"", "they should be equal")
})
t.Run("should handle inurl tag correctly", func(t *testing.T) {
@ -51,7 +51,7 @@ func TestInit(t *testing.T) {
assert.Equal(result, "inurl:\"index.php\"", "they should be equal")
})
t.Run("should handle rrrrr tag correctly", func(t *testing.T) {
t.Run("should handle filetype tag correctly", func(t *testing.T) {
dork = &GoogleSearch{}
result := dork.
@ -124,10 +124,10 @@ func TestInit(t *testing.T) {
Group((&GoogleSearch{}).Intext("1").Or().Intext("2").ToString()).
ToString()
assert.Equal(result, "site:linkedin.com (\"1\" OR \"2\")", "they should be equal")
assert.Equal(result, "site:linkedin.com (intext:\"1\" OR intext:\"2\")", "they should be equal")
})
t.Run("should handle rrrrr tag correctly", func(t *testing.T) {
t.Run("should handle group tag correctly", func(t *testing.T) {
dork = &GoogleSearch{}
result := dork.
@ -136,6 +136,6 @@ func TestInit(t *testing.T) {
Intitle("jordan").
ToString()
assert.Equal(result, "site:linkedin.com (\"1\" OR \"2\") intitle:\"jordan\"", "they should be equal")
assert.Equal(result, "site:linkedin.com (intext:\"1\" OR intext:\"2\") intitle:\"jordan\"", "they should be equal")
})
}

5
renovate.json Normal file
View File

@ -0,0 +1,5 @@
{
"extends": [
"config:base"
]
}