Skip to content

Commit

Permalink
Add verbose mode and version flag
Browse files Browse the repository at this point in the history
  • Loading branch information
lc committed May 3, 2020
1 parent bb4d0cd commit 535134b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@

# Dependency directories (remove the comment below to include it)
# vendor/

dist
gau

23 changes: 23 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
before:
hooks:
- go mod download
builds:
- binary: gau
goos:
- linux
- windows
- darwin
goarch:
- amd64
- 386
archives:
- id: tgz
format: tar.gz
replacements:
darwin: macOS
format_overrides:
- goos: windows
format: zip

signs:
- artifacts: checksum
19 changes: 15 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import (
"github.com/lc/gau/providers"
)

const (
Version = `1.0.1`
)

// printResults just received fetched URLs and print them.
func printResults(results <-chan string) {
for result := range results {
Expand Down Expand Up @@ -59,8 +63,9 @@ func run(config *providers.Config, domains []string) {
defer wg.Done()

if err := provider.Fetch(domain, results); err != nil {
exitStatus = 1
_, _ = fmt.Fprintln(os.Stderr, err)
if config.Verbose {
_, _ = fmt.Fprintln(os.Stderr, err)
}
}
}(provider)
}
Expand All @@ -74,13 +79,18 @@ func run(config *providers.Config, domains []string) {

func main() {
var domains []string

verbose := flag.Bool("v", false, "verbose mode")
includeSubs := flag.Bool("subs", false, "include subdomains of target domain")
maxRetries := flag.Uint("retries", 5, "amount of retries for http client")
useProviders := flag.String("providers", "wayback,otx,commoncrawl", "providers to fetch urls for")

version := flag.Bool("version", false, "show gau version")
flag.Parse()

if *version {
fmt.Printf("ffuf version: %s\n", Version)
os.Exit(0)
}

if flag.NArg() > 0 {
domains = flag.Args()
} else {
Expand All @@ -90,6 +100,7 @@ func main() {
}
}
config := providers.Config{
Verbose: *verbose,
MaxRetries: *maxRetries,
IncludeSubdomains: *includeSubs,
Client: &http.Client{
Expand Down
1 change: 1 addition & 0 deletions providers/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type Provider interface {
Fetch(string, chan<- string) error
}
type Config struct {
Verbose bool
MaxRetries uint
IncludeSubdomains bool
Client *http.Client
Expand Down

0 comments on commit 535134b

Please sign in to comment.