From b6045f5c22a1ab042cffa2eb237b6c1ce4ae9dc4 Mon Sep 17 00:00:00 2001 From: nakabonne Date: Wed, 16 Sep 2020 22:07:02 +0900 Subject: [PATCH] Allow zero values --- README.md | 18 ++++++++++++------ attacker/attacker.go | 9 --------- gui/widgets.go | 2 +- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 50d8d65..e31fcc9 100644 --- a/README.md +++ b/README.md @@ -21,11 +21,17 @@ Give the target URL and press Enter, then the attack will be launched with defau ### Options -**Rate Limit** +#### Rate Limit -**Duration** +The request rate per time unit to issue against the targets. +Give 0 then it will send requests as fast as possible. -**Timeout** +#### Duration +The amount of time to issue requests to the targets. Give `0s` for an infinite attack. Press `Ctrl-C` to stop. +Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". Default is `10s`. + +#### Timeout +The timeout for each request. `0s` means to disable timeouts. **Method** @@ -35,17 +41,17 @@ Give the target URL and press Enter, then the attack will be launched with defau ## Features -#### Plot in real-time +### Plot in real-time Currently it only plots latencies, but in the near future more metrics will be drawn as well. ![Screenshot](images/real-time.gif) -#### Visualize the attack progress +### Visualize the attack progress This will help you during long tests. ![Screenshot](images/progress.gif) -#### Mouse support +### Mouse support With the help of [mum4k/termdash](https://github.com/mum4k/termdash), intuitive operation is supported. ![Screenshot](images/mouse-support.gif) diff --git a/attacker/attacker.go b/attacker/attacker.go index 28c7b7b..ee4c36c 100644 --- a/attacker/attacker.go +++ b/attacker/attacker.go @@ -46,15 +46,6 @@ func Attack(ctx context.Context, target string, resCh chan *Result, opts Options if target == "" { return nil } - if opts.Rate == 0 { - opts.Rate = DefaultRate - } - if opts.Duration == 0 { - opts.Duration = DefaultDuration - } - if opts.Timeout == 0 { - opts.Timeout = DefaultTimeout - } if opts.Method == "" { opts.Method = DefaultMethod } diff --git a/gui/widgets.go b/gui/widgets.go index 5c0a99e..f0f6727 100644 --- a/gui/widgets.go +++ b/gui/widgets.go @@ -42,7 +42,7 @@ func newWidgets() (*widgets, error) { if err != nil { return nil, err } - navi, err := newText("Ctrl-c: quit, Enter: attack") + navi, err := newText("Ctrl-C: quit, Enter: attack") if err != nil { return nil, err }