Created
May 25, 2017 22:44
-
-
Save stephendonner/80f7bee6366b2eb151a1ed47c4dfe129 to your computer and use it in GitHub Desktop.
Bash shell script for zap-api-scan Jenkins job
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
docker rm $(docker ps -a -f status=exited -q) | |
# docker rmi $(docker images --filter "dangling=true" -q --no-trunc) | |
docker pull owasp/zap2docker-live | |
echo DEBUG - mkdir -p $PWD/out | |
mkdir -p $PWD/out | |
echo DEBUG - chmod 777 $PWD/out | |
chmod 777 $PWD/out | |
test -d ${PWD}/out \ | |
&& docker run -v $(pwd)/out:/zap/wrk/:rw -t owasp/zap2docker-live zap-api-scan.py -t $TARGET_URL -f openapi -d -r zap_scan_report.html | |
echo DEBUG - Finding all files in workspace | |
find $PWD | |
# sudo docker cp $(sudo docker ps -l -q):/home/zap/.ZAP_D/zap.log ${WORKSPACE} | |
# the goal is to get the following to work, | |
# copying the zap_scan_report.html from the Docker container | |
# to the Jenkins workspace, as a start: | |
# sudo docker cp \ | |
# $(docker ps -l -q):/home/zap/.ZAP_D/zap_scan_report.html \ | |
# ${WORKSPACE}/zap_scan_report.html | |
if test -f ${PWD}/out/zap_scan_report.html; then | |
mv ${PWD}/out/zap_scan_report.html ${PWD} | |
rm -rf ${PWD}/out | |
echo DEBUG - Finding all files in workspace | |
find $PWD | |
exit 0 | |
else | |
echo "zap_scan_report.html not found!" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment