gpt4 book ai didi

python - 如何使用python将ZAP集成到jenkins?

转载 作者:太空宇宙 更新时间:2023-11-03 17:28:24 25 4
gpt4 key购买 nike

其实我不懂python。为了将 zap 与 jenkins 集成,我用谷歌搜索了很多。但我找不到任何有用的东西。
这是link我发现

我按照步骤操作..但是在执行 python 脚本时。

Traceback (most recent call last):
File "zap-python-script.py", line 15, in zap.urlopen(target)
File "/usr/lib/python2.6/site-packages/python_owasp_zap_v2.4-0.0.2-py2.6.egg/zapv2/init.py", line 116, in urlopen return urllib.urlopen(*args, **kwargs).read()
File "/usr/lib64/python2.6/urllib.py", line 86, in urlopen return opener.open(url)
File "/usr/lib64/python2.6/urllib.py", line 207, in open return getattr(self, name)(url)
File "/usr/lib64/python2.6/urllib.py", line 346, in open_httph.endheaders()
File "/usr/lib64/python2.6/httplib.py", line 908, in endheadersself._send_output()
File "/usr/lib64/python2.6/httplib.py", line 780, in _send_outputself.send(msg)
File "/usr/lib64/python2.6/httplib.py", line 739, in sendself.connect()
File "/usr/lib64/python2.6/httplib.py", line 720, in connectself.timeout)
File "/usr/lib64/python2.6/socket.py", line 567, in create_connectionraise error, msg

IOError: [Errno socket error] [Errno 111] Connection refused

我收到此错误。这里 ttarget = http://10.200.35.11:7006/myapplicationurl

请向我提供解决此错误的解决方案,或者建议我一种将 ZAP 与 jenkins 集成的方法。

Python代码

#!/usr/bin/env python
import time
from pprint import pprint
from zapv2 import ZAPv2
target = 'http://10.200.35.11:7006/MyApp/login.jsp'
# zap = ZAPv2()
# Use the line below if ZAP is not listening on 8090
zap=ZAPv2(proxies='http':http://127.0.0.1:8090','https':'http://127.0.0.1:8090'})
# do stuff
print 'Accessing target %s' % target
# try have a unique enough session...
zap.urlopen(target)
# Give the sites tree a chance to get updated
time.sleep(2)

print 'Spidering target %s' % target
zap.spider.scan(target)
# Give the Spider a chance to start
time.sleep(2)
while (int(zap.spider.status()) < 100):
print 'Spider progress %: ' + zap.spider.status()
time.sleep(2)
print 'Spider completed'
# Give the passive scanner a chance to finish
time.sleep(5)
print 'Scanning target %s' % target
zap.ascan.scan(target)
while (int(zap.ascan.status()) < 100):
print 'Scan progress %: ' + zap.ascan.status()
time.sleep(5)
print 'Scan completed'
# Report the results
print 'Hosts: ' + ', '.join(zap.core.hosts)
print 'Alerts: '
pprint (zap.core.alerts())

请就此提出建议...

最佳答案

关于python - 如何使用python将ZAP集成到jenkins?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32245894/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com