erosolar-cli 2.1.245 → 2.1.247
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.d.ts +1 -0
- package/dist/capabilities/index.d.ts.map +1 -1
- package/dist/capabilities/index.js +1 -0
- package/dist/capabilities/index.js.map +1 -1
- package/dist/capabilities/orchestrationCapability.d.ts +27 -0
- package/dist/capabilities/orchestrationCapability.d.ts.map +1 -0
- package/dist/capabilities/orchestrationCapability.js +298 -0
- package/dist/capabilities/orchestrationCapability.js.map +1 -0
- 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
|
@@ -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
|