Python packages installation in OWASP ZAP Jython environment.

18 views
Skip to first unread message

Karthik k

unread,
Mar 13, 2023, 7:34:54 AMMar 13
to OWASP ZAP Developer Group
Python packages installation in OWASP ZAP Jython environment.

My requirement is to send alerts(alertID, ReqHeader, Responseheader etc... as json object) to redis store for which I'm using a python zap extender script.
Everything is working fine except for the sending to redis part

I'm not able to import redis module inside extender script.

I have tried the following

1) Installing redis python module using pip in my python installation assuming owasp zap jython will pick it up as well.

2) Wrote a seperate py file which implements the redis functionality required and mentioned it in a folder and pointed it to
options-->Jython-->Additional Python modules path, and tried to import that

In both the above cases I got the following error.

Traceback (most recent call last):
  File "aaa.py", line 7, in <module>
ImportError: No module named redis
Traceback (most recent call last):
  File "aaa.py", line 7, in <module>
ImportError: No module named redis

Note: Normally in python environment I'm able to import redis.

Can you please tell me what is missing here ? (Bit in detail if possible)

thc...@gmail.com

unread,
Mar 13, 2023, 8:20:11 AMMar 13
to zaproxy...@googlegroups.com
Is that a Python 2.7 package?

You should add the redis package to the "Additional Python modules path"
rather than a script that calls it (if I'm understanding correctly).

Best regards.

On 13/03/2023 11:34, Karthik k wrote:
> Python packages installation in OWASP ZAP Jython environment.
>
> My requirement is to send alerts(alertID, ReqHeader, Responseheader etc...
> as json object) to redis store for which I'm using a python zap extender
> script.
> Everything is working fine except for the sending to redis part
>
> I'm not able to import redis module inside extender script.
>
> I have tried the following
>
> 1) Installing redis python module using pip in my python installation
> assuming owasp zap jython will pick it up as well.
>
> 2) Wrote a seperate py file which implements the redis functionality
> required and mentioned it in a folder and pointed it to
> options-->Jython-->Additional Python modules path, and tried to import that
>
> In both the above cases I got the following error.
>
> Traceback (most recent call last):
> File "aaa.py", line 7, in <module>
> ImportError: No module named redis
> Traceback (most recent call last):
> File "aaa.py", line 7, in <module>
> ImportError: No module named redis
>
> *Note: Normally in python environment I'm able to import redis.*

Karthik k

unread,
Mar 13, 2023, 9:28:40 AMMar 13
to OWASP ZAP Developer Group
No the base python installation I have is for python 3.10.4

Could you please provide me a bit of guidance on how to install redis package manually..? (bit indetail if possible)

I have downloaded it from the pypi repository and it looks like this. <Refer attachment> (It was zip file and I extracted it)
Capture.PNG

thc...@gmail.com

unread,
Mar 13, 2023, 9:54:32 AMMar 13
to zaproxy...@googlegroups.com
Jython engine supports only 2.7. You have to download an older version
of redis package that supports that version, e.g.:
https://pypi.org/project/redis/3.5.3/

Extract it and add the extracted folder in the Jython options panel.

Best regards.

On 13/03/2023 13:28, Karthik k wrote:
> No the base python installation I have is for python 3.10.4
>
> *Could you please provide me a bit of guidance on how to install redis
> package manually..? (bit indetail if possible)*

Karthik k

unread,
Mar 14, 2023, 4:03:48 PMMar 14
to OWASP ZAP Developer Group
Hi @thc,

Thanks for your support but It is not working..!!. It is telling resources is temporarily unavailable. But I'm able to use it from a normal python script. Given below is the screenshot.


rediserror.PNG

Regards
Karthik.K

thc...@gmail.com

unread,
Mar 14, 2023, 4:34:42 PMMar 14
to zaproxy...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages