OWASP ZAP python API错误运行脚本
问题描述:
我想使用python-owasp-zap api。我下载并安装了python-owasp-zap所需的所有存储库。当我运行在网站https://github.com/zaproxy/zaproxy/wiki/ApiPython给出的示例代码时,出现以下错误,请帮助我。OWASP ZAP python API错误运行脚本
Traceback (most recent call last):
File "zap2.py", line 34, in <module>
while (int(zap.spider.status()) < 100):
ValueError: invalid literal for int() with base 10: 'Does Not Exist'
然后,我试图消除paranthesis从状态的方法:
while (int(zap.spider.status) < 100):
print 'Spider progress %: ' + zap.spider.status
time.sleep(2)
,我得到以下错误:
TypeError: Int argument must be an Int or string not an InstanceMethod
帮助整顿错误是最赞赏。
答
您需要使用:
while (int(zap.spider.status()) < 100):
print 'Spider progress %: ' + zap.spider.status()
time.sleep(5)
我们这里有一个示例脚本,我们用来扫描wavsep:https://github.com/zapbot/zap-mgmt-scripts/blob/master/wavsep/wavsep-1.5-spider-scan.py
我会尽快更新ZAP维基)
西蒙( ZAP项目主管)
答
Spider.status()需要一个参数scanid。这是为了跟踪不同的扫描。您需要指定这是哪种扫描,并且可以按如下所示完成。
target = 'some decimal base address'
scanid = zap.spider.scan(target)
while (int(zap.spider.status(scanid)) < 100):
print 'Spider progress %: ' + zap.spider.status(scanid)
time.sleep(5)
它说'zap.spider.status()'正在返回'不存在'。你需要弄清楚为什么它会这样做,而不是返回一个小数 – Fabricator
sry我不能得到你 – user3264821
我搞砸了我的owasp zap api安装,现在我得到'IOError:[Errno套接字错误] [Errno 11004] getaddrinfo失败' – user3264821