erosolar-cli 2.1.245 → 2.1.246
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/dist/capabilities/index.js +1 -0
- package/dist/capabilities/index.js.map +1 -1
- package/dist/core/agentOrchestrator.d.ts +115 -0
- package/dist/core/agentOrchestrator.d.ts.map +1 -1
- package/dist/core/agentOrchestrator.js +360 -0
- package/dist/core/agentOrchestrator.js.map +1 -1
- package/dist/core/unifiedFraudOrchestrator.d.ts +74 -0
- package/dist/core/unifiedFraudOrchestrator.d.ts.map +1 -1
- package/dist/core/unifiedFraudOrchestrator.js +1013 -0
- package/dist/core/unifiedFraudOrchestrator.js.map +1 -1
- package/dist/tools/taoTools.d.ts.map +1 -1
- package/dist/tools/taoTools.js +855 -0
- package/dist/tools/taoTools.js.map +1 -1
- package/package.json +1 -1
|
@@ -27,4 +27,5 @@ export { TaoCapabilityModule, } from './taoCapability.js';
|
|
|
27
27
|
export { IntegrityCapabilityModule, } from './integrityCapability.js';
|
|
28
28
|
export { iMessageVerificationCapabilityModule, } from './iMessageVerificationCapability.js';
|
|
29
29
|
export { UnifiedInvestigationCapabilityModule, } from './unifiedInvestigationCapability.js';
|
|
30
|
+
// orchestrationCapability removed - functionality consolidated into GlobalOrchestrator tool
|
|
30
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/capabilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAoC,MAAM,2BAA2B,CAAC;AACzG,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAA8B,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAAgC,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EAAE,oBAAoB,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,EACL,+BAA+B,GAEhC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,iCAAiC,GAElC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,0BAA0B,GAE3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,qBAAqB,GAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,mBAAmB,GAEpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,yBAAyB,GAE1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,oCAAoC,GAErC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,oCAAoC,GAErC,MAAM,qCAAqC,CAAC;AAC7C,4FAA4F"}
|
|
@@ -3,6 +3,8 @@ import { type CompletionAnalysis } from './taskCompletionDetector.js';
|
|
|
3
3
|
import { type AttackChain, type TechniqueResult, type KillChainPhase } from '../tools/tao/index.js';
|
|
4
4
|
import { type OperationalRegion, type InfrastructureStack } from './infrastructureTemplates.js';
|
|
5
5
|
import { type AgencyType } from './governmentProcedures.js';
|
|
6
|
+
export declare const KILL_CHAIN_PHASES: readonly ["reconnaissance", "initial_access", "persistence", "privilege_escalation", "defense_evasion", "credential_access", "discovery", "lateral_movement", "collection", "command_control", "exfiltration", "impact"];
|
|
7
|
+
export type FullKillChainPhase = typeof KILL_CHAIN_PHASES[number];
|
|
6
8
|
export type OrchestratorExitReason = 'complete' | 'verification-needed' | 'no-action' | 'empty-response' | 'blocked' | 'refusal' | 'incomplete' | 'attack-chain-complete' | 'attack-chain-aborted';
|
|
7
9
|
/** Unified orchestration mode - determines execution strategy */
|
|
8
10
|
export type UnifiedMode = 'standard' | 'attack-chain' | 'apt-simulation' | 'infrastructure' | 'red-team' | 'intel-collection' | 'compliance';
|
|
@@ -60,6 +62,93 @@ export interface OrchestratorOptions {
|
|
|
60
62
|
}>) => void;
|
|
61
63
|
/** Callback for infrastructure stack */
|
|
62
64
|
onInfrastructure?: (stack: InfrastructureStack) => void;
|
|
65
|
+
/** Callback for each kill-chain phase completion */
|
|
66
|
+
onPhaseComplete?: (phase: FullKillChainPhase, outputs: string[]) => void;
|
|
67
|
+
/** Callback for full chain completion */
|
|
68
|
+
onChainComplete?: (result: FullAttackChainResult) => void;
|
|
69
|
+
/** Execute full kill-chain attack */
|
|
70
|
+
fullKillChain?: boolean;
|
|
71
|
+
/** Specific phases to execute (default: all) */
|
|
72
|
+
killChainPhases?: FullKillChainPhase[];
|
|
73
|
+
/** Stealth level: loud, moderate, quiet, ghost */
|
|
74
|
+
stealthLevel?: 'loud' | 'moderate' | 'quiet' | 'ghost';
|
|
75
|
+
/** Chain-specific objectives */
|
|
76
|
+
chainObjectives?: string[];
|
|
77
|
+
/** Operational constraints */
|
|
78
|
+
operationalConstraints?: string[];
|
|
79
|
+
/** C2 configuration for command-control phase */
|
|
80
|
+
c2Config?: {
|
|
81
|
+
type: string;
|
|
82
|
+
domain?: string;
|
|
83
|
+
port?: number;
|
|
84
|
+
encryption?: string;
|
|
85
|
+
fallback?: string[];
|
|
86
|
+
};
|
|
87
|
+
/** Exfiltration configuration */
|
|
88
|
+
exfilConfig?: {
|
|
89
|
+
method: string;
|
|
90
|
+
destination?: string;
|
|
91
|
+
encryption?: boolean;
|
|
92
|
+
chunkSize?: number;
|
|
93
|
+
};
|
|
94
|
+
/** Time limit for entire chain (seconds) */
|
|
95
|
+
chainTimeLimit?: number;
|
|
96
|
+
/** Whether to continue after phase failures */
|
|
97
|
+
continueOnFailure?: boolean;
|
|
98
|
+
}
|
|
99
|
+
/** Full attack chain execution result */
|
|
100
|
+
export interface FullAttackChainResult {
|
|
101
|
+
chainId: string;
|
|
102
|
+
targets: string[];
|
|
103
|
+
startTime: number;
|
|
104
|
+
endTime: number;
|
|
105
|
+
duration: number;
|
|
106
|
+
phases: Array<{
|
|
107
|
+
phase: FullKillChainPhase;
|
|
108
|
+
status: 'success' | 'partial' | 'failed' | 'skipped';
|
|
109
|
+
techniques: Array<{
|
|
110
|
+
id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
success: boolean;
|
|
113
|
+
duration: number;
|
|
114
|
+
risk: number;
|
|
115
|
+
outputs: string[];
|
|
116
|
+
}>;
|
|
117
|
+
outputs: string[];
|
|
118
|
+
}>;
|
|
119
|
+
artifacts: Array<{
|
|
120
|
+
type: string;
|
|
121
|
+
data: string;
|
|
122
|
+
phase: FullKillChainPhase;
|
|
123
|
+
}>;
|
|
124
|
+
credentials: Array<{
|
|
125
|
+
type: string;
|
|
126
|
+
value: string;
|
|
127
|
+
source: string;
|
|
128
|
+
}>;
|
|
129
|
+
persistence: Array<{
|
|
130
|
+
mechanism: string;
|
|
131
|
+
location: string;
|
|
132
|
+
status: string;
|
|
133
|
+
}>;
|
|
134
|
+
c2Channels: Array<{
|
|
135
|
+
type: string;
|
|
136
|
+
endpoint: string;
|
|
137
|
+
status: string;
|
|
138
|
+
}>;
|
|
139
|
+
exfilData: Array<{
|
|
140
|
+
type: string;
|
|
141
|
+
size: number;
|
|
142
|
+
destination: string;
|
|
143
|
+
}>;
|
|
144
|
+
detectionEvents: Array<{
|
|
145
|
+
time: number;
|
|
146
|
+
type: string;
|
|
147
|
+
severity: string;
|
|
148
|
+
}>;
|
|
149
|
+
overallSuccess: boolean;
|
|
150
|
+
successRate: number;
|
|
151
|
+
stealthScore: number;
|
|
63
152
|
}
|
|
64
153
|
/** Real technique execution result */
|
|
65
154
|
export interface RealExecutionResult {
|
|
@@ -133,6 +222,8 @@ export interface OrchestratorResult {
|
|
|
133
222
|
teardownScript?: string;
|
|
134
223
|
/** OPSEC checklist */
|
|
135
224
|
opsecChecklist?: string;
|
|
225
|
+
/** Full attack chain result when fullKillChain mode is used */
|
|
226
|
+
fullAttackChainResult?: FullAttackChainResult;
|
|
136
227
|
/** Goals achieved during execution */
|
|
137
228
|
achievedGoals?: APTGoal[];
|
|
138
229
|
/** All collected artifacts */
|
|
@@ -281,5 +372,29 @@ export declare class AgentOrchestrator {
|
|
|
281
372
|
private buildAuthorizationError;
|
|
282
373
|
private buildExecutionSummary;
|
|
283
374
|
private buildRecommendations;
|
|
375
|
+
/** TAO tool suite instance for direct tool invocation */
|
|
376
|
+
private taoTools;
|
|
377
|
+
/**
|
|
378
|
+
* Get or create the TAO tools instance.
|
|
379
|
+
*/
|
|
380
|
+
private getTaoTools;
|
|
381
|
+
/**
|
|
382
|
+
* Execute full offensive attack chain using the UnifiedAttackChain tool.
|
|
383
|
+
* This integrates all 12 kill-chain phases with configurable stealth and objectives.
|
|
384
|
+
*/
|
|
385
|
+
executeFullAttackChain(targets: string[], options?: OrchestratorOptions): Promise<OrchestratorResult>;
|
|
386
|
+
/**
|
|
387
|
+
* Build summary for full attack chain execution.
|
|
388
|
+
*/
|
|
389
|
+
private buildFullAttackChainSummary;
|
|
390
|
+
/**
|
|
391
|
+
* Build recommendations for full chain execution.
|
|
392
|
+
*/
|
|
393
|
+
private buildFullChainRecommendations;
|
|
394
|
+
/**
|
|
395
|
+
* Run full offensive attack chain mode.
|
|
396
|
+
* This is the main entry point for full kill-chain operations.
|
|
397
|
+
*/
|
|
398
|
+
runFullOffensiveChain(request: string, options?: OrchestratorOptions): Promise<OrchestratorResult>;
|
|
284
399
|
}
|
|
285
400
|
//# sourceMappingURL=agentOrchestrator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentOrchestrator.d.ts","sourceRoot":"","sources":["../../src/core/agentOrchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAuB,MAAM,YAAY,CAAC;AAEpE,OAAO,EAA0B,KAAK,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAC9F,OAAO,EASL,KAAK,WAAW,EAEhB,KAAK,eAAe,EACpB,KAAK,cAAc,EAEpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"agentOrchestrator.d.ts","sourceRoot":"","sources":["../../src/core/agentOrchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAuB,MAAM,YAAY,CAAC;AAEpE,OAAO,EAA0B,KAAK,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAC9F,OAAO,EASL,KAAK,WAAW,EAEhB,KAAK,eAAe,EACpB,KAAK,cAAc,EAEpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,2BAA2B,CAAC;AAInC,eAAO,MAAM,iBAAiB,0NAapB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAElE,MAAM,MAAM,sBAAsB,GAC9B,UAAU,GACV,qBAAqB,GACrB,WAAW,GACX,gBAAgB,GAChB,SAAS,GACT,SAAS,GACT,YAAY,GACZ,uBAAuB,GACvB,sBAAsB,CAAC;AAE3B,iEAAiE;AACjE,MAAM,MAAM,WAAW,GACnB,UAAU,GACV,cAAc,GACd,gBAAgB,GAChB,gBAAgB,GAChB,UAAU,GACV,kBAAkB,GAClB,YAAY,CAAC;AAEjB,4CAA4C;AAC5C,MAAM,MAAM,OAAO,GACf,gBAAgB,GAChB,QAAQ,GACR,aAAa,GACb,WAAW,GACX,SAAS,GACT,YAAY,GACZ,cAAc,GACd,QAAQ,GACR,SAAS,GACT,KAAK,CAAC;AAEV,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gFAAgF;IAChF,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,yEAAyE;IACzE,gBAAgB,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACvC,gEAAgE;IAChE,eAAe,CAAC,EAA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AsB,CAC1B,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,kBAAkB,CAAC;IAyN9B;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAmFnC;;OAEG;IACH,OAAO,CAAC,6BAA6B;IA2BrC;;;OAGG;IACG,qBAAqB,CACzB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,kBAAkB,CAAC;CA8B/B"}
|
|
@@ -3,6 +3,22 @@ import { TaskCompletionDetector } from './taskCompletionDetector.js';
|
|
|
3
3
|
import { planAttackChain, selectNextTechnique, executeTechniqueInChain, techniqueRegistry, parseNaturalLanguageIntent, validateAuthorizationContext, getRLState, listActiveChains, } from '../tools/tao/index.js';
|
|
4
4
|
import { getInfrastructureStack, generateDeploymentScript, generateTeardownScript, generateOpsecChecklist, } from './infrastructureTemplates.js';
|
|
5
5
|
import { getAgencyContacts, getApplicableLegalFrameworks, } from './governmentProcedures.js';
|
|
6
|
+
import { createTaoTools } from '../tools/taoTools.js';
|
|
7
|
+
// Kill-chain phase definitions for full attack chain execution
|
|
8
|
+
export const KILL_CHAIN_PHASES = [
|
|
9
|
+
'reconnaissance',
|
|
10
|
+
'initial_access',
|
|
11
|
+
'persistence',
|
|
12
|
+
'privilege_escalation',
|
|
13
|
+
'defense_evasion',
|
|
14
|
+
'credential_access',
|
|
15
|
+
'discovery',
|
|
16
|
+
'lateral_movement',
|
|
17
|
+
'collection',
|
|
18
|
+
'command_control',
|
|
19
|
+
'exfiltration',
|
|
20
|
+
'impact',
|
|
21
|
+
];
|
|
6
22
|
/**
|
|
7
23
|
* Single-pass orchestration: drive the agent to finish as much as possible
|
|
8
24
|
* in one go, with strong bias toward real actions over planning.
|
|
@@ -1265,6 +1281,10 @@ Please provide context so I can help appropriately.`,
|
|
|
1265
1281
|
return this.runComplianceMode(request, options);
|
|
1266
1282
|
case 'standard':
|
|
1267
1283
|
default:
|
|
1284
|
+
// Check for full kill-chain mode
|
|
1285
|
+
if (options.fullKillChain) {
|
|
1286
|
+
return this.runFullOffensiveChain(request, options);
|
|
1287
|
+
}
|
|
1268
1288
|
// Check for goal-oriented execution
|
|
1269
1289
|
if (options.goal || options.goals) {
|
|
1270
1290
|
return this.runGoalOriented(request, options);
|
|
@@ -1752,5 +1772,345 @@ Please provide context so I can help appropriately.`,
|
|
|
1752
1772
|
}
|
|
1753
1773
|
return recommendations;
|
|
1754
1774
|
}
|
|
1775
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
1776
|
+
// FULL OFFENSIVE ATTACK CHAIN EXECUTION
|
|
1777
|
+
// Direct integration with UnifiedAttackChain tool
|
|
1778
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
1779
|
+
/** TAO tool suite instance for direct tool invocation */
|
|
1780
|
+
taoTools = null;
|
|
1781
|
+
/**
|
|
1782
|
+
* Get or create the TAO tools instance.
|
|
1783
|
+
*/
|
|
1784
|
+
getTaoTools() {
|
|
1785
|
+
if (!this.taoTools) {
|
|
1786
|
+
this.taoTools = createTaoTools(process.cwd());
|
|
1787
|
+
}
|
|
1788
|
+
return this.taoTools;
|
|
1789
|
+
}
|
|
1790
|
+
/**
|
|
1791
|
+
* Execute full offensive attack chain using the UnifiedAttackChain tool.
|
|
1792
|
+
* This integrates all 12 kill-chain phases with configurable stealth and objectives.
|
|
1793
|
+
*/
|
|
1794
|
+
async executeFullAttackChain(targets, options = {}) {
|
|
1795
|
+
const startTime = Date.now();
|
|
1796
|
+
const chainId = `chain_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
1797
|
+
// Validate authorization
|
|
1798
|
+
const intent = parseNaturalLanguageIntent(`attack ${targets.join(' ')}`);
|
|
1799
|
+
const auth = this.validateAttackAuthorization(intent, options.authorizationContext);
|
|
1800
|
+
if (!auth.authorized) {
|
|
1801
|
+
return this.buildAuthorizationError(auth);
|
|
1802
|
+
}
|
|
1803
|
+
const taoTools = this.getTaoTools();
|
|
1804
|
+
const unifiedAttackChainTool = taoTools.tools.find(t => t.name === 'UnifiedAttackChain');
|
|
1805
|
+
if (!unifiedAttackChainTool) {
|
|
1806
|
+
return {
|
|
1807
|
+
finalResponse: 'UnifiedAttackChain tool not available',
|
|
1808
|
+
toolsUsed: [],
|
|
1809
|
+
planOnly: false,
|
|
1810
|
+
tookAction: false,
|
|
1811
|
+
completion: this.buildCompletionAnalysis({
|
|
1812
|
+
totalTechniquesExecuted: 0,
|
|
1813
|
+
successfulTechniques: 0,
|
|
1814
|
+
failedTechniques: 0,
|
|
1815
|
+
totalDuration: 0,
|
|
1816
|
+
averageDetectionRisk: 0,
|
|
1817
|
+
phasesCompleted: [],
|
|
1818
|
+
artifactsCollected: 0,
|
|
1819
|
+
rlRewardAverage: 0,
|
|
1820
|
+
}),
|
|
1821
|
+
exitReason: 'attack-chain-aborted',
|
|
1822
|
+
statusSummary: 'Tool unavailable',
|
|
1823
|
+
limitations: ['UnifiedAttackChain tool not loaded'],
|
|
1824
|
+
recommendations: ['Check TAO tools configuration'],
|
|
1825
|
+
};
|
|
1826
|
+
}
|
|
1827
|
+
const result = {
|
|
1828
|
+
chainId,
|
|
1829
|
+
targets,
|
|
1830
|
+
startTime,
|
|
1831
|
+
endTime: 0,
|
|
1832
|
+
duration: 0,
|
|
1833
|
+
phases: [],
|
|
1834
|
+
artifacts: [],
|
|
1835
|
+
credentials: [],
|
|
1836
|
+
persistence: [],
|
|
1837
|
+
c2Channels: [],
|
|
1838
|
+
exfilData: [],
|
|
1839
|
+
detectionEvents: [],
|
|
1840
|
+
overallSuccess: false,
|
|
1841
|
+
successRate: 0,
|
|
1842
|
+
stealthScore: 1.0,
|
|
1843
|
+
};
|
|
1844
|
+
const phasesToExecute = options.killChainPhases ?? KILL_CHAIN_PHASES;
|
|
1845
|
+
const stealthLevel = options.stealthLevel ?? 'moderate';
|
|
1846
|
+
const continueOnFailure = options.continueOnFailure ?? true;
|
|
1847
|
+
let successfulPhases = 0;
|
|
1848
|
+
let totalTechniques = 0;
|
|
1849
|
+
let successfulTechniques = 0;
|
|
1850
|
+
for (const phase of phasesToExecute) {
|
|
1851
|
+
// Check time limit
|
|
1852
|
+
if (options.chainTimeLimit) {
|
|
1853
|
+
const elapsed = (Date.now() - startTime) / 1000;
|
|
1854
|
+
if (elapsed >= options.chainTimeLimit) {
|
|
1855
|
+
result.detectionEvents.push({
|
|
1856
|
+
time: Date.now(),
|
|
1857
|
+
type: 'timeout',
|
|
1858
|
+
severity: 'info',
|
|
1859
|
+
});
|
|
1860
|
+
break;
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
try {
|
|
1864
|
+
// Execute phase using UnifiedAttackChain tool
|
|
1865
|
+
const phaseResult = await unifiedAttackChainTool.handler({
|
|
1866
|
+
operation: 'execute_phase',
|
|
1867
|
+
targets,
|
|
1868
|
+
phase,
|
|
1869
|
+
chain_id: chainId,
|
|
1870
|
+
depth: options.attackDepth ?? 'standard',
|
|
1871
|
+
stealth_level: stealthLevel,
|
|
1872
|
+
objectives: options.chainObjectives ?? [],
|
|
1873
|
+
constraints: options.operationalConstraints ?? [],
|
|
1874
|
+
c2_config: options.c2Config,
|
|
1875
|
+
exfil_config: options.exfilConfig,
|
|
1876
|
+
});
|
|
1877
|
+
const parsed = JSON.parse(phaseResult);
|
|
1878
|
+
const phaseData = {
|
|
1879
|
+
phase,
|
|
1880
|
+
status: parsed.success ? 'success' : parsed.partial ? 'partial' : 'failed',
|
|
1881
|
+
techniques: parsed.techniques?.map((t) => ({
|
|
1882
|
+
id: t['id'],
|
|
1883
|
+
name: t['name'],
|
|
1884
|
+
success: t['success'],
|
|
1885
|
+
duration: t['duration'],
|
|
1886
|
+
risk: t['risk'],
|
|
1887
|
+
outputs: t['outputs'] ?? [],
|
|
1888
|
+
})) ?? [],
|
|
1889
|
+
outputs: parsed.outputs ?? [],
|
|
1890
|
+
};
|
|
1891
|
+
result.phases.push(phaseData);
|
|
1892
|
+
// Collect artifacts
|
|
1893
|
+
if (parsed.artifacts) {
|
|
1894
|
+
for (const artifact of parsed.artifacts) {
|
|
1895
|
+
result.artifacts.push({ ...artifact, phase });
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
// Collect credentials
|
|
1899
|
+
if (parsed.credentials) {
|
|
1900
|
+
result.credentials.push(...parsed.credentials);
|
|
1901
|
+
}
|
|
1902
|
+
// Collect persistence mechanisms
|
|
1903
|
+
if (parsed.persistence) {
|
|
1904
|
+
result.persistence.push(...parsed.persistence);
|
|
1905
|
+
}
|
|
1906
|
+
// Collect C2 channels
|
|
1907
|
+
if (parsed.c2_channels) {
|
|
1908
|
+
result.c2Channels.push(...parsed.c2_channels);
|
|
1909
|
+
}
|
|
1910
|
+
// Collect exfil data
|
|
1911
|
+
if (parsed.exfil_data) {
|
|
1912
|
+
result.exfilData.push(...parsed.exfil_data);
|
|
1913
|
+
}
|
|
1914
|
+
// Update metrics
|
|
1915
|
+
totalTechniques += phaseData.techniques.length;
|
|
1916
|
+
successfulTechniques += phaseData.techniques.filter(t => t.success).length;
|
|
1917
|
+
if (phaseData.status === 'success') {
|
|
1918
|
+
successfulPhases++;
|
|
1919
|
+
}
|
|
1920
|
+
// Update stealth score
|
|
1921
|
+
const phaseRisk = phaseData.techniques.reduce((sum, t) => sum + t.risk, 0) /
|
|
1922
|
+
Math.max(1, phaseData.techniques.length);
|
|
1923
|
+
result.stealthScore = Math.min(result.stealthScore, 1 - phaseRisk);
|
|
1924
|
+
// Callback
|
|
1925
|
+
options.onPhaseComplete?.(phase, phaseData.outputs);
|
|
1926
|
+
// Check if we should continue
|
|
1927
|
+
if (phaseData.status === 'failed' && !continueOnFailure) {
|
|
1928
|
+
result.detectionEvents.push({
|
|
1929
|
+
time: Date.now(),
|
|
1930
|
+
type: 'phase_failure',
|
|
1931
|
+
severity: 'high',
|
|
1932
|
+
});
|
|
1933
|
+
break;
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
catch (error) {
|
|
1937
|
+
result.phases.push({
|
|
1938
|
+
phase,
|
|
1939
|
+
status: 'failed',
|
|
1940
|
+
techniques: [],
|
|
1941
|
+
outputs: [],
|
|
1942
|
+
});
|
|
1943
|
+
result.detectionEvents.push({
|
|
1944
|
+
time: Date.now(),
|
|
1945
|
+
type: 'execution_error',
|
|
1946
|
+
severity: 'critical',
|
|
1947
|
+
});
|
|
1948
|
+
if (!continueOnFailure)
|
|
1949
|
+
break;
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
// Finalize result
|
|
1953
|
+
result.endTime = Date.now();
|
|
1954
|
+
result.duration = result.endTime - result.startTime;
|
|
1955
|
+
result.successRate = totalTechniques > 0 ? successfulTechniques / totalTechniques : 0;
|
|
1956
|
+
result.overallSuccess = result.successRate >= 0.5 && successfulPhases >= phasesToExecute.length / 2;
|
|
1957
|
+
// Callback
|
|
1958
|
+
options.onChainComplete?.(result);
|
|
1959
|
+
// Build response
|
|
1960
|
+
const summary = this.buildFullAttackChainSummary(result);
|
|
1961
|
+
return {
|
|
1962
|
+
finalResponse: summary,
|
|
1963
|
+
toolsUsed: result.phases.flatMap(p => p.techniques.map(t => `tao:${t.id}`)),
|
|
1964
|
+
planOnly: false,
|
|
1965
|
+
tookAction: true,
|
|
1966
|
+
completion: this.buildCompletionAnalysis({
|
|
1967
|
+
totalTechniquesExecuted: totalTechniques,
|
|
1968
|
+
successfulTechniques,
|
|
1969
|
+
failedTechniques: totalTechniques - successfulTechniques,
|
|
1970
|
+
totalDuration: result.duration,
|
|
1971
|
+
averageDetectionRisk: 1 - result.stealthScore,
|
|
1972
|
+
phasesCompleted: result.phases.filter(p => p.status === 'success').map(p => p.phase),
|
|
1973
|
+
artifactsCollected: result.artifacts.length,
|
|
1974
|
+
rlRewardAverage: getRLState().avgReward,
|
|
1975
|
+
}),
|
|
1976
|
+
exitReason: result.overallSuccess ? 'attack-chain-complete' : 'attack-chain-aborted',
|
|
1977
|
+
statusSummary: `Full Kill-Chain: ${successfulPhases}/${phasesToExecute.length} phases, ${Math.round(result.successRate * 100)}% success`,
|
|
1978
|
+
limitations: result.phases.filter(p => p.status === 'failed').map(p => `Phase '${p.phase}' failed`),
|
|
1979
|
+
recommendations: this.buildFullChainRecommendations(result),
|
|
1980
|
+
fullAttackChainResult: result,
|
|
1981
|
+
attackChains: listActiveChains(),
|
|
1982
|
+
};
|
|
1983
|
+
}
|
|
1984
|
+
/**
|
|
1985
|
+
* Build summary for full attack chain execution.
|
|
1986
|
+
*/
|
|
1987
|
+
buildFullAttackChainSummary(result) {
|
|
1988
|
+
const lines = [];
|
|
1989
|
+
lines.push('## Full Kill-Chain Attack Summary\n');
|
|
1990
|
+
lines.push(`**Chain ID:** ${result.chainId}`);
|
|
1991
|
+
lines.push(`**Targets:** ${result.targets.join(', ')}`);
|
|
1992
|
+
lines.push(`**Duration:** ${(result.duration / 1000).toFixed(1)}s`);
|
|
1993
|
+
lines.push(`**Success Rate:** ${Math.round(result.successRate * 100)}%`);
|
|
1994
|
+
lines.push(`**Stealth Score:** ${Math.round(result.stealthScore * 100)}%`);
|
|
1995
|
+
lines.push('');
|
|
1996
|
+
lines.push('### Phase Results\n');
|
|
1997
|
+
for (const phase of result.phases) {
|
|
1998
|
+
const statusIcon = phase.status === 'success' ? '✓' :
|
|
1999
|
+
phase.status === 'partial' ? '◐' : '✗';
|
|
2000
|
+
lines.push(`**${statusIcon} ${phase.phase.toUpperCase()}**`);
|
|
2001
|
+
lines.push(`- Status: ${phase.status}`);
|
|
2002
|
+
lines.push(`- Techniques: ${phase.techniques.filter(t => t.success).length}/${phase.techniques.length}`);
|
|
2003
|
+
if (phase.outputs.length > 0) {
|
|
2004
|
+
lines.push(`- Outputs: ${phase.outputs.join(', ')}`);
|
|
2005
|
+
}
|
|
2006
|
+
lines.push('');
|
|
2007
|
+
}
|
|
2008
|
+
if (result.credentials.length > 0) {
|
|
2009
|
+
lines.push('### Credentials Harvested\n');
|
|
2010
|
+
lines.push(`- **Total:** ${result.credentials.length}`);
|
|
2011
|
+
const byType = new Map();
|
|
2012
|
+
for (const cred of result.credentials) {
|
|
2013
|
+
byType.set(cred.type, (byType.get(cred.type) || 0) + 1);
|
|
2014
|
+
}
|
|
2015
|
+
for (const [type, count] of byType) {
|
|
2016
|
+
lines.push(`- ${type}: ${count}`);
|
|
2017
|
+
}
|
|
2018
|
+
lines.push('');
|
|
2019
|
+
}
|
|
2020
|
+
if (result.persistence.length > 0) {
|
|
2021
|
+
lines.push('### Persistence Mechanisms\n');
|
|
2022
|
+
for (const p of result.persistence) {
|
|
2023
|
+
lines.push(`- **${p.mechanism}:** ${p.status}`);
|
|
2024
|
+
}
|
|
2025
|
+
lines.push('');
|
|
2026
|
+
}
|
|
2027
|
+
if (result.c2Channels.length > 0) {
|
|
2028
|
+
lines.push('### C2 Channels\n');
|
|
2029
|
+
for (const c2 of result.c2Channels) {
|
|
2030
|
+
lines.push(`- **${c2.type}:** ${c2.status}`);
|
|
2031
|
+
}
|
|
2032
|
+
lines.push('');
|
|
2033
|
+
}
|
|
2034
|
+
if (result.exfilData.length > 0) {
|
|
2035
|
+
lines.push('### Exfiltrated Data\n');
|
|
2036
|
+
const totalSize = result.exfilData.reduce((sum, e) => sum + e.size, 0);
|
|
2037
|
+
lines.push(`- **Total:** ${result.exfilData.length} items, ${(totalSize / 1024).toFixed(1)} KB`);
|
|
2038
|
+
lines.push('');
|
|
2039
|
+
}
|
|
2040
|
+
if (result.artifacts.length > 0) {
|
|
2041
|
+
lines.push('### Artifacts Collected\n');
|
|
2042
|
+
const byPhase = new Map();
|
|
2043
|
+
for (const a of result.artifacts) {
|
|
2044
|
+
byPhase.set(a.phase, (byPhase.get(a.phase) || 0) + 1);
|
|
2045
|
+
}
|
|
2046
|
+
for (const [phase, count] of byPhase) {
|
|
2047
|
+
lines.push(`- ${phase}: ${count}`);
|
|
2048
|
+
}
|
|
2049
|
+
lines.push('');
|
|
2050
|
+
}
|
|
2051
|
+
if (result.detectionEvents.length > 0) {
|
|
2052
|
+
lines.push('### Detection Events\n');
|
|
2053
|
+
for (const event of result.detectionEvents) {
|
|
2054
|
+
lines.push(`- **${event.severity.toUpperCase()}:** ${event.type}`);
|
|
2055
|
+
}
|
|
2056
|
+
lines.push('');
|
|
2057
|
+
}
|
|
2058
|
+
return lines.join('\n');
|
|
2059
|
+
}
|
|
2060
|
+
/**
|
|
2061
|
+
* Build recommendations for full chain execution.
|
|
2062
|
+
*/
|
|
2063
|
+
buildFullChainRecommendations(result) {
|
|
2064
|
+
const recommendations = [];
|
|
2065
|
+
const failedPhases = result.phases.filter(p => p.status === 'failed');
|
|
2066
|
+
if (failedPhases.length > 0) {
|
|
2067
|
+
recommendations.push(`Review failed phases: ${failedPhases.map(p => p.phase).join(', ')}`);
|
|
2068
|
+
}
|
|
2069
|
+
if (result.stealthScore < 0.5) {
|
|
2070
|
+
recommendations.push('High detection risk detected - consider more stealthy techniques');
|
|
2071
|
+
}
|
|
2072
|
+
if (result.credentials.length === 0 && result.phases.some(p => p.phase === 'credential_access')) {
|
|
2073
|
+
recommendations.push('No credentials harvested - try alternative credential techniques');
|
|
2074
|
+
}
|
|
2075
|
+
if (result.persistence.length === 0 && result.phases.some(p => p.phase === 'persistence')) {
|
|
2076
|
+
recommendations.push('No persistence established - critical for long-term access');
|
|
2077
|
+
}
|
|
2078
|
+
if (result.c2Channels.length === 0 && result.phases.some(p => p.phase === 'command_control')) {
|
|
2079
|
+
recommendations.push('No C2 channels established - consider fallback C2 options');
|
|
2080
|
+
}
|
|
2081
|
+
return recommendations;
|
|
2082
|
+
}
|
|
2083
|
+
/**
|
|
2084
|
+
* Run full offensive attack chain mode.
|
|
2085
|
+
* This is the main entry point for full kill-chain operations.
|
|
2086
|
+
*/
|
|
2087
|
+
async runFullOffensiveChain(request, options = {}) {
|
|
2088
|
+
// Parse targets from request
|
|
2089
|
+
const intent = parseNaturalLanguageIntent(request);
|
|
2090
|
+
const targets = options.attackTargets ?? intent.targets;
|
|
2091
|
+
if (targets.length === 0) {
|
|
2092
|
+
return {
|
|
2093
|
+
finalResponse: 'No targets specified for attack chain',
|
|
2094
|
+
toolsUsed: [],
|
|
2095
|
+
planOnly: false,
|
|
2096
|
+
tookAction: false,
|
|
2097
|
+
completion: this.buildCompletionAnalysis({
|
|
2098
|
+
totalTechniquesExecuted: 0,
|
|
2099
|
+
successfulTechniques: 0,
|
|
2100
|
+
failedTechniques: 0,
|
|
2101
|
+
totalDuration: 0,
|
|
2102
|
+
averageDetectionRisk: 0,
|
|
2103
|
+
phasesCompleted: [],
|
|
2104
|
+
artifactsCollected: 0,
|
|
2105
|
+
rlRewardAverage: 0,
|
|
2106
|
+
}),
|
|
2107
|
+
exitReason: 'incomplete',
|
|
2108
|
+
statusSummary: 'No targets',
|
|
2109
|
+
limitations: ['No targets provided'],
|
|
2110
|
+
recommendations: ['Specify targets using --targets or in the request'],
|
|
2111
|
+
};
|
|
2112
|
+
}
|
|
2113
|
+
return this.executeFullAttackChain(targets, options);
|
|
2114
|
+
}
|
|
1755
2115
|
}
|
|
1756
2116
|
//# sourceMappingURL=agentOrchestrator.js.map
|