Type-safe dork queries for search engines such as Google, Yahoo, DuckDuckGo & Bing
Go to file
Raphaël c660219494
Merge pull request #21 from sundowndev/fix/duckduckgoURL
Fix DuckDuckGo search URL
2021-03-04 14:35:32 +01:00
.github/workflows chore: update Go version to 1.15 2020-09-06 17:31:00 +02:00
docs docs: add jetbrains support notice 2020-06-05 14:36:11 +02:00
duckduckgo fix: duckduckgo search URL 2021-03-04 14:34:01 +01:00
googlesearch refactor: remove ip tag in google search 2020-09-12 18:46:53 +02:00
.codeclimate.yml chore: codeclimate config 2020-02-24 21:22:55 +01:00
.gitignore chore: gitignore 2020-04-25 14:20:03 +01:00
LICENSE chore: create license 2020-02-24 20:34:46 +01:00
README.md docs: readme 2021-01-24 15:45:53 +04:00
doc.go refactor: file structure and sub packages 2020-09-05 17:20:56 +02:00
dorkgen.go chore: add missing godocs 2020-09-06 17:39:04 +02:00
dorkgen_test.go feat: implement duckduckgo search 2020-09-05 20:56:14 +02:00
go.mod chore: update Go version to 1.15 2020-09-06 17:31:00 +02:00
go.sum chore: dependencies 2020-06-15 10:50:47 +02:00
renovate.json chore(deps): add renovate.json 2020-03-18 20:49:37 +00:00

README.md

Dorkgen

Dorkgen is a dork query wrapper 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. This library was initially created for PhoneInfoga.

Current status

Version 1 is ongoing, but the API is still not fixed. See below table for supported search engines and status of their implementation.

Search engine Implementation status
Google Search Stable
DuckDuckGo Stable
Yahoo Search WIP
Bing Search WIP

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.NewBingSearch()
  // dork := dorkgen.NewYahooSearch()

  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")).
    Site("example.*").
    Or().
    InText("text")
  // returns: -site:example.com site:example.* | "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"))

  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.