定制 zaproxy/php-owasp-zap-v2 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zaproxy/php-owasp-zap-v2

最新稳定版本:2.4.3-beta1

Composer 安装命令:

composer require zaproxy/php-owasp-zap-v2

包简介

PHP client API for OWASP ZAP

关键字:

README 文档

README

PHP client API for OWASP ZAP 2.4

All API class files (except Zapv2.php) are generated automatically using the ZAProxy API generator.

##Getting Started

  1. Add following lines to composer.json in your PHP project.
{ ... "require": { ... "zaproxy/php-owasp-zap-v2": "2.4.*@beta", ... } ... } 
  1. $ php composer.phar install/update

##Usage Example:

<?php require "vendor/autoload.php"; $api_key = "YOUR_API_KEY"; $target = "http://target.example.com/"; $zap = new Zap\Zapv2('tcp://localhost:8090'); $version = @$zap->core->version(); if (is_null($version)) { echo "PHP API error\n"; exit(); } else { echo "version: ${version}\n"; } echo "Spidering target ${target}\n"; // Response JSON looks like {"scan":"1"} $scan_id = $zap->spider->scan($target, null, null, null, $api_key); $count = 0; while (true) { if ($count > 10) exit(); // Response JSON looks like {"status":"50"} $progress = intval($zap->spider->status($scan_id)); printf("Spider progress %d\n", $progress); if ($progress >= 100) break; sleep(2); $count++; } echo "Spider completed\n"; // Give the passive scanner a chance to finish sleep(5); echo "Scanning target ${target}\n"; // Response JSON for error looks like {"code":"url_not_found", "message":"URL is not found"} $scan_id = $zap->ascan->scan($target, null, null, null, null, null, $api_key); $count = 0; while (true) { if ($count > 10) exit(); $progress = intval($zap->ascan->status($scan_id)); printf("Scan progress %d\n", $progress); if ($progress >= 100) break; sleep(2); $count++; } echo "Scan completed\n"; // Report the results echo "Hosts: " . implode(",", $zap->core->hosts()) . "\n"; $alerts = $zap->core->alerts($target, "", ""); echo "Alerts (" . count($alerts) . "):\n"; print_r($alerts);

API

OWASP ZAP Wiki: ApiGen_Index · zaproxy/zaproxy Wiki

##License

  • Apache License, Version 2.0

统计信息

  • 总下载量: 122.04k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 21
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 21
  • Watchers: 3
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2026-01-04