@pensar/apex 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/benchmark.js +0 -2
- package/build/index.js +0 -2
- package/build/quicktest.js +0 -2
- package/build/swarm.js +65 -49
- package/package.json +1 -1
package/build/benchmark.js
CHANGED
|
@@ -43532,8 +43532,6 @@ var execAsync2 = promisify2(exec2);
|
|
|
43532
43532
|
function runAgent(opts) {
|
|
43533
43533
|
const { target, objective, model, onStepFinish, abortSignal } = opts;
|
|
43534
43534
|
const session = opts.session || createSession(target, objective);
|
|
43535
|
-
console.log(`Created session: ${session.id}`);
|
|
43536
|
-
console.log(`Session path: ${session.rootPath}`);
|
|
43537
43535
|
const pocsPath = join3(session.rootPath, "pocs");
|
|
43538
43536
|
if (!existsSync5(pocsPath)) {
|
|
43539
43537
|
mkdirSync4(pocsPath, { recursive: true });
|
package/build/index.js
CHANGED
|
@@ -73644,8 +73644,6 @@ var execAsync3 = promisify3(exec3);
|
|
|
73644
73644
|
function runAgent(opts) {
|
|
73645
73645
|
const { target, objective, model, onStepFinish, abortSignal } = opts;
|
|
73646
73646
|
const session = opts.session || createSession(target, objective);
|
|
73647
|
-
console.log(`Created session: ${session.id}`);
|
|
73648
|
-
console.log(`Session path: ${session.rootPath}`);
|
|
73649
73647
|
const pocsPath = join4(session.rootPath, "pocs");
|
|
73650
73648
|
if (!existsSync9(pocsPath)) {
|
|
73651
73649
|
mkdirSync4(pocsPath, { recursive: true });
|
package/build/quicktest.js
CHANGED
|
@@ -42278,8 +42278,6 @@ var execAsync3 = promisify3(exec3);
|
|
|
42278
42278
|
function runAgent(opts) {
|
|
42279
42279
|
const { target, objective, model, onStepFinish, abortSignal } = opts;
|
|
42280
42280
|
const session = opts.session || createSession(target, objective);
|
|
42281
|
-
console.log(`Created session: ${session.id}`);
|
|
42282
|
-
console.log(`Session path: ${session.rootPath}`);
|
|
42283
42281
|
const pocsPath = join4(session.rootPath, "pocs");
|
|
42284
42282
|
if (!existsSync6(pocsPath)) {
|
|
42285
42283
|
mkdirSync4(pocsPath, { recursive: true });
|
package/build/swarm.js
CHANGED
|
@@ -42278,8 +42278,6 @@ var execAsync3 = promisify3(exec3);
|
|
|
42278
42278
|
function runAgent(opts) {
|
|
42279
42279
|
const { target, objective, model, onStepFinish, abortSignal } = opts;
|
|
42280
42280
|
const session = opts.session || createSession(target, objective);
|
|
42281
|
-
console.log(`Created session: ${session.id}`);
|
|
42282
|
-
console.log(`Session path: ${session.rootPath}`);
|
|
42283
42281
|
const pocsPath = join4(session.rootPath, "pocs");
|
|
42284
42282
|
if (!existsSync6(pocsPath)) {
|
|
42285
42283
|
mkdirSync4(pocsPath, { recursive: true });
|
|
@@ -42428,43 +42426,51 @@ var TargetSchema = exports_external.array(exports_external.object({
|
|
|
42428
42426
|
objective: exports_external.string().describe("The objective of the pentest")
|
|
42429
42427
|
}));
|
|
42430
42428
|
async function swarm(options) {
|
|
42431
|
-
const { targets, model } = options;
|
|
42429
|
+
const { targets, model, silent } = options;
|
|
42432
42430
|
let targetsArray = [];
|
|
42433
42431
|
if (typeof targets === "string") {
|
|
42434
42432
|
const result = TargetSchema.safeParse(JSON.parse(targets));
|
|
42435
42433
|
if (!result.success) {
|
|
42436
|
-
|
|
42437
|
-
|
|
42434
|
+
if (!silent) {
|
|
42435
|
+
console.error("Invalid targets JSON");
|
|
42436
|
+
console.error(result.error);
|
|
42437
|
+
}
|
|
42438
42438
|
return;
|
|
42439
42439
|
}
|
|
42440
42440
|
targetsArray = result.data;
|
|
42441
42441
|
} else {
|
|
42442
42442
|
targetsArray = targets;
|
|
42443
42443
|
}
|
|
42444
|
-
|
|
42445
|
-
|
|
42446
|
-
|
|
42447
|
-
|
|
42448
|
-
|
|
42449
|
-
|
|
42450
|
-
|
|
42451
|
-
|
|
42452
|
-
|
|
42453
|
-
|
|
42454
|
-
|
|
42455
|
-
|
|
42456
|
-
|
|
42444
|
+
if (!silent) {
|
|
42445
|
+
console.log("=".repeat(80));
|
|
42446
|
+
console.log("PENSAR SWARM PENTEST");
|
|
42447
|
+
console.log("=".repeat(80));
|
|
42448
|
+
console.log(`Model: ${model}`);
|
|
42449
|
+
console.log(`Total Targets: ${targetsArray.length}`);
|
|
42450
|
+
console.log();
|
|
42451
|
+
for (const [idx, target] of targetsArray.entries()) {
|
|
42452
|
+
console.log(` [${idx + 1}] ${target.target}`);
|
|
42453
|
+
console.log(` Objective: ${target.objective}`);
|
|
42454
|
+
}
|
|
42455
|
+
console.log();
|
|
42456
|
+
console.log("=".repeat(80));
|
|
42457
|
+
console.log();
|
|
42458
|
+
}
|
|
42457
42459
|
if (targetsArray.length === 0) {
|
|
42458
|
-
|
|
42460
|
+
if (!silent) {
|
|
42461
|
+
console.error("No targets provided");
|
|
42462
|
+
}
|
|
42459
42463
|
return;
|
|
42460
42464
|
}
|
|
42461
42465
|
const session = createSession("swarm", "Multi-target swarm pentest");
|
|
42462
42466
|
const results = [];
|
|
42463
42467
|
const promises = targetsArray.map(async (target, idx) => {
|
|
42464
|
-
|
|
42465
|
-
|
|
42466
|
-
|
|
42467
|
-
|
|
42468
|
+
if (!silent) {
|
|
42469
|
+
console.log("=".repeat(80));
|
|
42470
|
+
console.log(`[${idx + 1}/${targetsArray.length}] Starting pentest for: ${target.target}`);
|
|
42471
|
+
console.log("=".repeat(80));
|
|
42472
|
+
console.log();
|
|
42473
|
+
}
|
|
42468
42474
|
try {
|
|
42469
42475
|
const { streamResult } = runAgent({
|
|
42470
42476
|
session,
|
|
@@ -42475,18 +42481,22 @@ async function swarm(options) {
|
|
|
42475
42481
|
for await (const delta of streamResult.fullStream) {
|
|
42476
42482
|
if (delta.type === "text-delta") {} else if (delta.type === "tool-call") {} else if (delta.type === "tool-result") {}
|
|
42477
42483
|
}
|
|
42478
|
-
|
|
42479
|
-
|
|
42480
|
-
|
|
42484
|
+
if (!silent) {
|
|
42485
|
+
console.log();
|
|
42486
|
+
console.log(`✓ Pentest completed for: ${target.target}`);
|
|
42487
|
+
console.log();
|
|
42488
|
+
}
|
|
42481
42489
|
results.push({
|
|
42482
42490
|
target: target.target,
|
|
42483
42491
|
success: true,
|
|
42484
42492
|
sessionId: session.id
|
|
42485
42493
|
});
|
|
42486
42494
|
} catch (error46) {
|
|
42487
|
-
|
|
42488
|
-
|
|
42489
|
-
|
|
42495
|
+
if (!silent) {
|
|
42496
|
+
console.error(`✗ Pentest failed for: ${target.target}`);
|
|
42497
|
+
console.error(` Error: ${error46.message}`);
|
|
42498
|
+
console.error();
|
|
42499
|
+
}
|
|
42490
42500
|
results.push({
|
|
42491
42501
|
target: target.target,
|
|
42492
42502
|
success: false,
|
|
@@ -42495,24 +42505,26 @@ async function swarm(options) {
|
|
|
42495
42505
|
}
|
|
42496
42506
|
});
|
|
42497
42507
|
await Promise.all(promises);
|
|
42498
|
-
|
|
42499
|
-
|
|
42500
|
-
|
|
42501
|
-
|
|
42502
|
-
|
|
42503
|
-
|
|
42504
|
-
|
|
42505
|
-
|
|
42506
|
-
|
|
42507
|
-
|
|
42508
|
-
const
|
|
42509
|
-
|
|
42510
|
-
|
|
42511
|
-
|
|
42508
|
+
if (!silent) {
|
|
42509
|
+
console.log("=".repeat(80));
|
|
42510
|
+
console.log("SWARM PENTEST SUMMARY");
|
|
42511
|
+
console.log("=".repeat(80));
|
|
42512
|
+
console.log(`Total targets: ${targetsArray.length}`);
|
|
42513
|
+
console.log(`Successful: ${results.filter((r) => r.success).length}`);
|
|
42514
|
+
console.log(`Failed: ${results.filter((r) => !r.success).length}`);
|
|
42515
|
+
console.log(`Session ID: ${session.id}`);
|
|
42516
|
+
console.log(`Session Path: ${session.rootPath}`);
|
|
42517
|
+
console.log();
|
|
42518
|
+
for (const result of results) {
|
|
42519
|
+
const status = result.success ? "✓" : "✗";
|
|
42520
|
+
console.log(`${status} ${result.target}`);
|
|
42521
|
+
if (result.error) {
|
|
42522
|
+
console.log(` Error: ${result.error}`);
|
|
42523
|
+
}
|
|
42512
42524
|
}
|
|
42525
|
+
console.log();
|
|
42526
|
+
console.log("=".repeat(80));
|
|
42513
42527
|
}
|
|
42514
|
-
console.log();
|
|
42515
|
-
console.log("=".repeat(80));
|
|
42516
42528
|
return session;
|
|
42517
42529
|
}
|
|
42518
42530
|
async function main() {
|
|
@@ -42525,6 +42537,7 @@ async function main() {
|
|
|
42525
42537
|
console.error();
|
|
42526
42538
|
console.error("Options:");
|
|
42527
42539
|
console.error(" --model <model> Specify the AI model to use (default: claude-sonnet-4-5)");
|
|
42540
|
+
console.error(" --silent Suppress all output");
|
|
42528
42541
|
console.error();
|
|
42529
42542
|
console.error("Targets format (JSON array):");
|
|
42530
42543
|
console.error(" [");
|
|
@@ -42541,6 +42554,7 @@ async function main() {
|
|
|
42541
42554
|
console.error("Examples:");
|
|
42542
42555
|
console.error(" pensar swarm targets.json");
|
|
42543
42556
|
console.error(" pensar swarm targets.json --model gpt-4o");
|
|
42557
|
+
console.error(" pensar swarm targets.json --silent");
|
|
42544
42558
|
console.error(` pensar swarm '[{"target":"api.example.com","objective":"Test API"}]'`);
|
|
42545
42559
|
console.error(` pensar swarm '[{"target":"api.example.com","objective":"Test API"}]' --model gpt-4o`);
|
|
42546
42560
|
process.exit(1);
|
|
@@ -42556,6 +42570,7 @@ async function main() {
|
|
|
42556
42570
|
}
|
|
42557
42571
|
model = modelArg;
|
|
42558
42572
|
}
|
|
42573
|
+
const silent = args.includes("--silent");
|
|
42559
42574
|
let targetsJson;
|
|
42560
42575
|
if (targetsInput.startsWith("[") || targetsInput.startsWith("{")) {
|
|
42561
42576
|
targetsJson = targetsInput;
|
|
@@ -42570,14 +42585,15 @@ async function main() {
|
|
|
42570
42585
|
try {
|
|
42571
42586
|
const session = await swarm({
|
|
42572
42587
|
targets: targetsJson,
|
|
42573
|
-
model
|
|
42588
|
+
model,
|
|
42589
|
+
silent
|
|
42574
42590
|
});
|
|
42575
42591
|
if (!session) {
|
|
42576
|
-
|
|
42592
|
+
if (!silent) {
|
|
42593
|
+
console.error("No session was returned");
|
|
42594
|
+
}
|
|
42577
42595
|
process.exit(1);
|
|
42578
42596
|
}
|
|
42579
|
-
console.log();
|
|
42580
|
-
console.log("__PENSAR_SWARM_RESULT__");
|
|
42581
42597
|
console.log(JSON.stringify({
|
|
42582
42598
|
sessionId: session.id,
|
|
42583
42599
|
sessionPath: session.rootPath,
|