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

Hard to use jq to extract desired set of bypasses from json results #26

Open
dankegel opened this issue Jan 5, 2025 · 0 comments
Open

Comments

@dankegel
Copy link
Contributor

dankegel commented Jan 5, 2025

Thank you for the many improvements to waf-bypass, including curl replay and json output.

But there is a usability issue with the json file.
Ideally I'd like to be able to use jq (the swiss army knife for json) to export the curl commands for just a particular subset of bypasses, e.g.

jq -r '.[] | select(.result=="BYPASSED" and .dir=="RCE" and .zone=="BODY" and .enc=="none") | .curl' waf-bypass.json > repro.sh

in such a way that the repro.sh is a runnable script that will reproduce that set of bypasses.

Unfortunately, while jq can probably do that with the current json schema, I can't figure out how to do it.
This suggests to me that a more table-like curl section in the json file might be appropriate.
It wasn't hard to code; see the attached patch for a proof of concept.
The json file output after applying the proof-of-concept patch does work with the jq command above, and makes me happy :-)

I'll probably try to submit a pull request that adds an option to replace the current curl section with this new format and see how that looks.

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

No branches or pull requests

1 participant