NAV
php

Introduction

Welcome to the PENTESTON API! You can use our API to access PENTESTON API endpoints, which can get information about generated reports, targets, and pentests in our database.

We have language bindings in PHP! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Authentication

PENTESTON uses API keys to allow access to the API. You can register a new API Key at our Accurate Online Penetration Testing Service portal.

PENTESTON expects for the API Key to be included in all API requests to the server in a request that looks like the following:

api = [API Key]

Targets

<?php
//Targets
    $apiKey = 'abc0123456789abc0123456789abc0123456789abc0123456789abc012';
    $valuesArr = array(
        'api' => $apiKey,
        'targetid' => ''
    );
    $reuestUrl = 'https://penteston.com/api/targets/xml?' . http_build_query($valuesArr);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $reuestUrl);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $api_output = curl_exec($ch);
    curl_close($ch);
    echo $api_output;

The above command returns XML structured like this:

<?xml version="1.0" encoding="UTF-8"?>
<targets> 
    <total_targets>1</total_targets> 
    <total_pentests>3</total_pentests> 
    <target>
        <name>IP Nmap</name> 
        <id>111</id> 
        <type>Single IP</type> 
        <value>127.0.0.1</value> 
        <value_02></value_02> 
        <pentests>3</pentests> 
    </target> 
</targets>

For list created assets

HTTP Request

GET https://penteston.com/api/targets/xml

Query Parameters

Parameter Default Description
api [API Key] Your personal API Key.
targetid empty If set to some [Target ID], the result will return result for current target.

Pentests

<?php
//Pentests
    $apiKey = 'abc0123456789abc0123456789abc0123456789abc0123456789abc012';
    $valuesArr = array(
        'api' => $apiKey,
        'targetid' => '',
        'testid' => ''
    );
    $reuestUrl = 'https://penteston.com/api/list/xml?' . http_build_query($valuesArr);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $reuestUrl);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $api_output = curl_exec($ch);
    curl_close($ch);
    echo $api_output;

List created penetration tests

HTTP Request

GET https://penteston.com/api/list/xml

Query Parameters

Parameter Default Description
api [API Key] Your personal API Key.
targetid empty If set to some [Target ID], the result will return result for current target.
testid empty If set to some [Penetration test ID], the result will return result for current Penetration test.

Penetration test reports

<?php
//Penetration test reports
    $apiKey = 'abc0123456789abc0123456789abc0123456789abc0123456789abc012';
    $valuesArr = array(
        'api' => $apiKey,
        'targetid' => '',
        'testid' => ''
    );
    $reuestUrl = 'https://penteston.com/api/pentests/xml?' . http_build_query($valuesArr);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $reuestUrl);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $api_output = curl_exec($ch);
    curl_close($ch);
    echo $api_output;

Get report

HTTP Request

GET https://penteston.com/api/pentests/xml

Query Parameters

Parameter Default Description
api [API Key] Your personal API Key.
targetid empty If set to some [Target ID], the result will return result for current target.
testid empty If set to some [Penetration test ID], the result will return result for current Penetration test.

Periodic test reports

<?php
//Periodic test reports
    $apiKey = 'abc0123456789abc0123456789abc0123456789abc0123456789abc012';
    $valuesArr = array(
        'api' => $apiKey,
        'targetid' => '',
        'testid' => '',
        'date' => ''
    );
    $reuestUrl = 'https://penteston.com/api/periodic_tests/xml?' . http_build_query($valuesArr);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $reuestUrl);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $api_output = curl_exec($ch);
    curl_close($ch);
    echo $api_output;

Get periodic reports

HTTP Request

GET https://penteston.com/api/periodic_tests/xml

Query Parameters

Parameter Default Description
api [API Key] Your personal API Key.
targetid empty If set to some [Target ID], the result will return result for current target.
testid empty If set to some [Penetration test ID], the result will return result for current Penetration test.
date empty (YYYY-mm-dd) Periodic test date.
php