From c146c22b7c7d9d618d5145ac7a5965293645228c Mon Sep 17 00:00:00 2001 From: lc Date: Thu, 2 Nov 2023 07:59:51 -0500 Subject: [PATCH 1/3] fix(panic): fix output panic --- cmd/gau/main.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cmd/gau/main.go b/cmd/gau/main.go index 5397bfc..bed608b 100644 --- a/cmd/gau/main.go +++ b/cmd/gau/main.go @@ -31,28 +31,26 @@ func main() { results := make(chan string) - var out io.Writer + var out = os.Stdout // Handle results in background if config.Output != "" { - out, err := os.OpenFile(config.Output, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) + out, err = os.OpenFile(config.Output, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) if err != nil { log.Fatalf("Could not open output file: %v\n", err) } defer out.Close() - } else { - out = os.Stdout } - writeWg := new(sync.WaitGroup) + var writeWg sync.WaitGroup writeWg.Add(1) - go func(JSON bool) { + go func(out io.Writer, JSON bool) { defer writeWg.Done() if JSON { output.WriteURLsJSON(out, results, config.Blacklist, config.RemoveParameters) } else if err = output.WriteURLs(out, results, config.Blacklist, config.RemoveParameters); err != nil { log.Fatalf("error writing results: %v\n", err) } - }(config.JSON) + }(out, config.JSON) workChan := make(chan runner.Work) gau.Start(workChan, results) From 6dae657f9454b6577e4afd73025046d367ba1750 Mon Sep 17 00:00:00 2001 From: lc Date: Thu, 2 Nov 2023 08:08:18 -0500 Subject: [PATCH 2/3] fix(panic): fix output panic --- pkg/output/output.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/output/output.go b/pkg/output/output.go index a2d55dc..fa2c1bc 100644 --- a/pkg/output/output.go +++ b/pkg/output/output.go @@ -22,12 +22,14 @@ func WriteURLs(writer io.Writer, results <-chan string, blacklistMap mapset.Set[ if err != nil { continue } - if blacklistMap.Contains(strings.ToLower(path.Ext(u.Path))) { + if path.Ext(u.Path) != "" && blacklistMap.Contains(strings.ToLower(path.Ext(u.Path))) { continue } - if RemoveParameters && !lastURL.Add(u.Host+u.Path) { + + if RemoveParameters && !lastURL.Contains(u.Host+u.Path) { continue } + lastURL.Add(u.Host + u.Path) buf.B = append(buf.B, []byte(result)...) buf.B = append(buf.B, "\n"...) From 4fa052d86f9e3a8d8dc2f18d5b2d0beb2a2fbf67 Mon Sep 17 00:00:00 2001 From: lc Date: Thu, 2 Nov 2023 08:08:34 -0500 Subject: [PATCH 3/3] fix(panic): update version --- pkg/providers/providers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/providers/providers.go b/pkg/providers/providers.go index 055470e..9e5b283 100644 --- a/pkg/providers/providers.go +++ b/pkg/providers/providers.go @@ -6,7 +6,7 @@ import ( "github.com/valyala/fasthttp" ) -const Version = `2.2.0` +const Version = `2.2.1` // Provider is a generic interface for all archive fetchers type Provider interface {