dorkgen/README.md

123 lines
3.3 KiB
Markdown
Raw Normal View History

2020-02-24 19:53:31 +00:00
<div align="left">
2020-02-24 19:49:54 +00:00
<a href="https://godoc.org/github.com/sundowndev/dorkgen">
<img src="https://godoc.org/github.com/sundowndev/dorkgen?status.svg" alt="GoDoc">
</a>
2020-02-24 20:44:50 +00:00
<a href="https://github.com/sundowndev/dorkgen/actions">
<img src="https://img.shields.io/endpoint.svg?url=https://actions-badge.atrox.dev/sundowndev/dorkgen/badge?ref=master" alt="build status" />
</a>
2020-02-24 19:34:02 +00:00
<a href="https://goreportcard.com/report/github.com/sundowndev/dorkgen">
<img src="https://goreportcard.com/badge/github.com/sundowndev/dorkgen" alt="go report" />
</a>
<a href="https://codeclimate.com/github/sundowndev/dorkgen/maintainability">
2020-02-24 19:53:31 +00:00
<img src="https://api.codeclimate.com/v1/badges/e827d7cc994c6519d319/maintainability" />
2020-02-24 19:34:02 +00:00
</a>
2020-02-26 11:22:43 +00:00
<a href="https://codecov.io/gh/sundowndev/dorkgen">
<img src="https://codecov.io/gh/sundowndev/dorkgen/branch/master/graph/badge.svg" />
</a>
2020-02-24 19:34:02 +00:00
<a href="https://github.com/sundowndev/dorkgen/releases">
<img src="https://img.shields.io/github/release/SundownDEV/dorkgen.svg" alt="Latest version" />
</a>
</div>
2020-07-21 13:12:44 +00:00
# Dorkgen
Dorkgen is a dork request generator for popular search engines such as Google Search, DuckDuckGo, Yahoo and Bing. [Learn more about Google Hacking](https://en.wikipedia.org/wiki/Google_hacking). The goal of this package is to provide simple interfaces to creates valid dork queries for various search engines.
## Current status
2020-02-24 19:34:02 +00:00
2020-07-28 08:52:42 +00:00
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.
2020-06-15 07:52:28 +00:00
2020-02-24 19:34:02 +00:00
## Install
2020-07-21 13:12:44 +00:00
Fetch the module :
2020-02-24 19:34:02 +00:00
```bash
go get github.com/sundowndev/dorkgen
```
## Usage
2020-07-28 08:52:42 +00:00
**[Try it in the Go playground](https://play.golang.org/p/ck_hEoX8cTK)**
2020-02-25 09:39:46 +00:00
#### Get started
2020-02-24 19:34:02 +00:00
```go
package main
2020-02-25 09:03:38 +00:00
import "github.com/sundowndev/dorkgen"
2020-02-24 19:34:02 +00:00
func main() {
2020-06-15 09:00:15 +00:00
dork := dorkgen.NewGoogleSearch()
// dork := dorkgen.NewDuckDuckGo()
// dork := dorkgen.NewBing()
2020-02-24 21:06:34 +00:00
2020-06-15 09:00:15 +00:00
dork.Site("example.com").Intext("text").String()
2020-03-16 17:53:53 +00:00
// returns: site:example.com intext:"text"
2020-02-25 09:39:46 +00:00
}
```
#### Operators
2020-02-24 19:34:02 +00:00
2020-02-25 09:39:46 +00:00
```go
2020-06-08 09:00:54 +00:00
func main() {
2020-06-15 09:00:15 +00:00
dork.Site("facebook.com").Or().Site("twitter.com").String()
2020-07-28 08:52:42 +00:00
// returns: site:facebook.com | site:twitter.com
2020-06-08 09:00:54 +00:00
2020-06-15 09:00:15 +00:00
dork.Intext("facebook").And().Intext("twitter").String()
2020-07-28 08:52:42 +00:00
// returns: intext:"facebook" & intext:"twitter"
2020-06-08 09:00:54 +00:00
}
2020-02-24 19:34:02 +00:00
```
2020-02-25 09:39:46 +00:00
#### Exclude results
2020-02-24 19:34:02 +00:00
```go
2020-06-08 09:00:54 +00:00
func main() {
dork.
2020-06-15 09:00:15 +00:00
Exclude((dorkgen.NewGoogleSearch()).
2020-06-08 09:00:54 +00:00
Site("example.com").
2020-06-15 09:00:15 +00:00
String()).
2020-06-08 09:00:54 +00:00
Site("example.*").
Or().
Intext("text")
// returns: -site:example.com site:example.* OR "text"
}
2020-02-25 09:39:46 +00:00
```
#### Group tags along with operators
```go
2020-06-08 09:00:54 +00:00
func main() {
2020-02-25 09:39:46 +00:00
dork.
2020-06-15 09:00:15 +00:00
Group((dorkgen.NewGoogleSearch()).
2020-02-25 09:39:46 +00:00
Site("facebook.com").
Or().
2020-06-15 09:00:15 +00:00
Site("twitter.com")).
2020-02-25 09:39:46 +00:00
Intext("wtf").
2020-06-15 09:00:15 +00:00
String()
2020-07-28 08:52:42 +00:00
// returns: (site:facebook.com | site:twitter.com) "wtf"
2020-02-24 19:34:02 +00:00
}
```
2020-02-25 09:39:46 +00:00
#### URL conversion
```go
2020-06-08 09:00:54 +00:00
func main() {
dork.
Site("facebook.*").
2020-06-15 09:00:15 +00:00
Exclude((dorkgen.NewGoogleSearch()).
2020-06-08 09:00:54 +00:00
Site("facebook.com").
2020-06-15 09:00:15 +00:00
String())
2020-06-08 09:00:54 +00:00
2020-06-15 09:00:15 +00:00
dork.String()
2020-06-08 09:00:54 +00:00
// returns: site:facebook.* -site:facebook.com
dork.ToURL()
// returns: https://www.google.com/search?q=site%3Afacebook.%2A+-site%3Afacebook.com
}
2020-02-25 09:39:46 +00:00
```
2020-06-05 12:36:11 +00:00
## Support
[![](docs/jetbrains.svg)](https://www.jetbrains.com/?from=sundowndev)
Thanks to [JetBrains](https://www.jetbrains.com/?from=sundowndev) for supporting my open-source projects.