SDK Quickstart
This guide runs a blackbox pentest against a live target from a TypeScript script and prints the findings.
Prerequisites
@pensar/apexinstalled in your project (see Installation)- An AI provider configured, either through an environment variable such as
ANTHROPIC_API_KEYor by runningpensar login. See Configuration. - A target you are authorized to test
Run a pentest
pentest.ts
Run it:
runPentestAgent first maps the target’s attack surface, then runs a swarm of targeted pentest agents against each endpoint it discovered. When it finishes, the session directory contains:
Whitebox mode
Pass cwd with the path to the target’s source code. The attack surface phase then reads the code directly, while the pentest phase still tests the live target: