2017 © Pedro Peláez
 

library php-owasp-zap-v2

PHP client API for OWASP ZAP

image

zaproxy/php-owasp-zap-v2

PHP client API for OWASP ZAP

  • Friday, May 27, 2016
  • by zaproxy
  • Repository
  • 1 Watchers
  • 12 Stars
  • 3,263 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 14 Versions
  • 19 % Grown

The README.md

php-owasp-zap-v2

PHP client API for OWASP ZAP 2.4, (*1)

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

Getting Started

  1. Add following lines to composer.json in your PHP project., (*3)

    {
    ...
    "require": {
      ...
      "zaproxy/php-owasp-zap-v2": "2.4.*@beta",
      ...
    }
    ...
    }
    
  2. $ php composer.phar install/update, (*4)

Usage

Example:, (*5)

<?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, (*6)

License

  • Apache License, Version 2.0

The Versions

27/05 2016

dev-master

9999999-dev

PHP client API for OWASP ZAP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

The Development Requires

zap

27/05 2016

2.4.x-dev

2.4.9999999.9999999-dev

PHP client API for OWASP ZAP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

The Development Requires

zap

27/05 2016

2.4.3-beta1

2.4.3.0-beta1

PHP client API for OWASP ZAP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

The Development Requires

zap

24/05 2016

2.3.x-dev

2.3.9999999.9999999-dev

PHP client API for OWASP ZAP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

The Development Requires

zap

01/06 2015

2.4.0-beta1

2.4.0.0-beta1

PHP client API for OWASP ZAP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

The Development Requires

zap

31/05 2015

2.3.0-beta1

2.3.0.0-beta1

PHP client API for OWASP ZAP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

The Development Requires

zap

12/10 2014

0.1.7

0.1.7.0

PHP client API for OWASP ZAP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

The Development Requires

zap

04/08 2014

0.1.6

0.1.6.0

PHP client API for OWASP ZAP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

zap

11/07 2014

0.1.5

0.1.5.0

PHP client API for OWASP ZAP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

zap

02/07 2014

0.1.4

0.1.4.0

PHP client API for OWASP ZAP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

zap

26/06 2014

0.1.3

0.1.3.0

PHP client API for OWASP ZAP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

zap

12/06 2014

0.1.2

0.1.2.0

PHP client API for OWASP ZAP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

zap

06/06 2014

0.1.1

0.1.1.0

PHP client API for OWASP ZAP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

zap

01/06 2014

0.1.0

0.1.0.0

PHP client API for OWASP ZAP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

zap