Create a Custom Attack
Create, validate, publish, and maintain your breach‑simulation method (Python or PCAP).
✅ Step 0 – Prerequisites
Item | Notes |
API Key & Account ID | Find them in Administration → API Keys |
Base URL | SaaS: |
Auth header |
|
Content‑Type |
|
✅ Step 1 – Validate Your Script
Why this matters: Creating attacker/target scripts are the first step you need to take using SafeBreach SDK documentation. you can find examples here. SafeBreach rejects files that are too large, missing metadata or the wrong class.
Endpoint - Validate method file
PUT /api/content/v1/accounts/:accountId/customMethods/validate
Required fields
file– the attacker or target scriptclass–pythonorpcap- optional
metaData– JSON key/values
Example
curl -X PUT "$BASE_URL/api/content/v1/accounts/$ACCOUNT_ID/customMethods/validate" \
-H "Authorization: Bearer $API_KEY" \
-F "file=@attacker.py" \
-F "class=python" \
-F 'metaData={"author":"alice"}'
If the JSON response contains "valid": true, continue; otherwise fix the script and re‑validate.
✅ Step 2 – Create the Method (Draft)
Why this matters: A draft lets you test safely before production.
Endpoint - Create new custom method
POST /api/content/v1/accounts/:accountId/customMethods
Example
curl -X POST "$BASE_URL/api/content/v1/accounts/$ACCOUNT_ID/customMethods" \
-H "Authorization: Bearer $API_KEY" \
-F "name=Domain Discovery via AXFR" \
-F "methodType=1" # 0‑exfil, 1‑lateral, 2‑infil, 5‑hostlevel \
-F "class=python" \
-F "status=draft" \
-F "description=Attempts zone‑transfer against internal DNS" \
-F "attackerFile=@attacker.py" \
-F "targetFile=@target.py"
✅ Step 3 – Iterate & Update (Optional)
Need to change timeout, scripts or metadata? Use PUT.
Endpoint - Update custom method
PUT /api/content/v1/accounts/:accountId/customMethods/:id
Example
curl -X PUT "$BASE_URL/api/content/v1/accounts/$ACCOUNT_ID/customMethods/$METHOD_ID" \
-H "Authorization: Bearer $API_KEY" \
-F "status=draft" \
-F "attackerFile=@fixed_attacker.py"
✅ Step 4 – Publish
Set status=published in a final PUT (same endpoint as Step 3). The method appears in Library → My Methods for all scenario designers.
✅ Step 5 – Verify or List Methods
- Single method:
GET …/customMethods/:id - All drafts/published:
GET …/customMethods?status=draft|published
✅ Step 6 – Download Script (Optional)
Retrieve stored script files for audit:
GET /api/content/v1/accounts/:accountId/customMethods/:id/files/:fileName
✅ Step 7 – Delete (Cleanup)
Remove a method and its files.
Endpoint - Delete custom method
DELETE /api/content/v1/accounts/:accountId/customMethods/:id
Example
curl -X DELETE "$BASE_URL/api/content/v1/accounts/$ACCOUNT_ID/customMethods/$METHOD_ID" \
-H "Authorization: Bearer $API_KEY"
📝 Best Practice Tips
Do | Why |
Validate every file before uploading | Catches syntax & size issues early |
Use staging simulators to test drafts | Prevents noisy alerts in production |
Keep method names unique and descriptive | Avoids 409 Conflict errors |
Limit API tokens and rotate regularly | Minimises security exposure |
Document purpose in the | Aids audit & collaboration |
Increase | Short runs speed up CI pipelines |
On this page
- Create a Custom Attack
