|
| 1 | +// The parseParameter function will typically be called for every page and |
| 2 | +// the setParameter function is called by each active plugin to bundle specific attacks |
| 3 | + |
| 4 | +// Note that new custom input vector scripts will initially be disabled |
| 5 | +// Right click the script in the Scripts tree and select "enable" |
| 6 | + |
| 7 | +/* |
| 8 | +This variant script adds arbitrary URL queries to all requests. |
| 9 | +It can be used if you know (or suspect) that the target uses these parameters in some cases |
| 10 | +and you want to make sure you test them on all pages, whether or not ZAP sees them being used. |
| 11 | +*/ |
| 12 | + |
| 13 | +var AbstractPlugin = Java.type( |
| 14 | + "org.parosproxy.paros.core.scanner.AbstractPlugin" |
| 15 | +); |
| 16 | + |
| 17 | +function parseParameters(helper, msg) { |
| 18 | + // Add whichever parameters you need here, first is the name, the second is the default value |
| 19 | + // In this case they will be appended to all requests, but you can choose to only add |
| 20 | + // them to specific requests (like GETs) if you like by adding the relevant conditionals. |
| 21 | + helper.addParamQuery("q", "r"); |
| 22 | + helper.addParamQuery("s", "t"); |
| 23 | +} |
| 24 | + |
| 25 | +function setParameter(helper, msg, param, value, escaped) { |
| 26 | + var uri = msg.getRequestHeader().getURI(); |
| 27 | + var query = uri.getEscapedQuery(); |
| 28 | + if (query == null) { |
| 29 | + query = ""; |
| 30 | + } else { |
| 31 | + query += "&"; |
| 32 | + } |
| 33 | + query += param + "="; |
| 34 | + if (value == null) { |
| 35 | + value = ""; |
| 36 | + } |
| 37 | + query += escaped ? value : AbstractPlugin.getURLEncode(value); |
| 38 | + uri.setEscapedQuery(query); |
| 39 | +} |
0 commit comments