【发布时间】:2015-11-21 15:07:47
【问题描述】:
其实我不懂python。为了将 zap 与 jenkins 集成,我搜索了很多。但我找不到任何有用的东西。
这是link我找到了
我按照步骤..但是在执行 python 脚本时。
Traceback(最近一次调用最后一次):
文件“zap-python-script.py”,第 15 行,在 zap.urlopen(目标)
文件“/usr/lib/python2.6/site-packages/python_owasp_zap_v2.4-0.0.2-py2.6.egg/zapv2/init.py”,第 116 行,在urlopen 返回 urllib.urlopen(*args, **kwargs).read()
文件“/usr/lib64/python2.6/urllib.py”,第 86 行,在 urlopen 返回 opener.open(url)
文件“/usr/lib64/python2.6/urllib.py”,第 207 行,打开返回 getattr(self, name)(url)
open_httph.endheaders() 中的文件“/usr/lib64/python2.6/urllib.py”,第 346 行
文件“/usr/lib64/python2.6/httplib.py”,第 908 行,在 endheadersself._send_output()
_send_outputself.send(msg) 中的文件“/usr/lib64/python2.6/httplib.py”,第 780 行
sendself.connect() 中的文件“/usr/lib64/python2.6/httplib.py”,第 739 行
文件“/usr/lib64/python2.6/httplib.py”,第 720 行,在 connectself.timeout 中)
文件“/usr/lib64/python2.6/socket.py”,第 567 行,create_connectionraise 错误,msg
IOError:[Errno 套接字错误] [Errno 111] 连接被拒绝
我收到此错误。
这里 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 sockets jenkins jenkins-cli zap