From ab2b8f33a7726a924cfe5837c708183fdc40d77c Mon Sep 17 00:00:00 2001 From: firefart <105281+firefart@users.noreply.github.com> Date: Mon, 3 Mar 2025 00:49:19 +0100 Subject: [PATCH] cleanup --- .devcontainer/devcontainer.json | 4 +++- .idea/.gitignore | 8 -------- .idea/gobuster.iml | 9 --------- .idea/modules.xml | 8 -------- .idea/vcs.xml | 6 ------ cli/gobuster.go | 2 +- gobusterdir/gobusterdir_test.go | 23 +++++++++++++++-------- libgobuster/helpers_test.go | 6 ------ 8 files changed, 19 insertions(+), 47 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/gobuster.iml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b447d76..73cf5d8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -18,9 +18,11 @@ "shardulm94.trailing-spaces", "IBM.output-colorizer", "github.vscode-github-actions", + "ms-azuretools.vscode-docker", "task.vscode-task", "redhat.vscode-yaml", - "usernamehw.errorlens" + "usernamehw.errorlens", + "Gruntfuggly.todo-tree" ] } } diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/gobuster.iml b/.idea/gobuster.iml deleted file mode 100644 index 5e764c4..0000000 --- a/.idea/gobuster.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 75b76c4..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/cli/gobuster.go b/cli/gobuster.go index b87040d..5aea873 100644 --- a/cli/gobuster.go +++ b/cli/gobuster.go @@ -96,7 +96,7 @@ func printProgress(g *libgobuster.Gobuster) { requestsExpected := g.Progress.RequestsExpected() percent := float32(requestsIssued) * 100.0 / float32(requestsExpected) if math.IsNaN(float64(percent)) { - percent = float32(0) + percent = 0.0 } s := fmt.Sprintf("%sProgress: %d / %d (%3.2f%%)", TERMINAL_CLEAR_LINE, requestsIssued, requestsExpected, percent) _, _ = fmt.Fprint(os.Stderr, s) diff --git a/gobusterdir/gobusterdir_test.go b/gobusterdir/gobusterdir_test.go index 176f468..8053764 100644 --- a/gobusterdir/gobusterdir_test.go +++ b/gobusterdir/gobusterdir_test.go @@ -19,16 +19,23 @@ func TestAdditionalWordsLen(t *testing.T) { globalOpts := libgobuster.Options{} for _, x := range tt { - opts := OptionsDir{} - opts.ExtensionsParsed.Set = x.extensions + t.Run(x.testName, func(t *testing.T) { + t.Parallel() - d, _ := New(&globalOpts, &opts, nil) + opts := OptionsDir{} + opts.ExtensionsParsed.Set = x.extensions - calculatedLen := d.AdditionalWordsLen() - wordsLen := len(d.AdditionalWords("dummy")) + d, err := New(&globalOpts, &opts, nil) + if err != nil { + t.Fatalf("got error creating gobusterdir: %v", err) + } - if calculatedLen != wordsLen { - t.Fatalf("Mismatched additional words length: %d got %d generated words %v", calculatedLen, wordsLen, d.AdditionalWords("dummy")) - } + calculatedLen := d.AdditionalWordsLen() + wordsLen := len(d.AdditionalWords("dummy")) + + if calculatedLen != wordsLen { + t.Fatalf("Mismatched additional words length: %d got %d generated words %v", calculatedLen, wordsLen, d.AdditionalWords("dummy")) + } + }) } } diff --git a/libgobuster/helpers_test.go b/libgobuster/helpers_test.go index 0d3047f..34fde20 100644 --- a/libgobuster/helpers_test.go +++ b/libgobuster/helpers_test.go @@ -173,7 +173,6 @@ func TestLineCounter(t *testing.T) { {"Empty 3", "\r\n", 1}, // these are wrong, but I've found no good way to handle those } for _, x := range tt { - x := x // NOTE: https://github.com/golang/go/wiki/CommonMistakes#using-goroutines-on-loop-iterator-variables t.Run(x.testName, func(t *testing.T) { t.Parallel() r := strings.NewReader(x.s) @@ -204,7 +203,6 @@ func TestLineCounterSlow(t *testing.T) { {"Empty 3", "\r\n", 0}, } for _, x := range tt { - x := x // NOTE: https://github.com/golang/go/wiki/CommonMistakes#using-goroutines-on-loop-iterator-variables t.Run(x.testName, func(t *testing.T) { t.Parallel() r := strings.NewReader(x.s) @@ -286,7 +284,6 @@ func TestParseExtensions(t *testing.T) { } for _, x := range tt { - x := x // NOTE: https://github.com/golang/go/wiki/CommonMistakes#using-goroutines-on-loop-iterator-variables t.Run(x.testName, func(t *testing.T) { t.Parallel() ret, err := ParseExtensions(x.extensions) @@ -333,7 +330,6 @@ func TestParseCommaSeparatedInt(t *testing.T) { } for _, x := range tt { - x := x // NOTE: https://github.com/golang/go/wiki/CommonMistakes#using-goroutines-on-loop-iterator-variables t.Run(x.stringCodes, func(t *testing.T) { t.Parallel() want := NewSet[int]() @@ -365,7 +361,6 @@ func BenchmarkParseExtensions(b *testing.B) { } for _, x := range tt { - x := x // NOTE: https://github.com/golang/go/wiki/CommonMistakes#using-goroutines-on-loop-iterator-variables b.Run(x.testName, func(b2 *testing.B) { for y := 0; y < b2.N; y++ { _, _ = ParseExtensions(x.extensions) @@ -390,7 +385,6 @@ func BenchmarkParseCommaSeparatedInt(b *testing.B) { } for _, x := range tt { - x := x // NOTE: https://github.com/golang/go/wiki/CommonMistakes#using-goroutines-on-loop-iterator-variables b.Run(x.testName, func(b2 *testing.B) { for y := 0; y < b2.N; y++ { _, _ = ParseCommaSeparatedInt(x.stringCodes)