Skip to content

Commit

Permalink
Update options usage
Browse files Browse the repository at this point in the history
  • Loading branch information
nakabonne committed Oct 2, 2020
1 parent c08cf45 commit 0091795
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,22 @@ Press Enter when the UI appears, then the attack will be launched with default o

```bash
ali -h
Usage:
ali [flags] <target URL>

Flags:
-b, --body string A request body to be sent.
-B, --body-file string The path to file whose content will be set as the http request body.
--debug Run in debug mode.
-d, --duration duration The amount of time to issue requests to the targets. Give 0s for an infinite attack. (default 10s)
-H, --header strings A request header to be sent. Can be used multiple times to send multiple headers.
-m, --method string An HTTP request method for each request. (default "GET")
-r, --rate int The request rate per second to issue against the targets. Give 0 then it will send requests as fast as possible. (default 50)
-t, --timeout duration The timeout for each request. 0s means to disable timeouts. (default 30s)
-v, --version Print the current version.
```

| Name | Description | Default |
|------|-------------|---------|
| `--rate` | The request rate per second to issue against the targets. Give 0 then it will send requests as fast as possible. | 50 |
| `--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". | 10s |
| `--timeout` | The timeout for each request. `0s` means to disable timeouts. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". | 30s |
| `--method` | An HTTP request method for each request. | GET |
| `--header` | A request header to be sent. Can be used multiple times to send multiple headers | |
| `--body` | A request body to be sent. | |
| `--body-file` | The path to file whose content will be set as the http request body. | |
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".

## Features

Expand Down
18 changes: 9 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ func main() {
stdout: os.Stdout,
stderr: os.Stderr,
}
flagSet.IntVarP(&c.rate, "rate", "r", 50, "the request rate per second to issue against the targets")
flagSet.DurationVarP(&c.duration, "duration", "d", time.Second*10, "the amount of time to issue requests to the targets")
flagSet.DurationVarP(&c.timeout, "timeout", "t", time.Second*30, "the timeout for each request")
flagSet.StringVarP(&c.method, "method", "m", "GET", "an HTTP request method for each request")
flagSet.StringSliceVarP(&c.headers, "header", "H", []string{}, "a request header to be sent. can be used multiple times to send multiple headers")
flagSet.StringVarP(&c.body, "body", "b", "", "a request body to be sent")
flagSet.StringVarP(&c.bodyFile, "body-file", "B", "", "the file whose content will be set as the http request body")
flagSet.BoolVarP(&c.version, "version", "v", false, "print the current version")
flagSet.BoolVar(&c.debug, "debug", false, "run in debug mode")
flagSet.IntVarP(&c.rate, "rate", "r", 50, "The request rate per second to issue against the targets. Give 0 then it will send requests as fast as possible.")
flagSet.DurationVarP(&c.duration, "duration", "d", time.Second*10, "The amount of time to issue requests to the targets. Give 0s for an infinite attack.")
flagSet.DurationVarP(&c.timeout, "timeout", "t", time.Second*30, "The timeout for each request. 0s means to disable timeouts.")
flagSet.StringVarP(&c.method, "method", "m", "GET", "An HTTP request method for each request.")
flagSet.StringSliceVarP(&c.headers, "header", "H", []string{}, "A request header to be sent. Can be used multiple times to send multiple headers.")
flagSet.StringVarP(&c.body, "body", "b", "", "A request body to be sent.")
flagSet.StringVarP(&c.bodyFile, "body-file", "B", "", "The path to file whose content will be set as the http request body.")
flagSet.BoolVarP(&c.version, "version", "v", false, "Print the current version.")
flagSet.BoolVar(&c.debug, "debug", false, "Run in debug mode.")
flagSet.Usage = usage
if err := flagSet.Parse(os.Args[1:]); err != nil {
if !errors.Is(err, flag.ErrHelp) {
Expand Down

0 comments on commit 0091795

Please sign in to comment.