【问题标题】:How to integrate ZAP to jenkins using python?如何使用 python 将 ZAP 集成到詹金斯?
【发布时间】: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


    【解决方案1】:

    【讨论】:

    • 嗨 Psiinon 感谢您的回答。我已经尝试了我已经完成的 ZAProxy 插件配置。但是,当我单击 Execute ZAProxy 在构建步骤中配置作业时,它不起作用。
    • 在 ZAProxy 2.4.1 中,设置了默认的 API 密钥。要让插件正常工作,您必须在“高级”菜单中输入:选项字段中的“-config”和值字段中的“api.disablekey=true”。等待新版本。上面的语句我不知道怎么配置..请告诉我怎么配置也... Zapper插件配置我不知道在哪里提供目标url..请分享给我一个配置..它将是对我有很大的帮助...
    猜你喜欢
    • 2020-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-09
    • 2015-04-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多