dorkgen

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 2 Imported by: 2

README

Dorkgen

Dorkgen is a dork request generator for popular search engines such as Google, DuckDuckGo and Bing. Learn more about Google Hacking.

For now, only Google is supported.

Install

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 OR site:twitter.com

  dork.Intext("facebook").And().Intext("twitter").String()
  // returns: intext:"facebook" AND 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 OR 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.

Documentation

Overview

Package dorkgen is a Go package to generate dork requests for popular search engines such as Google, DuckDuckGo and Bing. It allows you to define requests programmatically and convert them into string. You can use it as following:

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 "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"
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EngineFactory

type EngineFactory struct {
	// contains filtered or unexported fields
}

EngineFactory is the main interface for search engine implementations.

type GoogleSearch

type GoogleSearch struct {
	EngineFactory
}

GoogleSearch is the Google search implementation for Dorkgen

func NewGoogleSearch added in v1.2.0

func NewGoogleSearch() *GoogleSearch

func (*GoogleSearch) Cache

func (e *GoogleSearch) Cache(url string) *GoogleSearch

Cache shows the version of the web page that Google has in its cache.

func (*GoogleSearch) Exclude

func (e *GoogleSearch) Exclude(value string) *GoogleSearch

Exclude excludes some results.

func (*GoogleSearch) Ext

func (e *GoogleSearch) Ext(ext string) *GoogleSearch

Ext searches for a particular file extension mentioned in the query.

func (*GoogleSearch) Filetype

func (e *GoogleSearch) Filetype(filetype string) *GoogleSearch

Filetype searches for a particular filetype mentioned in the query.

func (*GoogleSearch) Group added in v1.0.0

func (e *GoogleSearch) Group(tags *GoogleSearch) *GoogleSearch

Group isolate tags between parentheses

func (*GoogleSearch) Intext

func (e *GoogleSearch) Intext(text string) *GoogleSearch

Intext searches for the occurrences of keywords all at once or one at a time.

func (*GoogleSearch) Intitle added in v1.0.1

func (e *GoogleSearch) Intitle(value string) *GoogleSearch

Intitle searches for occurrences of keywords in title all or one.

func (*GoogleSearch) Inurl

func (e *GoogleSearch) Inurl(url string) *GoogleSearch

Inurl searches for a URL matching one of the keywords.

func (*GoogleSearch) Or

func (e *GoogleSearch) Or() *GoogleSearch

Or puts an OR operator in the request

func (*GoogleSearch) Related

func (e *GoogleSearch) Related(url string) *GoogleSearch

Related list web pages that are “similar” to a specified web page.

func (*GoogleSearch) Site

func (e *GoogleSearch) Site(site string) *GoogleSearch

Site specifically searches that particular site and lists all the results for that site.

func (*GoogleSearch) String added in v1.2.0

func (e *GoogleSearch) String() string

String converts all tags to a single request

func (*GoogleSearch) ToURL

func (e *GoogleSearch) ToURL() string

ToURL converts tags to an encoded Google Search URL

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL