我正在尝试使用API扫描器Docker映像,如下所述:https://www.zaproxy.org/blog/2017-06-19-scanning-apis-with-zap/和我想使用regexp进行一些请求替换。我用的是命令:
docker run -v $(pwd):/zap/wrk/:rw --network=host -t owasp/zap2docker-weekly zap-api-scan.py --hook=/zap/wrk/authentication-hooks.py -t docs/openapi.yaml -f openapi -w output/oppenapi.md -z "-configfile /zap/wrk/zapproxy.prop" -d加上"zapproxy.prop":
replacer.full_list(0).description=customerId
replacer.full_list(0).enabled=true
replacer.full_list(0).matchtype=REQ_HEADER_STR
replacer.full_list(0).matchstr=/api/customers/\d+
replacer.full_list(0).regex=true
replacer.full_list(0).replacement=/api/customers/1对于我想要修改的URL,这个替换不起作用: GET /api/customers/10。通过GUI使用的规则也很好。
我也试过:
replacer.full_list(0).description=customerId
replacer.full_list(0).enabled=true
replacer.full_list(0).matchtype=REQ_HEADER_STR
replacer.full_list(0).matchstr=/api/customers/10
replacer.full_list(0).regex=false
replacer.full_list(0).replacement=/api/customers/1它也很好用。
Simon建议检查GUI如何保存这些设置:https://www.zaproxy.org/faq/how-do-you-find-out-what-key-to-use-to-set-a-config-value-on-the-command-line/。正如你所看到的

为了正确地传递这个正则表达式,我需要做些什么吗?
发布于 2021-03-03 22:03:10
逃跑是问题所在:
replacer.full_list(0).description=clientId
replacer.full_list(0).enabled=true
replacer.full_list(0).matchtype=REQ_HEADER_STR
replacer.full_list(0).matchstr=/api/customers/\\d+
replacer.full_list(0).regex=true
replacer.full_list(0).replacement=/api/customers/2https://stackoverflow.com/questions/66446342
复制相似问题