最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

zap - How to access crypto methods via script in Zaproxy - Stack Overflow

programmeradmin1浏览0评论

I am having trouble finding out how to use crypto methods via a script in zaproxy. All I want to do is SHA2 a string but I can't find any documentation anywhere that describes how to do this.

Example:

const plain_token = var1 + ":" + var2 + ":" + var3 + ":" + var4;

const token = sha256(plain_token);

At the moment I have included a sha256 JS function taken from here: /

But there has to be a way to do this via zaproxy itself?

I tried this method:

var CryptoJS = Java.type('.zaproxy.zap.extension.script.CryptoJS');

function hashValue(value) {
    return CryptoJS.SHA256(value).toString(CryptoJS.enc.Hex);
}

But this just throws an error as it seems CryptoJS is undefined. And I can't find the documentation that would explain this.

Any help would be appreciated.

I am having trouble finding out how to use crypto methods via a script in zaproxy. All I want to do is SHA2 a string but I can't find any documentation anywhere that describes how to do this.

Example:

const plain_token = var1 + ":" + var2 + ":" + var3 + ":" + var4;

const token = sha256(plain_token);

At the moment I have included a sha256 JS function taken from here: https://geraintluff.github.io/sha256/

But there has to be a way to do this via zaproxy itself?

I tried this method:

var CryptoJS = Java.type('.zaproxy.zap.extension.script.CryptoJS');

function hashValue(value) {
    return CryptoJS.SHA256(value).toString(CryptoJS.enc.Hex);
}

But this just throws an error as it seems CryptoJS is undefined. And I can't find the documentation that would explain this.

Any help would be appreciated.

Share Improve this question asked Mar 18 at 13:46 CuttlefishJonesCuttlefishJones 133 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Where did you get ".zaproxy.zap.extension.script.CryptoJS" from? That class does not appear to be in the ZAP codebase.

ZAP does not provide its own SHA265 implementaion, it uses the standard Java MessageDigest class. Any standard Java class can be accessed via ZAP scripts.

发布评论

评论列表(0)

  1. 暂无评论