security - OWASP ZAP API 根元素丢失错误
问题描述
我正在使用 OWASP ZAP API 在 Windows 上编写一个程序,以自动执行针对目标 URL 运行 ZAP 的过程。到目前为止,我能够使用 zap.bat 文件和参数 -daemon -config api.disablekey=true 成功启动应用程序。启动应用程序,ZAP 能够监听 localhost:8080。我还创建了传递这些参数的 ClientAPi 对象:
ClientApi zaproxy = new ClientApi("127.0.0.1", 8080, null);
我现在尝试使用 Context 类中的 includeInContext(string contextname, string regex) 方法设置上下文,但出现错误:
System.Exception: 'System.Xml.XmlException: Root element is missing.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
at OWASPZAPDotNetAPI.ClientApi.CallApiRaw(String component, String operationType, String operationName, Dictionary 2 parameters)
at OWASPZAPDotNetAPI.ClientApi.CallApi(String component, String operationType, String operationName, Dictionary 2 parameters)
at OWASPZAPDotNetAPI.Generated.Context.includeInContext(String contextname, String regex)
但是,当我在后台启动 ZAP GUI 然后运行守护程序并设置上下文时,它似乎可以工作。有人可以让我知道如何解决上述错误吗?谢谢!
解决方案
看看https://www.zaproxy.org/docs/automate/ - 这列出了您可以自动化 ZAP 的方法。我怀疑其中一个打包的扫描可能更容易让您使用。
推荐阅读
- java - 如何将图像集放在excel java单元格的中心
- spring - 如何使用 BodyInserters.fromFormData 发送对象
- google-cloud-platform - 是否可以将所有 GA 数据导入大查询
- r - 如何在矩阵中插入“n”列
- javascript - 如何将音频从浏览器流式传输到服务器?
- php - 使用比较 2 个表来加工大多数 Suitabale 名称
- mongodb - 为什么在 MongoDB Compass 中每次刷新时索引使用量都会增加(增加 2)
- sql - 过去 N 周的 SQL 销售额总和,包括销售额为 0 的一周
- angular - 如何以角度控制浏览器后退按钮
- php - PHP Curl 在 200 毫秒后停止读取