【发布时间】:2025-05-20 21:00:01
【问题描述】:
首先我想说我喜欢这个工具,如果你熟悉 Zap,API 的编写方式非常容易理解。我遇到的唯一麻烦是我找不到太多关于 python API 的文档,所以我已经离开了源代码并验证了它是如何针对应用程序工作的。我已经能够提取扫描并设置上下文,但我似乎无法正确调用身份验证模块中的任何内容。我相信我的问题之一是我不完全确定调用函数时要使用的确切变量或它们各自的格式。下面是我一起废弃的一些示例代码。每次使用下面的身份验证功能都让我失望。即使有人看到这个并告诉我去哪里或自己解决这个问题,我也会非常感激。
from zapv2 import ZAPv2
context = 'new_attack'
authmethodname = 'formBasedAuthentication'
authmethodconfigparams = "".join('loginUrl=someloginpage' 'loginRequestData=username%3D%7B%25user1%25%7D%26' 'password%3D%7B%25password%25%7D')
target = 'some target but I cant put more than 2 links in this question'
apikey = 'password'
zap = ZAPv2(apikey=apikey)
print zap.context.new_context('new_attack')
print zap.context.include_in_context(context, 'https://192.168.0.1.*')
print zap.context.context(context)
#anything below here gives me 'Missing Params' an error from zap
print zap.authentication.set_logged_in_indicator(context, loggedinindicatorregex='Logged in')
print zap.authentication.set_logged_out_indicator(context, 'Sorry, the username or password you entered is incorrect')
print zap.authentication.set_authentication_method(context, authmethodname, authmethodconfigparams)
【问题讨论】:
-
也感谢您的编辑建议。我第一次在这里提问。
标签: python authentication owasp zap