docs: usage

pull/8/head
sundowndev 2020-06-15 11:00:15 +02:00
parent 0e457e1eaf
commit 1e33e4f0c6
2 changed files with 34 additions and 19 deletions

View File

@ -43,11 +43,11 @@ package main
import "github.com/sundowndev/dorkgen" import "github.com/sundowndev/dorkgen"
func main() { func main() {
dork := &dorkgen.GoogleSearch{} dork := dorkgen.NewGoogleSearch()
// dork := &dorkgen.DuckDuckGo{} // dork := dorkgen.NewDuckDuckGo()
// dork := &dorkgen.Bing{} // dork := dorkgen.NewBing()
dork.Site("example.com").Intext("text").ToString() dork.Site("example.com").Intext("text").String()
// returns: site:example.com intext:"text" // returns: site:example.com intext:"text"
} }
``` ```
@ -56,10 +56,10 @@ func main() {
```go ```go
func main() { func main() {
dork.Site("facebook.com").Or().Site("twitter.com").ToString() dork.Site("facebook.com").Or().Site("twitter.com").String()
// returns: site:facebook.com OR site:twitter.com // returns: site:facebook.com OR site:twitter.com
dork.Intext("facebook").And().Intext("twitter").ToString() dork.Intext("facebook").And().Intext("twitter").String()
// returns: intext:"facebook" AND intext:"twitter" // returns: intext:"facebook" AND intext:"twitter"
} }
``` ```
@ -69,9 +69,9 @@ func main() {
```go ```go
func main() { func main() {
dork. dork.
Exclude((&dorkgen.GoogleSearch{}). Exclude((dorkgen.NewGoogleSearch()).
Site("example.com"). Site("example.com").
ToString()). String()).
Site("example.*"). Site("example.*").
Or(). Or().
Intext("text") Intext("text")
@ -84,13 +84,12 @@ func main() {
```go ```go
func main() { func main() {
dork. dork.
Group((&dorkgen.GoogleSearch{}). Group((dorkgen.NewGoogleSearch()).
Site("facebook.com"). Site("facebook.com").
Or(). Or().
Site("twitter.com"). Site("twitter.com")).
ToString()).
Intext("wtf"). Intext("wtf").
ToString() String()
// returns: (site:facebook.com OR site:twitter.com) "wtf" // returns: (site:facebook.com OR site:twitter.com) "wtf"
} }
``` ```
@ -101,11 +100,11 @@ func main() {
func main() { func main() {
dork. dork.
Site("facebook.*"). Site("facebook.*").
Exclude((&dorkgen.GoogleSearch{}). Exclude((dorkgen.NewGoogleSearch()).
Site("facebook.com"). Site("facebook.com").
ToString()) String())
dork.ToString() dork.String()
// returns: site:facebook.* -site:facebook.com // returns: site:facebook.* -site:facebook.com
dork.ToURL() dork.ToURL()
// returns: https://www.google.com/search?q=site%3Afacebook.%2A+-site%3Afacebook.com // returns: https://www.google.com/search?q=site%3Afacebook.%2A+-site%3Afacebook.com

24
doc.go
View File

@ -8,12 +8,28 @@ package main
import "github.com/sundowndev/dorkgen" import "github.com/sundowndev/dorkgen"
func main() { func main() {
dork := &dorkgen.GoogleSearch{} dork := dorkgen.NewGoogleSearch()
// dork := &dorkgen.DuckDuckGo{} // dork := dorkgen.NewDuckDuckGo()
// dork := &dorkgen.Bing{} // dork := dorkgen.NewBing()
dork.Site("example.com").Intext("text").ToString() dork.Site("example.com").Intext("text").String()
// returns: site:example.com "text" // returns: site:example.com "text"
} }
// You can also isolate tags between parentheses
func main() {
dork := dorkgen.NewGoogleSearch()
dork.Group(
dorkgen.NewGoogleSearch().
Site("facebook.com")).
Or().
Group(
dorkgen.NewGoogleSearch().
Site("twitter.com")).
Intext("text")
String()
// returns: (site:facebook.com) OR (site:twitter.com) "text"
}
*/ */
package dorkgen package dorkgen