Skip to content

Conversation

@kingthorin
Copy link
Member

@kingthorin kingthorin commented Jun 19, 2023

  • Add initial tips and supporting images.

@kingthorin
Copy link
Member Author

kingthorin commented Jun 19, 2023

This is what I came up with for standalone script code to add a rule:

// This script adds a Replacer rule
var Control = Java.type("org.parosproxy.paros.control.Control");
var extReplacer = Control.getSingleton().getExtensionLoader().getExtension("ExtensionReplacer");

var replacerRule = Java.type("org.zaproxy.zap.extension.replacer.ReplacerParamRule");
// Match types: REQ_HEADER, REQ_HEADER_STR, REQ_BODY_STR, RESP_HEADER, RESP_HEADER_STR, RESP_BODY_STR
var matchType = Java.type("org.zaproxy.zap.extension.replacer.ReplacerParamRule.MatchType");

// https://github.com/zaproxy/zap-extensions/blob/e072df8ca4f7aff54d6e2dda98cfd8503810fa2c/addOns/replacer/src/main/java/org/zaproxy/zap/extension/replacer/ReplacerParamRule.java#L93-L107
var newRule = new replacerRule("Show hidden UI elements", "", matchType.RESP_BODY_STR, "hidden", false, "hizzen", null, true, false);
extReplacer.getParams().addRule(newRule);
Method ref
//     public ReplacerParamRule(
//            String description,
//            String url,
//            MatchType matchType,
//            String matchString,
//            boolean matchRegex,
//            String replacement,
//            List<Integer> initiators,
//            boolean enabled,
//            boolean tokenProcessingEnabled)

I did discover that replacer doesn't prevent creation of duplicates. Not sure if we should care about that or not?

Shall I add these in <details> blocks for each entry?

@kingthorin
Copy link
Member Author

As discussed via IRC the code refs could be permalinked to the github repo with commit sha.

@kingthorin kingthorin force-pushed the tips-part1 branch 2 times, most recently from e655329 to 6f5c41f Compare June 21, 2023 01:00
@kingthorin kingthorin force-pushed the tips-part1 branch 3 times, most recently from a90fb33 to 5c1562e Compare June 21, 2023 13:46
@kingthorin
Copy link
Member Author

I think this is good to go. I'll add the script bits in another PR.

- Add initial tips and supporting images.

Signed-off-by: kingthorin <kingthorin@users.noreply.github.com>
@kingthorin
Copy link
Member Author

Okay really ready for review this time 😉

@thc202
Copy link
Member

thc202 commented Jun 22, 2023

Thank you!

@kingthorin
Copy link
Member Author

For whoever adds the second review. I know the folder structure probably needs some intro'ish README.md files. I'll tackle that in the next (or a future) PR.

@psiinon psiinon merged commit 557a449 into zaproxy:main Jun 22, 2023
@kingthorin kingthorin deleted the tips-part1 branch June 22, 2023 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants