如何使用 ZAP 在 HTTP Post 期间自动执行主动扫描?

How to use ZAP to automate active scan during HTTP Post?

是否有使用 ZAP 进行主动扫描的最佳实践?

例如...我们想主动扫描一个登录页面,输入一些注入代码,看看是否会注入登录功能..

我们希望使用 zapv2 库在脚本中实现整个扫描,这样做有什么最佳实践吗?

目前,我们可以使用 zapv2 脚本很好地被动扫描站点,但仍然不知道如何使用 ZAP/zapV2 自动进行主动扫描

github 存储库有示例:https://github.com/zaproxy/zap-api-python/tree/master/src/examples

这里有一篇不错的文章:https://www.coveros.com/scripting-owasp-zap/ zaproxy wiki 也有详细信息:https://github.com/zaproxy/zaproxy/wiki/ApiPython 等等

这里有一个 运行 通过 python API 主动扫描的例子(假设你已经爬取或代理了一些单元测试或其他东西来构建站点树, target 已定义):

print ('Active Scanning target {}'.format(target))
scanid = zap.ascan.scan(target)
while (int(zap.ascan.status(scanid)) < 100):
    # Loop until the scanner has finished
    print ('Scan progress %: {}'.format(zap.ascan.status(scanid)))
    time.sleep(5)

print ('Active Scan completed')

当然,您也可以直接点击 google 或 duckduckgo 或任何您喜欢的搜索引擎,然后尝试 "zaproxy python examples".