How to use Customized HTML Template in ZAPDocker

93 views
Skip to first unread message

Karthick G

unread,
May 30, 2022, 5:23:02 AM5/30/22
to OWASP ZAP User Group
Hi Team,
I am using ZAP Docker, in which my Primary task is to change the default html template instead of using the Existing One I need to use my customized html template. I Know that It can done if zap is running in my local machine. I want to achieve the same in the Docker. Is that Possible experts ?

Thanks in Advance
Karthick G

Simon Bennetts

unread,
May 30, 2022, 5:46:17 AM5/30/22
to OWASP ZAP User Group
Hi Karthick,

Yes, theres (nearly) always a way :)

Try this:
  • docker run -t owasp/zap2docker-stable ls
You should see the files in "/zap" dir of the stable docker image listed.

Now run:
  • docker run -v $(pwd):/zap/wrk/:rw -t owasp/zap2docker-stable ls /zap/wrk
You should see the files in your local directory listed, but these have been mounted in the docker image.

Now run:
  • echo "#\!/bin/bash" > test.sh
  • echo "echo 'this is my script running in docker'" >> test.sh
  • chmod +x test.sh
  • docker run -v $(pwd):/zap/wrk/:rw -t owasp/zap2docker-stable  /zap/wrk/test.sh
You should see "this is my script running in docker" output.

So there you have it:
  • Create a script in your CWD
  • Add any files you need in the docker image to your CWD
  • Change you script to copy the files wherever they need to go
  • Add the relevant commands to start ZAP in the way you want
  • Run the script via docker
Does that make sense?

Cheers,

Simon

Karthick G

unread,
May 31, 2022, 2:19:20 AM5/31/22
to OWASP ZAP User Group
Hi,
I have tried the commands which you have specified.
  • echo "#\!/bin/bash" > test.sh
  • echo "echo 'this is my script running in docker'" >> test.sh
  • chmod +x test.sh
  • docker run -v $(pwd):/zap/wrk/:rw -t owasp/zap2docker-stable  /zap/wrk/test.sh
After creating the test.sh script and making it as executable when I try to run this command docker run -v $(pwd):/zap/wrk/:rw -t owasp/zap2docker-stable  /zap/wrk/test.sh
I am getting an error as below.
`standard_init_linux.go:219: exec user process caused: exec format error`

Simon Bennetts

unread,
May 31, 2022, 4:13:14 AM5/31/22
to OWASP ZAP User Group
Whats is now in your test.sh script?
I hit that problem until I put the "#!/bin/bash" line at the start. If that is missing or wrong then you will get that error.
Note that the second line appends to the test.sh file instead of overwriting it.

Cheers,

Simon
Reply all
Reply to author
Forward
0 new messages