dorkgen/README.md

3.3 KiB

Dorkgen

Dorkgen is a dork request generator for popular search engines such as Google Search, DuckDuckGo, Yahoo and Bing. Learn more about Google Hacking. The goal of this package is to provide simple interfaces to creates valid dork queries for various search engines.

Current status

Version 1 is ongoing but the API is still unstable. For now, only Google is supported, v1.3 will introduce support for other search engines as well as a new design pattern.

Install

Fetch the module :

go get github.com/sundowndev/dorkgen

Usage

Try it in the Go playground

Get started

package main

import "github.com/sundowndev/dorkgen"

func main() {
  dork := dorkgen.NewGoogleSearch()
  // dork := dorkgen.NewDuckDuckGo()
  // dork := dorkgen.NewBing()

  dork.Site("example.com").Intext("text").String()
  // returns: site:example.com intext:"text"
}

Operators

func main() {
  dork.Site("facebook.com").Or().Site("twitter.com").String()
  // returns: site:facebook.com | site:twitter.com

  dork.Intext("facebook").And().Intext("twitter").String()
  // returns: intext:"facebook" & intext:"twitter"
}

Exclude results

func main() {
  dork.
    Exclude((dorkgen.NewGoogleSearch()).
      Site("example.com").
      String()).
    Site("example.*").
    Or().
    Intext("text")
  // returns: -site:example.com site:example.* OR "text"
}

Group tags along with operators

func main() {
  dork.
    Group((dorkgen.NewGoogleSearch()).
      Site("facebook.com").
      Or().
      Site("twitter.com")).
    Intext("wtf").
    String()
  // returns: (site:facebook.com | site:twitter.com) "wtf"
}

URL conversion

func main() {
  dork.
    Site("facebook.*").
    Exclude((dorkgen.NewGoogleSearch()).
      Site("facebook.com").
      String())

  dork.String()
  // returns: site:facebook.* -site:facebook.com
  dork.ToURL()
  // returns: https://www.google.com/search?q=site%3Afacebook.%2A+-site%3Afacebook.com
}

Support

Thanks to JetBrains for supporting my open-source projects.