diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 3f40dd07..0a77fb4d 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -35,6 +35,7 @@ * [Kiblyn11](https://github.com/Kiblyn11) * [l4yton](https://github.com/l4yton) * [lc](https://github.com/lc) +* [moamlrh](https://github.com/moamlrh) * [mprencipe](https://github.com/mprencipe) * [nnwakelam](https://twitter.com/nnwakelam) * [noraj](https://pwn.by/noraj) diff --git a/pkg/input/input.go b/pkg/input/input.go index e34c1068..b7b32364 100644 --- a/pkg/input/input.go +++ b/pkg/input/input.go @@ -2,9 +2,10 @@ package input import ( "fmt" - "github.com/ffuf/ffuf/v2/pkg/ffuf" "strings" + "github.com/ffuf/ffuf/v2/pkg/ffuf" + "github.com/ffuf/pencode/pkg/pencode" ) @@ -253,4 +254,3 @@ func (i *MainInputProvider) Total() int { } return count } - diff --git a/pkg/output/stdout.go b/pkg/output/stdout.go index 3505a64b..e57e63d0 100644 --- a/pkg/output/stdout.go +++ b/pkg/output/stdout.go @@ -182,7 +182,27 @@ func (s *Stdoutput) Progress(status ffuf.Progress) { dur -= mins * time.Minute secs := dur / time.Second - fmt.Fprintf(os.Stderr, "%s:: Progress: [%d/%d] :: Job [%d/%d] :: %d req/sec :: Duration: [%d:%02d:%02d] :: Errors: %d ::", TERMINAL_CLEAR_LINE, status.ReqCount, status.ReqTotal, status.QueuePos, status.QueueTotal, reqRate, hours, mins, secs, status.ErrorCount) + percentage := float64(status.ReqCount) / float64(status.ReqTotal) * 100 + + barLength := 50 // Length of the progress bar + completed := int(float64(barLength) * (percentage / 100)) + progressBar := "[" + strings.Repeat("=", completed) + strings.Repeat(" ", barLength-completed) + "]" + + fmt.Fprintf(os.Stderr, "%s:: Progress: %s %.2f%% (%d/%d) :: Job [%d/%d] :: %d req/sec :: Duration: [%d:%02d:%02d] :: Errors: %d ::%s", + TERMINAL_CLEAR_LINE, + progressBar, + percentage, + status.ReqCount, + status.ReqTotal, + status.QueuePos, + status.QueueTotal, + reqRate, + hours, + mins, + secs, + status.ErrorCount, + "\r", + ) } func (s *Stdoutput) Info(infostring string) {