Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support HTTP2 option #49

Merged
merged 2 commits into from
Oct 7, 2020
Merged

Support HTTP2 option #49

merged 2 commits into from
Oct 7, 2020

Conversation

shubham14bajpai
Copy link
Contributor

@shubham14bajpai shubham14bajpai commented Oct 6, 2020

This PR makes it possible to switch to send HTTP/2 requests when supported by the server.
Also found that connections is not passed to the attacker.Options struct while rebasing, fixed that as well 😃

Added a flag --http2 for switching to HTTP/2

mayadata:ali$ ./ali --help
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.
  -c, --connections int     Amount of maximum open idle connections per target host (default 10000
      --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.
      --http2               Issue HTTP/2 requests to servers which support it. (default true) (default true)
  -k, --keepalive           Use HTTP persistent connection. (default true)
  -M, --max-body int        Max bytes to capture from response bodies. Give -1 for no limit. (default -1)
  -W, --max-workers uint    Amount of maximum workers to spawn. (default 18446744073709551615)
  -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.
  -w, --workers uint        Amount of initial workers to spawn. (default 10)

Examples:
  ali --duration=10m --rate=100 http://host.xz

Author:
  Ryo Nakao <ryo@nakao.dev>

@shubham14bajpai shubham14bajpai mentioned this pull request Oct 6, 2020
1 task
@codecov-commenter
Copy link

codecov-commenter commented Oct 6, 2020

Codecov Report

Merging #49 into master will decrease coverage by 0.24%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #49      +/-   ##
==========================================
- Coverage   77.78%   77.55%   -0.23%     
==========================================
  Files           8        8              
  Lines         369      374       +5     
==========================================
+ Hits          287      290       +3     
- Misses         63       65       +2     
  Partials       19       19              
Impacted Files Coverage Δ
attacker/attacker.go 67.50% <0.00%> (-1.94%) ⬇️
main.go 79.42% <0.00%> (+0.21%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba927ef...28483e9. Read the comment docs.

@nakabonne
Copy link
Owner

@shubham14bajpai Sorry for lacking a description. We need to make users possible to specify whether to enable HTTP/2 requests by flag like:

  --http2           Issue HTTP/2 requests to servers which support it. (default true)

@codecov-io
Copy link

codecov-io commented Oct 7, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@fd4e04b). Click here to learn what that means.
The diff coverage is 92.86%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #49   +/-   ##
=========================================
  Coverage          ?   77.72%           
=========================================
  Files             ?        8           
  Lines             ?      377           
  Branches          ?        0           
=========================================
  Hits              ?      293           
  Misses            ?       65           
  Partials          ?       19           
Impacted Files Coverage Δ
attacker/attacker.go 67.50% <0.00%> (ø)
main.go 80.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd4e04b...b78afb1. Read the comment docs.

@shubham14bajpai
Copy link
Contributor Author

@nakabonne Addressed the review comment and updated the PR description. PTAL.

KeepAlive: c.keepAlive,
Workers: c.workers,
MaxWorkers: c.maxWorkers,
Connections: c.connections,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

Copy link
Owner

@nakabonne nakabonne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shubham14bajpai Thanks for your contribution!

@nakabonne nakabonne merged commit cccdee3 into nakabonne:master Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants