首页 文章

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

提问于
浏览
1

其实我没有找到任何有用的东西 .
这是link我找到了

我按照步骤..但执行python脚本时 .

Traceback(最近一次调用最后一次):文件“zap-python-script.py”,第15行,在zap.urlopen(target)文件中“/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行,在open return getattr(self,name)(url)文件”/ usr /lib64/python2.6/urllib.py“,第346行,在open_httph.endheaders()文件”/usr/lib64/python2.6/httplib.py“,第908行,在endheadersself._send_output()文件”/ usr /lib64/python2.6/httplib.py“,第780行,在_send_outputself.send(msg)文件”/usr/lib64/python2.6/httplib.py“,第739行,在sendself.connect()文件中”/ usr / lib64 / python2.6 / httplib.py“,第720行,在connectself.timeout中)文件”/usr/lib64/python2.6/socket.py“,第567行,在create_connectionraise错误中,msg IOError:[Errno socket错误] [Errno 111]连接被拒绝

我收到了这个错误 . 这里t target = 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())

请告诉我这个......

1 回答

相关问题