Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/pensarai/apex/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The Attack Surface API provides comprehensive reconnaissance and attack surface mapping capabilities for both blackbox and whitebox testing scenarios. Key Features:
  • Automatic mode selection based on input (whitebox vs blackbox)
  • Asset discovery and enumeration
  • Endpoint and page detection
  • Authentication flow mapping
  • Target prioritization for deep testing

runAttackSurfaceAgent

Run the appropriate attack surface agent based on the input configuration. Behavior:
  • If cwd is provided, runs the whitebox agent which analyzes source code directly to map endpoints and pages
  • Otherwise, runs the blackbox agent which probes a live target from the outside
  • target is always required (the live URL to test against)
import { runAttackSurfaceAgent } from '@pensar/apex/api/attackSurface';

const result = await runAttackSurfaceAgent({
  target: 'https://example.com',
  model: 'claude-sonnet-4-20250514',
  session: sessionInfo,
  callbacks: {
    onTextDelta: (d) => process.stdout.write(d.text),
    onToolCall: (d) => console.log(`→ calling ${d.toolName}`),
    onToolResult: (d) => console.log(`✓ ${d.toolName} completed`),
  },
});

console.log(`Identified ${result.targets.length} targets`);

Parameters

input
AttackSurfaceAgentInput
required
Configuration for the attack surface agent

Response

results
AttackSurfaceAnalysisResults | WhiteboxAttackSurfaceResult | null
The full analysis results with discovered assets and key findings
targets
PentestTarget[]
All targets identified for deep penetration testing
resultsPath
string
Absolute path to the attack-surface-results.json file
assetsPath
string
Absolute path to the session’s assets directory

Usage Examples

import { runAttackSurfaceAgent } from '@pensar/apex/api/attackSurface';
import { createSession } from '@pensar/apex/session';

// Create session
const session = await createSession({
  name: 'Target Recon',
  targets: ['https://example.com'],
});

// Run blackbox attack surface analysis
const result = await runAttackSurfaceAgent({
  target: 'https://example.com',
  model: 'claude-sonnet-4-20250514',
  session,
  callbacks: {
    onTextDelta: (d) => process.stdout.write(d.text),
    onToolCall: (d) => console.log(`→ ${d.toolName}`),
  },
});

console.log(`Found ${result.targets.length} targets`);
console.log(`Results saved to: ${result.resultsPath}`);

Blackbox Pentest

Full penetration testing workflow

Targeted Pentest

Test specific targets and objectives

Authentication

Authenticate against a target

Build docs developers (and LLMs) love