-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* (mod/dorks)using dorks package instead of google-chrome browser yesterday, i wrote a little go package to run dorks and retrieve files, so that we no longer need to have the chrome browser installed. this will greatly reduce the size of the docker image, and allow us to use a proxy to run dorks, which is cool. there is still a lot of room for improvements for the dork package but this is a good start, i guess * (mod/_)bumping version using go 1.19 for docker image updated download link in the README to have a newer version * (fix/dorks)comment * (mod/meta)bumping version to 1.6.2 also added a little log line to specify where would the dorks file be stored
- Loading branch information
Showing
6 changed files
with
78 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,47 @@ | ||
package tool | ||
|
||
import ( | ||
"fmt" | ||
"os/exec" | ||
"runtime" | ||
|
||
"github.com/fatih/color" | ||
dorks "github.com/bogdzn/gork/cmd" | ||
) | ||
|
||
type Dorks struct{} | ||
type Dorks struct{ | ||
outfile string | ||
proxy string | ||
userAgent string | ||
extensions []string | ||
} | ||
|
||
func (d *Dorks) Info(url string) { | ||
color.Cyan("Use dorks on %s", url) | ||
color.Cyan("Running dorks on %s", url) | ||
} | ||
|
||
func (d *Dorks) Configure(c interface{}) {} | ||
func (d *Dorks) Configure(c interface{}) { | ||
|
||
/* | ||
gork will parse the DOM instead of making an API request, because it's easier for the end user | ||
(no API key to worry about etc), so we probably should **not** be changing the page's layout | ||
but, it's here in case something breaks | ||
*/ | ||
defaultUserAgent := "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"; | ||
defaultExtensions := []string{"doc", "docx", "csv", "pdf", "txt", "log", "bak", "json", "xlsx"} | ||
|
||
d.extensions = defaultExtensions | ||
d.userAgent = defaultUserAgent | ||
d.outfile = c.(map[string]interface{})["outfile"].(string) | ||
d.proxy = c.(map[string]interface{})["proxy"].(string) | ||
} | ||
|
||
func (d *Dorks) Run(url string) { | ||
var err error | ||
|
||
switch runtime.GOOS { | ||
case "linux": | ||
err = exec.Command("xdg-open", "https://www.google.com/search?q=site:"+url+"+ext:doc+OR+ext:docx+OR+ext:csv+OR+ext:pdf+OR+ext:txt+OR+ext:log+OR+ext:bak").Start() | ||
case "windows": | ||
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start() | ||
case "darwin": | ||
err = exec.Command("open", url).Start() | ||
default: | ||
err = fmt.Errorf("unsupported platform") | ||
} | ||
if err != nil { | ||
fmt.Println(err) | ||
} | ||
opts := &dorks.Options{ | ||
Outfile: d.outfile, | ||
AppendResults: false, | ||
Proxy: d.proxy, | ||
Extensions: d.extensions, | ||
UserAgent: d.userAgent, | ||
Target: url, | ||
} | ||
|
||
dorks.Run(opts) | ||
color.Cyan("Dorks are stored in %s", d.outfile) | ||
} |