把 OWASP ZAP 搬到 Docker 上面
2024-04-30 17:13:44

Instructions

  1. 先拉取 OWASP ZAP 的 docker image
1
docker pull ghcr.io/zaproxy/zaproxy:weekly docker pull softwaresecurityproject/zap-weekly
  1. 直接執行以下指令,更改掉 TARGET_DOMAIN 參數成想要搜尋的網站網址即可,報告會以 html 形式生成在執行指令的資料夾
1
docker run -v $(pwd):/zap/wrk/:rw -t ghcr.io/zaproxy/zaproxy:stable zap-full-scan.py \ -t TARGET_DOMAIN -r testreport.html -a -d

只想做 passive scan (with zap-baseline.py)

1
docker run -v $(pwd):/zap/wrk/:rw -t ghcr.io/zaproxy/zaproxy:stable zap-baseline.py \ -t https://www.example.com -r testreport.html
  • -v $(pwd):/zap/wrk/:rw : 掛載 Docker 中的資料夾 /zap/wrk 到現有畚箕的資料夾

  • -t ghcr.io/zaproxy/zaproxy:stable zap-baseline.py : 執行 OWASP ZAP 的 Python 檔案

  • -t https://www.example.com : 我們想要搜尋的目標網址

  • -r testreport.html : 結果輸出名稱

Addition option (with zap-full-scan.py or zap-baseline.py)

-a : Include the alpha active and passive scan rules as well

-d : Show the debug messages

-j : Use the Ajax spider in addition to the traditional one

-z : Addition config (Below is the example for setting User Agent)

1
-z "-config replacer.full_list\(0\).description=UA_modify -config replacer.full_list\(0\).enabled=true -config replacer.full_list\(0\).matchtype=REQ_HEADER -config replacer.full_list\(0\).matchstr=User-Agent -config replacer.full_list\(0\).regex=false -config replacer.full_list\(0\).replacement=NEW UA Header

如果想要有網頁版 OWASP ZAP (Webswing)

1
docker run -u zap -p 8080:8080 -p 8090:8090 -i ghcr.io/zaproxy/zaproxy:weekly zap-webswing.sh

跑完後,你可以到 http://localhost:8080/zap 看到網頁版的 OWASP ZAP , 8090 端口將會用於 ZAP 的 Proxy Listen.

你也可以添加 -v $(pwd):/zap/wrk/:rw 到指令中,讓你可以更好的去在本機存取檔案。S