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

Match/filter response time #597

Merged
merged 6 commits into from
May 6, 2022
Merged

Match/filter response time #597

merged 6 commits into from
May 6, 2022

Conversation

LuitelSamikshya
Copy link
Contributor

@LuitelSamikshya LuitelSamikshya commented Apr 29, 2022

This PR adds flags match-response-time / mrt and filter-response-time / frt

-mrt, -match-response-time string  match response with specified response time in seconds (-mrt '< 1')
-frt, -filter-response-time string  filter response with specified response time in seconds (-frt '> 1')

Example:

chaos -d hackerone.com | ./httpx -mrt '> 1' -silent

https://resources.hackerone.com [1.351540459s]
https://www.hackerone.com [2.282149667s]
https://support.hackerone.com [2.520162417s]
https://api.hackerone.com [4.5961245s]

@LuitelSamikshya LuitelSamikshya linked an issue Apr 29, 2022 that may be closed by this pull request
@LuitelSamikshya LuitelSamikshya self-assigned this Apr 29, 2022
@LuitelSamikshya LuitelSamikshya added Type: Enhancement Most issues will probably ask for additions or changes. Status: Review Needed The issue has a PR attached to it which needs to be reviewed labels Apr 29, 2022
Copy link
Member

@ehsandeep ehsandeep left a comment

Choose a reason for hiding this comment

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

Hi @LuitelSamikshya,

Could you please include an example using response-based matcher/filter? also we can include the time unit used with matcher/filter in CLI flag description, which supposed to be in second in this case.

chaos -d hackerone.com | ./httpx  -mrt '> 1' -silent
[FTL] invalid value provided for -mrt, -match-response-time

@LuitelSamikshya
Copy link
Contributor Author

Hi @LuitelSamikshya,

Could you please include an example using response-based matcher/filter? also we can include the time unit used with matcher/filter in CLI flag description, which supposed to be in second in this case.

chaos -d hackerone.com | ./httpx  -mrt '> 1' -silent
[FTL] invalid value provided for -mrt, -match-response-time

Sure, here are some examples:
./httpx -l list.txt -silent -mrt ">=2"
./httpx -l list.txt -silent -frt ">1"

@LuitelSamikshya LuitelSamikshya requested a review from ehsandeep May 5, 2022 21:50
Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

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

Further improvements:

  • Use https://github.com/dustin/go-humanize to express units (eg 2s, 200ms)
  • Add tests

@ehsandeep ehsandeep merged commit 2918235 into dev May 6, 2022
@ehsandeep ehsandeep deleted the match/filter-response-time branch May 6, 2022 08:45
@ehsandeep ehsandeep added Status: Completed Nothing further to be done with this issue. Awaiting to be closed. and removed Status: Review Needed The issue has a PR attached to it which needs to be reviewed labels May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Completed Nothing further to be done with this issue. Awaiting to be closed. Type: Enhancement Most issues will probably ask for additions or changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Match / Filter Hosts based on specified response time
3 participants