
⚡️ مسح ZAP لأهداف متعددة
mzap هي أداة واجهة سطر أوامر بلغة كريستال لفحص ZAP متعدد الأهداف. تقوم بتوزيع الأهداف عبر مضيف واحد أو أكثر لواجهة برمجة تطبيقات ZAP، وتدعم وضع الانتظار الاختياري، ويمكنها تصدير التقارير.
spider, ajaxspider, clientspider (ZAP 2.16+), ascan, pscanopenapi, soap, graphql, و postmanpolicies)html/pdf/json/md/sarif) مع سلوك احتياطي--fail-on لأكواد الخروج في CIspider, ajaxspider, clientspider, ascan, أو all$HOME/.config/mzap/config.toml ومسارات قديمة>= 1.19.1brew install hahwul/mzap/mzap
shards install --frozen
crystal build --release src/mzap_cli.cr -o bin/mzap
crystal run src/mzap_cli.cr -- version
docker build -t mzap .
docker run --rm -v "$PWD:/work" mzap spider --urls /work/samples/target.txt --apis http://host.docker.internal:8090
Usage:
mzap [command]
Subcommands:
ajaxspider بدء مسح Ajax Spider في ZAP
ascan بدء مهام المسح النشط في ZAP
clientspider بدء مسح Client Spider في ZAP (ZAP 2.16+)
help عرض المساعدة لأمر معين
import استيراد تعريفات API (openapi/soap/graphql/postman)
policies عرض سياسات المسح النشط في ZAP
pscan انتظار اكتمال المسح السلبي في ZAP
sitestree تصدير أو تقليم شجرة المواقع ZAP (ZAP 2.16+)
spider بدء مسح Spider في ZAP
stop إيقاف عمليات المسح الجارية
version عرض إصدار mzap
Flags:
--apikey string مفتاح API ZAP (احذف عندما تكون مصادقة مفتاح API معطلة)
--apis string عناوين URL لمضيف API ZAP مفصولة بفواصل
e.g. --apis http://localhost:8090,http://192.168.0.4:8090 (default "http://localhost:8090")
--config string مسار ملف التكوين (يدعم TOML؛ الافتراضي: $HOME/.config/mzap/config.toml)
--context string ملف سياق ZAP لاستيراده قبل المسح
--fail-on string الفشل برمز خروج 1 إذا كانت التنبيهات في مستوى المخاطرة أو أعلى
--format string تنسيق تعريف API للاستيراد (openapi/soap/graphql/postman)
--target-url string تجاوز عنوان URL للهدف/نقطة النهاية للاستيراد
--policy string اسم سياسة المسح للمسح النشط
--report-format تنسيق التقرير بعد اكتمال المسح (html/pdf/json/md/sarif)
--report-out مسار إخراج التقرير (الافتراضي: mzap-report-<timestamp>.<ext>)
--concurrency عدد التوزيعات المتوازية للمسح (الافتراضي 1)
--wait انتظار اكتمال عمليات المسح التي بدأت
--wait-interval فاصل الاستقصاء بالثواني أثناء الانتظار (الافتراضي 2)
--wait-timeout مهلة الانتظار بالثواني (الافتراضي 0: لا مهلة)
-h, --help عرض المساعدة لـ mzap
--urls string مسار ملف قائمة URL (مثال: --urls hosts.txt)
قم بتشغيل mzap help <command> للحصول على الأعلام الخاصة بالأمر.
# spider scan with two ZAP API hosts
mzap spider --urls samples/target.txt --apis http://localhost:8090,http://192.168.0.4:8090
# run scan, wait for completion, and generate an HTML report
mzap spider --urls samples/target.txt --apis http://localhost:8090 --wait --report-format html --report-out reports/mzap.html
# Client Spider (browser-based crawler, ZAP 2.16+; needs the Client Side Integration add-on)
mzap clientspider --urls samples/target.txt --apis http://localhost:8090 --wait
# import an OpenAPI definition, wait for passive scan, gate CI on high-risk alerts
mzap import --format openapi --urls samples/specs.txt --target-url https://api.example.com \
--apis http://localhost:8090 --wait --report-format sarif --fail-on high
# import API specs from stdin
echo https://api.example.com/openapi.json | mzap import --format openapi --urls -
# discover available scan policies (then use one with `ascan --policy`)
mzap policies --apis http://localhost:8090
# Sites Tree baseline for differential scanning (path resolved by the ZAP daemon)
mzap sitestree export baseline.tree --apis http://localhost:8090
mzap sitestree prune baseline.tree --apis http://localhost:8090
# stop all running scan types
mzap stop all --apis http://localhost:8090
استيراد APIs: يقوم
mzap importبإعداد شجرة مواقع ZAP ويتيح تشغيل المسح السلبي؛ للمسح النشط لنقاط النهاية المستوردة لاحقًا، قم بتشغيلmzap ascanعلى نفس الهدف (الأهداف). بالنسبة للملفات المحلية، يتم حل المسارات في--urls(و--target-url) بواسطة خادم ZAP، لذا قم بتركيبها داخل الحاوية عند تشغيل ZAP في Docker.
يقوم mzap تلقائيًا بتحميل التكوين عند وجوده.
الأولوية هي:
--config (إذا كان موجودًا)$HOME/.config/mzap/config.toml$HOME/.config/mzap/config + متغيرات الامتداد$HOME/.mzap + متغيرات الامتدادتتجاوز أعلام CLI دائمًا قيم التكوين.
[mzap]
apis = ["http://localhost:8090", "http://192.168.0.4:8090"]
apikey = "your-zap-api-key"
urls = "samples/target.txt"
wait = true
wait_interval = 2
wait_timeout = 0
report_format = "html"
report_out = "reports/mzap.html"
يحتوي هذا المستودع على إجراء GitHub قائم على Docker (action.yml).
- name: Run mzap
uses: hahwul/mzap@<tag>
with:
arguments: "spider --urls samples/target.txt --apis http://localhost:8090"
# tests
crystal spec
# release build
crystal build --release src/mzap_cli.cr -o bin/mzap