Hello just wondering if someone already wrote a script for Zap to modify headers automatically with out me having to do it on each response/request.. example. modify response from 3xx or 4xx to 2xx to bypass some misconfigure sites. If I can't find any I will try to write my own, just trying not to reinvent the wheel. thanks
2 Answers
Answered here: https://github.com/zaproxy/zaproxy/issues/4022
For simple replacement theres the Replacer add-on: https://github.com/zaproxy/zap-extensions/wiki/HelpAddonsReplacerReplacer and for more complicated situations there are httpsender scripts: https://github.com/zaproxy/community-scripts/tree/master/httpsender
If you're set on using a script you could build an HttpSender script that does something like:
function sendingRequest(msg, initiator, helper) {
// Nothing to do here
}
function responseReceived(msg, initiator, helper) {
msg.setResponseHeader(msg.getResponseHeader().toString().replace('404','200'))
}