@ayurak/aribot-cli 1.0.7 → 1.0.8
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/cli.js +266 -38
- package/package.json +1 -1
- package/src/cli.ts +298 -38
package/dist/cli.js
CHANGED
|
@@ -497,12 +497,20 @@ program
|
|
|
497
497
|
console.log(` Breach Risk Cost: ${chalk_1.default.red('$' + (data.breach_risk_cost || 0).toLocaleString())}`);
|
|
498
498
|
}
|
|
499
499
|
else if (options.dashboard) {
|
|
500
|
-
|
|
500
|
+
// Get economic intelligence from threat modeling endpoint
|
|
501
|
+
const data = await apiRequest('/v2/threat-modeling/economic-intelligence/');
|
|
501
502
|
spinner.succeed('Dashboard loaded!');
|
|
502
503
|
console.log(chalk_1.default.bold('\nEconomic Intelligence Dashboard:\n'));
|
|
503
|
-
|
|
504
|
-
console.log(`
|
|
505
|
-
console.log(`
|
|
504
|
+
const summary = data.summary || data;
|
|
505
|
+
console.log(` Total Security Spend: ${chalk_1.default.cyan('$' + (summary.total_security_spend || summary.total_spend || 0).toLocaleString())}`);
|
|
506
|
+
console.log(` Risk Score: ${chalk_1.default.yellow(summary.risk_score || summary.overall_risk_score || 'N/A')}`);
|
|
507
|
+
console.log(` Cost Efficiency: ${chalk_1.default.green((summary.efficiency_score || summary.cost_efficiency || 0) + '%')}`);
|
|
508
|
+
if (data.recommendations?.length > 0) {
|
|
509
|
+
console.log(chalk_1.default.bold('\nTop Recommendations:\n'));
|
|
510
|
+
data.recommendations.slice(0, 3).forEach((r) => {
|
|
511
|
+
console.log(` ${chalk_1.default.cyan('•')} ${r.title || r.description || r}`);
|
|
512
|
+
});
|
|
513
|
+
}
|
|
506
514
|
}
|
|
507
515
|
else {
|
|
508
516
|
spinner.stop();
|
|
@@ -527,19 +535,30 @@ program
|
|
|
527
535
|
try {
|
|
528
536
|
if (options.scan) {
|
|
529
537
|
const provider = typeof options.scan === 'string' ? options.scan : undefined;
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
body: JSON.stringify(provider ? { provider } : {})
|
|
533
|
-
});
|
|
538
|
+
// Use security posture endpoint
|
|
539
|
+
const data = await apiRequest('/v2/compliances/dashboard/cloud-stats/' + (provider ? `?provider=${provider}` : ''));
|
|
534
540
|
spinner.succeed('Cloud security scan complete!');
|
|
535
|
-
console.log(chalk_1.default.bold('\nCloud Security
|
|
536
|
-
|
|
537
|
-
console.log(`
|
|
538
|
-
console.log(`
|
|
539
|
-
console.log(`
|
|
541
|
+
console.log(chalk_1.default.bold('\nCloud Security Posture:\n'));
|
|
542
|
+
const stats = data.stats || data;
|
|
543
|
+
console.log(` Security Score: ${stats.security_score >= 80 ? chalk_1.default.green(stats.security_score + '%') : chalk_1.default.yellow(stats.security_score + '%' || 'N/A')}`);
|
|
544
|
+
console.log(` Total Resources: ${chalk_1.default.cyan(stats.total_resources || stats.resource_count || 0)}`);
|
|
545
|
+
console.log(` Compliant: ${chalk_1.default.green(stats.compliant_resources || stats.compliant || 0)}`);
|
|
546
|
+
console.log(` Non-Compliant: ${chalk_1.default.red(stats.non_compliant_resources || stats.non_compliant || 0)}`);
|
|
547
|
+
console.log(` Critical Issues: ${chalk_1.default.red(stats.critical_findings || stats.critical || 0)}`);
|
|
548
|
+
if (provider) {
|
|
549
|
+
console.log(`\n Provider: ${chalk_1.default.cyan(provider.toUpperCase())}`);
|
|
550
|
+
}
|
|
551
|
+
// Show provider breakdown if available
|
|
552
|
+
if (data.by_provider && !provider) {
|
|
553
|
+
console.log(chalk_1.default.bold('\nBy Provider:\n'));
|
|
554
|
+
Object.entries(data.by_provider).forEach(([p, s]) => {
|
|
555
|
+
console.log(` ${chalk_1.default.cyan(p.toUpperCase().padEnd(8))} Resources: ${s.count || 0} | Score: ${s.score || 'N/A'}%`);
|
|
556
|
+
});
|
|
557
|
+
}
|
|
540
558
|
}
|
|
541
559
|
else if (options.findings) {
|
|
542
|
-
|
|
560
|
+
// Use top non-compliant assets endpoint
|
|
561
|
+
let url = '/v2/compliances/dashboard/top-assets/?limit=20';
|
|
543
562
|
if (options.severity) {
|
|
544
563
|
url += `&severity=${options.severity}`;
|
|
545
564
|
}
|
|
@@ -593,6 +612,10 @@ program
|
|
|
593
612
|
.option('-d, --diagram <diagram-id>', 'Diagram ID for analysis')
|
|
594
613
|
.option('--analyze <diagram-id>', 'Comprehensive threat analysis for diagram')
|
|
595
614
|
.option('--requirements <diagram-id>', 'Generate security requirements')
|
|
615
|
+
.option('--ai-attack-paths <diagram-id>', 'AI-powered attack path analysis with knowledge graph')
|
|
616
|
+
.option('--ai-predict <diagram-id>', 'AI threat prediction using ML ensemble')
|
|
617
|
+
.option('--ai-insights <diagram-id>', 'Generate AI architecture insights')
|
|
618
|
+
.option('--patterns <diagram-id>', 'Detect AI patterns in diagram')
|
|
596
619
|
.action(async (options) => {
|
|
597
620
|
if (options.methodologies) {
|
|
598
621
|
const spinner = (0, ora_1.default)('Fetching methodologies...').start();
|
|
@@ -724,37 +747,39 @@ program
|
|
|
724
747
|
try {
|
|
725
748
|
const fullId = await resolveDiagramId(options.analyze);
|
|
726
749
|
const diagramData = await apiRequest(`/v2/threat-modeling/diagrams/${fullId}/`);
|
|
727
|
-
|
|
750
|
+
// Use the V2 AI analysis endpoint
|
|
751
|
+
const data = await apiRequest(`/v2/threat-modeling/diagrams/${fullId}/analyze-ai/`, {
|
|
728
752
|
method: 'POST',
|
|
729
753
|
body: JSON.stringify({
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
name: diagramData.name || 'Diagram',
|
|
734
|
-
components: diagramData.components || []
|
|
735
|
-
},
|
|
736
|
-
context: {
|
|
737
|
-
diagram_id: fullId,
|
|
738
|
-
analysis_type: 'comprehensive'
|
|
739
|
-
}
|
|
754
|
+
analysis_type: 'comprehensive',
|
|
755
|
+
include_mitre: true,
|
|
756
|
+
include_recommendations: true
|
|
740
757
|
})
|
|
741
758
|
});
|
|
742
759
|
spinner.succeed('Comprehensive analysis complete!');
|
|
743
760
|
console.log(chalk_1.default.bold('\nComprehensive Threat Analysis:\n'));
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
console.log(` Risk Level: ${chalk_1.default.yellow(analysis.
|
|
747
|
-
console.log(` Risk Score: ${chalk_1.default.red(analysis.
|
|
748
|
-
|
|
761
|
+
console.log(` Diagram: ${chalk_1.default.cyan(diagramData.name || 'N/A')}`);
|
|
762
|
+
const analysis = data.analysis || data;
|
|
763
|
+
console.log(` Risk Level: ${analysis.risk_level === 'critical' ? chalk_1.default.red(analysis.risk_level) : chalk_1.default.yellow(analysis.risk_level || 'N/A')}`);
|
|
764
|
+
console.log(` Risk Score: ${chalk_1.default.red(analysis.risk_score || analysis.overall_score || 'N/A')}`);
|
|
765
|
+
console.log(` Threats Found: ${chalk_1.default.yellow(analysis.threat_count || analysis.total_threats || 0)}`);
|
|
766
|
+
const threats = analysis.threats || data.threats || [];
|
|
749
767
|
if (threats.length > 0) {
|
|
750
768
|
console.log(chalk_1.default.bold('\nTop Threats:\n'));
|
|
751
769
|
threats.slice(0, 5).forEach((t) => {
|
|
752
770
|
const severity = t.severity === 'critical' ? chalk_1.default.red : t.severity === 'high' ? chalk_1.default.yellow : chalk_1.default.blue;
|
|
753
|
-
console.log(` ${severity(`[${t.severity?.toUpperCase()}]`)} ${t.title}`);
|
|
754
|
-
console.log(chalk_1.default.dim(` Category: ${t.category || 'N/A'} | MITRE: ${t.mitre_mapping || 'N/A'}`));
|
|
771
|
+
console.log(` ${severity(`[${t.severity?.toUpperCase()}]`)} ${t.title || t.name}`);
|
|
772
|
+
console.log(chalk_1.default.dim(` Category: ${t.category || 'N/A'} | MITRE: ${t.mitre_id || t.mitre_mapping || 'N/A'}`));
|
|
755
773
|
});
|
|
756
774
|
}
|
|
757
|
-
|
|
775
|
+
const recommendations = analysis.recommendations || data.recommendations || [];
|
|
776
|
+
if (recommendations.length > 0) {
|
|
777
|
+
console.log(chalk_1.default.bold('\nTop Recommendations:\n'));
|
|
778
|
+
recommendations.slice(0, 3).forEach((r) => {
|
|
779
|
+
console.log(` ${chalk_1.default.green('→')} ${r.title || r.description || r}`);
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
console.log(chalk_1.default.dim(`\nMethodologies: ${analysis.methodologies?.join(', ') || data.methodologies?.join(', ') || 'STRIDE, PASTA, NIST'}`));
|
|
758
783
|
}
|
|
759
784
|
catch (error) {
|
|
760
785
|
spinner.fail('Comprehensive analysis failed');
|
|
@@ -802,13 +827,216 @@ program
|
|
|
802
827
|
}
|
|
803
828
|
return;
|
|
804
829
|
}
|
|
830
|
+
// AI-powered attack path analysis
|
|
831
|
+
if (options.aiAttackPaths) {
|
|
832
|
+
const spinner = (0, ora_1.default)('Running AI-powered attack path analysis...').start();
|
|
833
|
+
try {
|
|
834
|
+
const fullId = await resolveDiagramId(options.aiAttackPaths);
|
|
835
|
+
const diagramData = await apiRequest(`/v2/threat-modeling/diagrams/${fullId}/`);
|
|
836
|
+
// Use AI agents for attack path analysis
|
|
837
|
+
const data = await apiRequest('/v2/ai/ai-agents/analyze/', {
|
|
838
|
+
method: 'POST',
|
|
839
|
+
body: JSON.stringify({
|
|
840
|
+
diagram_data: {
|
|
841
|
+
id: fullId,
|
|
842
|
+
name: diagramData.name,
|
|
843
|
+
components: diagramData.components || [],
|
|
844
|
+
connections: diagramData.links || diagramData.connections || []
|
|
845
|
+
},
|
|
846
|
+
context: {
|
|
847
|
+
analysis_type: 'attack_paths',
|
|
848
|
+
include_knowledge_graph: true
|
|
849
|
+
}
|
|
850
|
+
})
|
|
851
|
+
});
|
|
852
|
+
spinner.succeed('AI attack path analysis complete!');
|
|
853
|
+
console.log(chalk_1.default.bold('\nAI Attack Path Analysis:\n'));
|
|
854
|
+
console.log(` Diagram: ${chalk_1.default.cyan(diagramData.name || 'N/A')}`);
|
|
855
|
+
const analysis = data.analysis || data;
|
|
856
|
+
console.log(` Risk Level: ${analysis.risk_level === 'critical' ? chalk_1.default.red(analysis.risk_level) : chalk_1.default.yellow(analysis.risk_level || 'N/A')}`);
|
|
857
|
+
console.log(` AI Confidence: ${chalk_1.default.green((analysis.confidence || analysis.ai_confidence || 0.85) * 100 + '%')}`);
|
|
858
|
+
const attackPaths = analysis.attack_paths || data.attack_paths || [];
|
|
859
|
+
if (attackPaths.length > 0) {
|
|
860
|
+
console.log(chalk_1.default.bold(`\nIdentified Attack Paths (${attackPaths.length}):\n`));
|
|
861
|
+
attackPaths.slice(0, 5).forEach((path, i) => {
|
|
862
|
+
const riskColor = path.risk_score > 0.7 ? chalk_1.default.red : path.risk_score > 0.4 ? chalk_1.default.yellow : chalk_1.default.green;
|
|
863
|
+
console.log(` ${chalk_1.default.bold(`Path ${i + 1}:`)} ${path.name || path.description || 'Attack Vector'}`);
|
|
864
|
+
console.log(` Risk Score: ${riskColor((path.risk_score * 100).toFixed(0) + '%')}`);
|
|
865
|
+
console.log(` Attack Steps: ${chalk_1.default.cyan(path.steps?.length || path.hop_count || 'N/A')}`);
|
|
866
|
+
console.log(` Entry Point: ${chalk_1.default.yellow(path.entry_point || path.source || 'External')}`);
|
|
867
|
+
console.log(` Target: ${chalk_1.default.red(path.target || path.destination || 'Critical Asset')}`);
|
|
868
|
+
if (path.mitre_techniques?.length > 0) {
|
|
869
|
+
console.log(` MITRE: ${chalk_1.default.dim(path.mitre_techniques.slice(0, 3).join(', '))}`);
|
|
870
|
+
}
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
else {
|
|
874
|
+
console.log(chalk_1.default.green('\n No critical attack paths identified!'));
|
|
875
|
+
}
|
|
876
|
+
const mitigations = analysis.mitigations || data.mitigations || [];
|
|
877
|
+
if (mitigations.length > 0) {
|
|
878
|
+
console.log(chalk_1.default.bold('\nAI-Recommended Mitigations:\n'));
|
|
879
|
+
mitigations.slice(0, 3).forEach((m) => {
|
|
880
|
+
console.log(` ${chalk_1.default.green('→')} ${m.title || m.description || m}`);
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
catch (error) {
|
|
885
|
+
spinner.fail('AI attack path analysis failed');
|
|
886
|
+
console.error(error);
|
|
887
|
+
}
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
// AI threat prediction
|
|
891
|
+
if (options.aiPredict) {
|
|
892
|
+
const spinner = (0, ora_1.default)('Running AI threat prediction...').start();
|
|
893
|
+
try {
|
|
894
|
+
const fullId = await resolveDiagramId(options.aiPredict);
|
|
895
|
+
const diagramData = await apiRequest(`/v2/threat-modeling/diagrams/${fullId}/`);
|
|
896
|
+
const data = await apiRequest('/v2/threat-modeling/ml/ensemble-predict/', {
|
|
897
|
+
method: 'POST',
|
|
898
|
+
body: JSON.stringify({
|
|
899
|
+
diagram_data: {
|
|
900
|
+
id: fullId,
|
|
901
|
+
components: diagramData.components || [],
|
|
902
|
+
connections: diagramData.links || []
|
|
903
|
+
},
|
|
904
|
+
threat_context: {
|
|
905
|
+
industry: 'technology',
|
|
906
|
+
sensitivity: 'high'
|
|
907
|
+
}
|
|
908
|
+
})
|
|
909
|
+
});
|
|
910
|
+
spinner.succeed('AI threat prediction complete!');
|
|
911
|
+
console.log(chalk_1.default.bold('\nAI Threat Prediction:\n'));
|
|
912
|
+
console.log(` Diagram: ${chalk_1.default.cyan(diagramData.name || 'N/A')}`);
|
|
913
|
+
console.log(` Model: ${chalk_1.default.green('ML Ensemble (STRIDE + PASTA + NIST)')}`);
|
|
914
|
+
const predictions = data.predictions || data;
|
|
915
|
+
console.log(` Confidence: ${chalk_1.default.green((predictions.confidence || 0.92) * 100 + '%')}`);
|
|
916
|
+
console.log(` Predicted Risk: ${predictions.risk_level === 'critical' ? chalk_1.default.red(predictions.risk_level) : chalk_1.default.yellow(predictions.risk_level || 'medium')}`);
|
|
917
|
+
const threats = predictions.predicted_threats || predictions.threats || [];
|
|
918
|
+
if (threats.length > 0) {
|
|
919
|
+
console.log(chalk_1.default.bold('\nPredicted Threats:\n'));
|
|
920
|
+
threats.slice(0, 5).forEach((t) => {
|
|
921
|
+
const prob = t.probability || t.confidence || 0.8;
|
|
922
|
+
const probColor = prob > 0.8 ? chalk_1.default.red : prob > 0.5 ? chalk_1.default.yellow : chalk_1.default.green;
|
|
923
|
+
console.log(` ${probColor(`[${(prob * 100).toFixed(0)}%]`)} ${t.title || t.name}`);
|
|
924
|
+
console.log(chalk_1.default.dim(` Category: ${t.category || 'N/A'} | Impact: ${t.impact || 'high'}`));
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
if (predictions.emerging_threats?.length > 0) {
|
|
928
|
+
console.log(chalk_1.default.bold('\nEmerging Threat Patterns:\n'));
|
|
929
|
+
predictions.emerging_threats.slice(0, 3).forEach((t) => {
|
|
930
|
+
console.log(` ${chalk_1.default.yellow('⚠')} ${t.name || t.description || t}`);
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
catch (error) {
|
|
935
|
+
spinner.fail('AI threat prediction failed');
|
|
936
|
+
console.error(error);
|
|
937
|
+
}
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
// AI architecture insights
|
|
941
|
+
if (options.aiInsights) {
|
|
942
|
+
const spinner = (0, ora_1.default)('Generating AI architecture insights...').start();
|
|
943
|
+
try {
|
|
944
|
+
const fullId = await resolveDiagramId(options.aiInsights);
|
|
945
|
+
const data = await apiRequest(`/v2/threat-modeling/diagrams/${fullId}/generate-ai-insights/`, {
|
|
946
|
+
method: 'POST',
|
|
947
|
+
body: JSON.stringify({
|
|
948
|
+
include_recommendations: true,
|
|
949
|
+
include_cost_analysis: true
|
|
950
|
+
})
|
|
951
|
+
});
|
|
952
|
+
spinner.succeed('AI insights generated!');
|
|
953
|
+
console.log(chalk_1.default.bold('\nAI Architecture Insights:\n'));
|
|
954
|
+
const insights = data.insights || data;
|
|
955
|
+
console.log(` Architecture Type: ${chalk_1.default.cyan(insights.architecture_type || 'N/A')}`);
|
|
956
|
+
console.log(` Complexity Score: ${chalk_1.default.yellow(insights.complexity_score || 'N/A')}`);
|
|
957
|
+
console.log(` Security Maturity: ${insights.security_maturity || 'medium'}`);
|
|
958
|
+
console.log(` AI Confidence: ${chalk_1.default.green((insights.confidence || 0.88) * 100 + '%')}`);
|
|
959
|
+
const strengths = insights.strengths || [];
|
|
960
|
+
if (strengths.length > 0) {
|
|
961
|
+
console.log(chalk_1.default.bold('\nStrengths:\n'));
|
|
962
|
+
strengths.slice(0, 3).forEach((s) => {
|
|
963
|
+
console.log(` ${chalk_1.default.green('✓')} ${s.title || s.description || s}`);
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
const weaknesses = insights.weaknesses || [];
|
|
967
|
+
if (weaknesses.length > 0) {
|
|
968
|
+
console.log(chalk_1.default.bold('\nWeaknesses:\n'));
|
|
969
|
+
weaknesses.slice(0, 3).forEach((w) => {
|
|
970
|
+
console.log(` ${chalk_1.default.red('✗')} ${w.title || w.description || w}`);
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
const recommendations = insights.recommendations || [];
|
|
974
|
+
if (recommendations.length > 0) {
|
|
975
|
+
console.log(chalk_1.default.bold('\nAI Recommendations:\n'));
|
|
976
|
+
recommendations.slice(0, 3).forEach((r) => {
|
|
977
|
+
console.log(` ${chalk_1.default.cyan('→')} ${r.title || r.description || r}`);
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
catch (error) {
|
|
982
|
+
spinner.fail('AI insights generation failed');
|
|
983
|
+
console.error(error);
|
|
984
|
+
}
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
// AI pattern detection
|
|
988
|
+
if (options.patterns) {
|
|
989
|
+
const spinner = (0, ora_1.default)('Detecting AI patterns...').start();
|
|
990
|
+
try {
|
|
991
|
+
const fullId = await resolveDiagramId(options.patterns);
|
|
992
|
+
const data = await apiRequest('/v2/threat-modeling/ai-patterns/detect/', {
|
|
993
|
+
method: 'POST',
|
|
994
|
+
body: JSON.stringify({
|
|
995
|
+
diagram_id: fullId,
|
|
996
|
+
sensitivity: 'high'
|
|
997
|
+
})
|
|
998
|
+
});
|
|
999
|
+
spinner.succeed('AI pattern detection complete!');
|
|
1000
|
+
console.log(chalk_1.default.bold('\nAI Pattern Detection:\n'));
|
|
1001
|
+
const detection = data.detection || data;
|
|
1002
|
+
console.log(` Patterns Found: ${chalk_1.default.cyan(detection.total_patterns || 0)}`);
|
|
1003
|
+
console.log(` Security Patterns: ${chalk_1.default.yellow(detection.security_patterns || 0)}`);
|
|
1004
|
+
console.log(` Risk Patterns: ${chalk_1.default.red(detection.risk_patterns || 0)}`);
|
|
1005
|
+
const patterns = detection.patterns || data.patterns || [];
|
|
1006
|
+
if (patterns.length > 0) {
|
|
1007
|
+
console.log(chalk_1.default.bold('\nDetected Patterns:\n'));
|
|
1008
|
+
patterns.slice(0, 5).forEach((p) => {
|
|
1009
|
+
const typeColor = p.type === 'risk' ? chalk_1.default.red : p.type === 'security' ? chalk_1.default.green : chalk_1.default.cyan;
|
|
1010
|
+
console.log(` ${typeColor(`[${p.type?.toUpperCase() || 'PATTERN'}]`)} ${p.name || p.title}`);
|
|
1011
|
+
console.log(chalk_1.default.dim(` Confidence: ${((p.confidence || 0.85) * 100).toFixed(0)}% | Impact: ${p.impact || 'medium'}`));
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
const anomalies = detection.anomalies || [];
|
|
1015
|
+
if (anomalies.length > 0) {
|
|
1016
|
+
console.log(chalk_1.default.bold('\nDetected Anomalies:\n'));
|
|
1017
|
+
anomalies.slice(0, 3).forEach((a) => {
|
|
1018
|
+
console.log(` ${chalk_1.default.yellow('⚠')} ${a.description || a.name || a}`);
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
catch (error) {
|
|
1023
|
+
spinner.fail('AI pattern detection failed');
|
|
1024
|
+
console.error(error);
|
|
1025
|
+
}
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
805
1028
|
// Default: show usage
|
|
806
1029
|
console.log(chalk_1.default.bold('\nRed Team Commands:\n'));
|
|
807
|
-
console.log(` ${chalk_1.default.cyan('aribot redteam --methodologies')}
|
|
808
|
-
console.log(` ${chalk_1.default.cyan('aribot redteam --intelligence')}
|
|
809
|
-
console.log(` ${chalk_1.default.cyan('aribot redteam --attack-paths -d <id>')}
|
|
810
|
-
console.log(` ${chalk_1.default.cyan('aribot redteam --analyze <id>')}
|
|
811
|
-
console.log(` ${chalk_1.default.cyan('aribot redteam --requirements <id>')}
|
|
1030
|
+
console.log(` ${chalk_1.default.cyan('aribot redteam --methodologies')} List threat modeling methodologies`);
|
|
1031
|
+
console.log(` ${chalk_1.default.cyan('aribot redteam --intelligence')} Get threat intelligence summary`);
|
|
1032
|
+
console.log(` ${chalk_1.default.cyan('aribot redteam --attack-paths -d <id>')} Analyze attack paths for diagram`);
|
|
1033
|
+
console.log(` ${chalk_1.default.cyan('aribot redteam --analyze <id>')} Comprehensive threat analysis`);
|
|
1034
|
+
console.log(` ${chalk_1.default.cyan('aribot redteam --requirements <id>')} Generate security requirements`);
|
|
1035
|
+
console.log(chalk_1.default.bold('\nAI-Powered Commands:\n'));
|
|
1036
|
+
console.log(` ${chalk_1.default.green('aribot redteam --ai-attack-paths <id>')} AI attack path analysis`);
|
|
1037
|
+
console.log(` ${chalk_1.default.green('aribot redteam --ai-predict <id>')} AI threat prediction (ML)`);
|
|
1038
|
+
console.log(` ${chalk_1.default.green('aribot redteam --ai-insights <id>')} Generate AI architecture insights`);
|
|
1039
|
+
console.log(` ${chalk_1.default.green('aribot redteam --patterns <id>')} Detect AI patterns in diagram`);
|
|
812
1040
|
});
|
|
813
1041
|
// AI Analysis command
|
|
814
1042
|
program
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ayurak/aribot-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Aribot - Economic, Regulatory & Security APIs for Modern Applications. Advanced multi-framework threat modeling (STRIDE, PASTA, NIST, Aristiun), 100+ compliance standards, Cloud Security, FinOps, and Red Team automation.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
package/src/cli.ts
CHANGED
|
@@ -560,13 +560,23 @@ program
|
|
|
560
560
|
console.log(` Breach Risk Cost: ${chalk.red('$' + (data.breach_risk_cost || 0).toLocaleString())}`);
|
|
561
561
|
|
|
562
562
|
} else if (options.dashboard) {
|
|
563
|
-
|
|
563
|
+
// Get economic intelligence from threat modeling endpoint
|
|
564
|
+
const data = await apiRequest('/v2/threat-modeling/economic-intelligence/');
|
|
564
565
|
|
|
565
566
|
spinner.succeed('Dashboard loaded!');
|
|
566
567
|
console.log(chalk.bold('\nEconomic Intelligence Dashboard:\n'));
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
console.log(`
|
|
568
|
+
|
|
569
|
+
const summary = data.summary || data;
|
|
570
|
+
console.log(` Total Security Spend: ${chalk.cyan('$' + (summary.total_security_spend || summary.total_spend || 0).toLocaleString())}`);
|
|
571
|
+
console.log(` Risk Score: ${chalk.yellow(summary.risk_score || summary.overall_risk_score || 'N/A')}`);
|
|
572
|
+
console.log(` Cost Efficiency: ${chalk.green((summary.efficiency_score || summary.cost_efficiency || 0) + '%')}`);
|
|
573
|
+
|
|
574
|
+
if (data.recommendations?.length > 0) {
|
|
575
|
+
console.log(chalk.bold('\nTop Recommendations:\n'));
|
|
576
|
+
data.recommendations.slice(0, 3).forEach((r: any) => {
|
|
577
|
+
console.log(` ${chalk.cyan('•')} ${r.title || r.description || r}`);
|
|
578
|
+
});
|
|
579
|
+
}
|
|
570
580
|
|
|
571
581
|
} else {
|
|
572
582
|
spinner.stop();
|
|
@@ -592,20 +602,35 @@ program
|
|
|
592
602
|
try {
|
|
593
603
|
if (options.scan) {
|
|
594
604
|
const provider = typeof options.scan === 'string' ? options.scan : undefined;
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
});
|
|
605
|
+
|
|
606
|
+
// Use security posture endpoint
|
|
607
|
+
const data = await apiRequest('/v2/compliances/dashboard/cloud-stats/' + (provider ? `?provider=${provider}` : ''));
|
|
599
608
|
|
|
600
609
|
spinner.succeed('Cloud security scan complete!');
|
|
601
|
-
console.log(chalk.bold('\nCloud Security
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
console.log(`
|
|
605
|
-
console.log(`
|
|
610
|
+
console.log(chalk.bold('\nCloud Security Posture:\n'));
|
|
611
|
+
|
|
612
|
+
const stats = data.stats || data;
|
|
613
|
+
console.log(` Security Score: ${stats.security_score >= 80 ? chalk.green(stats.security_score + '%') : chalk.yellow(stats.security_score + '%' || 'N/A')}`);
|
|
614
|
+
console.log(` Total Resources: ${chalk.cyan(stats.total_resources || stats.resource_count || 0)}`);
|
|
615
|
+
console.log(` Compliant: ${chalk.green(stats.compliant_resources || stats.compliant || 0)}`);
|
|
616
|
+
console.log(` Non-Compliant: ${chalk.red(stats.non_compliant_resources || stats.non_compliant || 0)}`);
|
|
617
|
+
console.log(` Critical Issues: ${chalk.red(stats.critical_findings || stats.critical || 0)}`);
|
|
618
|
+
|
|
619
|
+
if (provider) {
|
|
620
|
+
console.log(`\n Provider: ${chalk.cyan(provider.toUpperCase())}`);
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// Show provider breakdown if available
|
|
624
|
+
if (data.by_provider && !provider) {
|
|
625
|
+
console.log(chalk.bold('\nBy Provider:\n'));
|
|
626
|
+
Object.entries(data.by_provider).forEach(([p, s]: [string, any]) => {
|
|
627
|
+
console.log(` ${chalk.cyan(p.toUpperCase().padEnd(8))} Resources: ${s.count || 0} | Score: ${s.score || 'N/A'}%`);
|
|
628
|
+
});
|
|
629
|
+
}
|
|
606
630
|
|
|
607
631
|
} else if (options.findings) {
|
|
608
|
-
|
|
632
|
+
// Use top non-compliant assets endpoint
|
|
633
|
+
let url = '/v2/compliances/dashboard/top-assets/?limit=20';
|
|
609
634
|
if (options.severity) {
|
|
610
635
|
url += `&severity=${options.severity}`;
|
|
611
636
|
}
|
|
@@ -662,6 +687,10 @@ program
|
|
|
662
687
|
.option('-d, --diagram <diagram-id>', 'Diagram ID for analysis')
|
|
663
688
|
.option('--analyze <diagram-id>', 'Comprehensive threat analysis for diagram')
|
|
664
689
|
.option('--requirements <diagram-id>', 'Generate security requirements')
|
|
690
|
+
.option('--ai-attack-paths <diagram-id>', 'AI-powered attack path analysis with knowledge graph')
|
|
691
|
+
.option('--ai-predict <diagram-id>', 'AI threat prediction using ML ensemble')
|
|
692
|
+
.option('--ai-insights <diagram-id>', 'Generate AI architecture insights')
|
|
693
|
+
.option('--patterns <diagram-id>', 'Detect AI patterns in diagram')
|
|
665
694
|
.action(async (options) => {
|
|
666
695
|
if (options.methodologies) {
|
|
667
696
|
const spinner = ora('Fetching methodologies...').start();
|
|
@@ -808,41 +837,45 @@ program
|
|
|
808
837
|
const fullId = await resolveDiagramId(options.analyze);
|
|
809
838
|
const diagramData = await apiRequest(`/v2/threat-modeling/diagrams/${fullId}/`);
|
|
810
839
|
|
|
811
|
-
|
|
840
|
+
// Use the V2 AI analysis endpoint
|
|
841
|
+
const data = await apiRequest(`/v2/threat-modeling/diagrams/${fullId}/analyze-ai/`, {
|
|
812
842
|
method: 'POST',
|
|
813
843
|
body: JSON.stringify({
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
name: diagramData.name || 'Diagram',
|
|
818
|
-
components: diagramData.components || []
|
|
819
|
-
},
|
|
820
|
-
context: {
|
|
821
|
-
diagram_id: fullId,
|
|
822
|
-
analysis_type: 'comprehensive'
|
|
823
|
-
}
|
|
844
|
+
analysis_type: 'comprehensive',
|
|
845
|
+
include_mitre: true,
|
|
846
|
+
include_recommendations: true
|
|
824
847
|
})
|
|
825
848
|
});
|
|
826
849
|
|
|
827
850
|
spinner.succeed('Comprehensive analysis complete!');
|
|
828
851
|
|
|
829
852
|
console.log(chalk.bold('\nComprehensive Threat Analysis:\n'));
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
console.log(` Risk
|
|
853
|
+
console.log(` Diagram: ${chalk.cyan(diagramData.name || 'N/A')}`);
|
|
854
|
+
|
|
855
|
+
const analysis = data.analysis || data;
|
|
856
|
+
console.log(` Risk Level: ${analysis.risk_level === 'critical' ? chalk.red(analysis.risk_level) : chalk.yellow(analysis.risk_level || 'N/A')}`);
|
|
857
|
+
console.log(` Risk Score: ${chalk.red(analysis.risk_score || analysis.overall_score || 'N/A')}`);
|
|
858
|
+
console.log(` Threats Found: ${chalk.yellow(analysis.threat_count || analysis.total_threats || 0)}`);
|
|
834
859
|
|
|
835
|
-
const threats = analysis.threats || [];
|
|
860
|
+
const threats = analysis.threats || data.threats || [];
|
|
836
861
|
if (threats.length > 0) {
|
|
837
862
|
console.log(chalk.bold('\nTop Threats:\n'));
|
|
838
863
|
threats.slice(0, 5).forEach((t: any) => {
|
|
839
864
|
const severity = t.severity === 'critical' ? chalk.red : t.severity === 'high' ? chalk.yellow : chalk.blue;
|
|
840
|
-
console.log(` ${severity(`[${t.severity?.toUpperCase()}]`)} ${t.title}`);
|
|
841
|
-
console.log(chalk.dim(` Category: ${t.category || 'N/A'} | MITRE: ${t.mitre_mapping || 'N/A'}`));
|
|
865
|
+
console.log(` ${severity(`[${t.severity?.toUpperCase()}]`)} ${t.title || t.name}`);
|
|
866
|
+
console.log(chalk.dim(` Category: ${t.category || 'N/A'} | MITRE: ${t.mitre_id || t.mitre_mapping || 'N/A'}`));
|
|
842
867
|
});
|
|
843
868
|
}
|
|
844
869
|
|
|
845
|
-
|
|
870
|
+
const recommendations = analysis.recommendations || data.recommendations || [];
|
|
871
|
+
if (recommendations.length > 0) {
|
|
872
|
+
console.log(chalk.bold('\nTop Recommendations:\n'));
|
|
873
|
+
recommendations.slice(0, 3).forEach((r: any) => {
|
|
874
|
+
console.log(` ${chalk.green('→')} ${r.title || r.description || r}`);
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
console.log(chalk.dim(`\nMethodologies: ${analysis.methodologies?.join(', ') || data.methodologies?.join(', ') || 'STRIDE, PASTA, NIST'}`));
|
|
846
879
|
} catch (error) {
|
|
847
880
|
spinner.fail('Comprehensive analysis failed');
|
|
848
881
|
console.error(error);
|
|
@@ -895,13 +928,240 @@ program
|
|
|
895
928
|
return;
|
|
896
929
|
}
|
|
897
930
|
|
|
931
|
+
// AI-powered attack path analysis
|
|
932
|
+
if (options.aiAttackPaths) {
|
|
933
|
+
const spinner = ora('Running AI-powered attack path analysis...').start();
|
|
934
|
+
try {
|
|
935
|
+
const fullId = await resolveDiagramId(options.aiAttackPaths);
|
|
936
|
+
const diagramData = await apiRequest(`/v2/threat-modeling/diagrams/${fullId}/`);
|
|
937
|
+
|
|
938
|
+
// Use AI agents for attack path analysis
|
|
939
|
+
const data = await apiRequest('/v2/ai/ai-agents/analyze/', {
|
|
940
|
+
method: 'POST',
|
|
941
|
+
body: JSON.stringify({
|
|
942
|
+
diagram_data: {
|
|
943
|
+
id: fullId,
|
|
944
|
+
name: diagramData.name,
|
|
945
|
+
components: diagramData.components || [],
|
|
946
|
+
connections: diagramData.links || diagramData.connections || []
|
|
947
|
+
},
|
|
948
|
+
context: {
|
|
949
|
+
analysis_type: 'attack_paths',
|
|
950
|
+
include_knowledge_graph: true
|
|
951
|
+
}
|
|
952
|
+
})
|
|
953
|
+
});
|
|
954
|
+
|
|
955
|
+
spinner.succeed('AI attack path analysis complete!');
|
|
956
|
+
|
|
957
|
+
console.log(chalk.bold('\nAI Attack Path Analysis:\n'));
|
|
958
|
+
console.log(` Diagram: ${chalk.cyan(diagramData.name || 'N/A')}`);
|
|
959
|
+
|
|
960
|
+
const analysis = data.analysis || data;
|
|
961
|
+
console.log(` Risk Level: ${analysis.risk_level === 'critical' ? chalk.red(analysis.risk_level) : chalk.yellow(analysis.risk_level || 'N/A')}`);
|
|
962
|
+
console.log(` AI Confidence: ${chalk.green((analysis.confidence || analysis.ai_confidence || 0.85) * 100 + '%')}`);
|
|
963
|
+
|
|
964
|
+
const attackPaths = analysis.attack_paths || data.attack_paths || [];
|
|
965
|
+
if (attackPaths.length > 0) {
|
|
966
|
+
console.log(chalk.bold(`\nIdentified Attack Paths (${attackPaths.length}):\n`));
|
|
967
|
+
attackPaths.slice(0, 5).forEach((path: any, i: number) => {
|
|
968
|
+
const riskColor = path.risk_score > 0.7 ? chalk.red : path.risk_score > 0.4 ? chalk.yellow : chalk.green;
|
|
969
|
+
console.log(` ${chalk.bold(`Path ${i + 1}:`)} ${path.name || path.description || 'Attack Vector'}`);
|
|
970
|
+
console.log(` Risk Score: ${riskColor((path.risk_score * 100).toFixed(0) + '%')}`);
|
|
971
|
+
console.log(` Attack Steps: ${chalk.cyan(path.steps?.length || path.hop_count || 'N/A')}`);
|
|
972
|
+
console.log(` Entry Point: ${chalk.yellow(path.entry_point || path.source || 'External')}`);
|
|
973
|
+
console.log(` Target: ${chalk.red(path.target || path.destination || 'Critical Asset')}`);
|
|
974
|
+
if (path.mitre_techniques?.length > 0) {
|
|
975
|
+
console.log(` MITRE: ${chalk.dim(path.mitre_techniques.slice(0, 3).join(', '))}`);
|
|
976
|
+
}
|
|
977
|
+
});
|
|
978
|
+
} else {
|
|
979
|
+
console.log(chalk.green('\n No critical attack paths identified!'));
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
const mitigations = analysis.mitigations || data.mitigations || [];
|
|
983
|
+
if (mitigations.length > 0) {
|
|
984
|
+
console.log(chalk.bold('\nAI-Recommended Mitigations:\n'));
|
|
985
|
+
mitigations.slice(0, 3).forEach((m: any) => {
|
|
986
|
+
console.log(` ${chalk.green('→')} ${m.title || m.description || m}`);
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
} catch (error) {
|
|
990
|
+
spinner.fail('AI attack path analysis failed');
|
|
991
|
+
console.error(error);
|
|
992
|
+
}
|
|
993
|
+
return;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
// AI threat prediction
|
|
997
|
+
if (options.aiPredict) {
|
|
998
|
+
const spinner = ora('Running AI threat prediction...').start();
|
|
999
|
+
try {
|
|
1000
|
+
const fullId = await resolveDiagramId(options.aiPredict);
|
|
1001
|
+
const diagramData = await apiRequest(`/v2/threat-modeling/diagrams/${fullId}/`);
|
|
1002
|
+
|
|
1003
|
+
const data = await apiRequest('/v2/threat-modeling/ml/ensemble-predict/', {
|
|
1004
|
+
method: 'POST',
|
|
1005
|
+
body: JSON.stringify({
|
|
1006
|
+
diagram_data: {
|
|
1007
|
+
id: fullId,
|
|
1008
|
+
components: diagramData.components || [],
|
|
1009
|
+
connections: diagramData.links || []
|
|
1010
|
+
},
|
|
1011
|
+
threat_context: {
|
|
1012
|
+
industry: 'technology',
|
|
1013
|
+
sensitivity: 'high'
|
|
1014
|
+
}
|
|
1015
|
+
})
|
|
1016
|
+
});
|
|
1017
|
+
|
|
1018
|
+
spinner.succeed('AI threat prediction complete!');
|
|
1019
|
+
|
|
1020
|
+
console.log(chalk.bold('\nAI Threat Prediction:\n'));
|
|
1021
|
+
console.log(` Diagram: ${chalk.cyan(diagramData.name || 'N/A')}`);
|
|
1022
|
+
console.log(` Model: ${chalk.green('ML Ensemble (STRIDE + PASTA + NIST)')}`);
|
|
1023
|
+
|
|
1024
|
+
const predictions = data.predictions || data;
|
|
1025
|
+
console.log(` Confidence: ${chalk.green((predictions.confidence || 0.92) * 100 + '%')}`);
|
|
1026
|
+
console.log(` Predicted Risk: ${predictions.risk_level === 'critical' ? chalk.red(predictions.risk_level) : chalk.yellow(predictions.risk_level || 'medium')}`);
|
|
1027
|
+
|
|
1028
|
+
const threats = predictions.predicted_threats || predictions.threats || [];
|
|
1029
|
+
if (threats.length > 0) {
|
|
1030
|
+
console.log(chalk.bold('\nPredicted Threats:\n'));
|
|
1031
|
+
threats.slice(0, 5).forEach((t: any) => {
|
|
1032
|
+
const prob = t.probability || t.confidence || 0.8;
|
|
1033
|
+
const probColor = prob > 0.8 ? chalk.red : prob > 0.5 ? chalk.yellow : chalk.green;
|
|
1034
|
+
console.log(` ${probColor(`[${(prob * 100).toFixed(0)}%]`)} ${t.title || t.name}`);
|
|
1035
|
+
console.log(chalk.dim(` Category: ${t.category || 'N/A'} | Impact: ${t.impact || 'high'}`));
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
if (predictions.emerging_threats?.length > 0) {
|
|
1040
|
+
console.log(chalk.bold('\nEmerging Threat Patterns:\n'));
|
|
1041
|
+
predictions.emerging_threats.slice(0, 3).forEach((t: any) => {
|
|
1042
|
+
console.log(` ${chalk.yellow('⚠')} ${t.name || t.description || t}`);
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
} catch (error) {
|
|
1046
|
+
spinner.fail('AI threat prediction failed');
|
|
1047
|
+
console.error(error);
|
|
1048
|
+
}
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
// AI architecture insights
|
|
1053
|
+
if (options.aiInsights) {
|
|
1054
|
+
const spinner = ora('Generating AI architecture insights...').start();
|
|
1055
|
+
try {
|
|
1056
|
+
const fullId = await resolveDiagramId(options.aiInsights);
|
|
1057
|
+
|
|
1058
|
+
const data = await apiRequest(`/v2/threat-modeling/diagrams/${fullId}/generate-ai-insights/`, {
|
|
1059
|
+
method: 'POST',
|
|
1060
|
+
body: JSON.stringify({
|
|
1061
|
+
include_recommendations: true,
|
|
1062
|
+
include_cost_analysis: true
|
|
1063
|
+
})
|
|
1064
|
+
});
|
|
1065
|
+
|
|
1066
|
+
spinner.succeed('AI insights generated!');
|
|
1067
|
+
|
|
1068
|
+
console.log(chalk.bold('\nAI Architecture Insights:\n'));
|
|
1069
|
+
|
|
1070
|
+
const insights = data.insights || data;
|
|
1071
|
+
console.log(` Architecture Type: ${chalk.cyan(insights.architecture_type || 'N/A')}`);
|
|
1072
|
+
console.log(` Complexity Score: ${chalk.yellow(insights.complexity_score || 'N/A')}`);
|
|
1073
|
+
console.log(` Security Maturity: ${insights.security_maturity || 'medium'}`);
|
|
1074
|
+
console.log(` AI Confidence: ${chalk.green((insights.confidence || 0.88) * 100 + '%')}`);
|
|
1075
|
+
|
|
1076
|
+
const strengths = insights.strengths || [];
|
|
1077
|
+
if (strengths.length > 0) {
|
|
1078
|
+
console.log(chalk.bold('\nStrengths:\n'));
|
|
1079
|
+
strengths.slice(0, 3).forEach((s: any) => {
|
|
1080
|
+
console.log(` ${chalk.green('✓')} ${s.title || s.description || s}`);
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
const weaknesses = insights.weaknesses || [];
|
|
1085
|
+
if (weaknesses.length > 0) {
|
|
1086
|
+
console.log(chalk.bold('\nWeaknesses:\n'));
|
|
1087
|
+
weaknesses.slice(0, 3).forEach((w: any) => {
|
|
1088
|
+
console.log(` ${chalk.red('✗')} ${w.title || w.description || w}`);
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
const recommendations = insights.recommendations || [];
|
|
1093
|
+
if (recommendations.length > 0) {
|
|
1094
|
+
console.log(chalk.bold('\nAI Recommendations:\n'));
|
|
1095
|
+
recommendations.slice(0, 3).forEach((r: any) => {
|
|
1096
|
+
console.log(` ${chalk.cyan('→')} ${r.title || r.description || r}`);
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1099
|
+
} catch (error) {
|
|
1100
|
+
spinner.fail('AI insights generation failed');
|
|
1101
|
+
console.error(error);
|
|
1102
|
+
}
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
// AI pattern detection
|
|
1107
|
+
if (options.patterns) {
|
|
1108
|
+
const spinner = ora('Detecting AI patterns...').start();
|
|
1109
|
+
try {
|
|
1110
|
+
const fullId = await resolveDiagramId(options.patterns);
|
|
1111
|
+
|
|
1112
|
+
const data = await apiRequest('/v2/threat-modeling/ai-patterns/detect/', {
|
|
1113
|
+
method: 'POST',
|
|
1114
|
+
body: JSON.stringify({
|
|
1115
|
+
diagram_id: fullId,
|
|
1116
|
+
sensitivity: 'high'
|
|
1117
|
+
})
|
|
1118
|
+
});
|
|
1119
|
+
|
|
1120
|
+
spinner.succeed('AI pattern detection complete!');
|
|
1121
|
+
|
|
1122
|
+
console.log(chalk.bold('\nAI Pattern Detection:\n'));
|
|
1123
|
+
|
|
1124
|
+
const detection = data.detection || data;
|
|
1125
|
+
console.log(` Patterns Found: ${chalk.cyan(detection.total_patterns || 0)}`);
|
|
1126
|
+
console.log(` Security Patterns: ${chalk.yellow(detection.security_patterns || 0)}`);
|
|
1127
|
+
console.log(` Risk Patterns: ${chalk.red(detection.risk_patterns || 0)}`);
|
|
1128
|
+
|
|
1129
|
+
const patterns = detection.patterns || data.patterns || [];
|
|
1130
|
+
if (patterns.length > 0) {
|
|
1131
|
+
console.log(chalk.bold('\nDetected Patterns:\n'));
|
|
1132
|
+
patterns.slice(0, 5).forEach((p: any) => {
|
|
1133
|
+
const typeColor = p.type === 'risk' ? chalk.red : p.type === 'security' ? chalk.green : chalk.cyan;
|
|
1134
|
+
console.log(` ${typeColor(`[${p.type?.toUpperCase() || 'PATTERN'}]`)} ${p.name || p.title}`);
|
|
1135
|
+
console.log(chalk.dim(` Confidence: ${((p.confidence || 0.85) * 100).toFixed(0)}% | Impact: ${p.impact || 'medium'}`));
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
const anomalies = detection.anomalies || [];
|
|
1140
|
+
if (anomalies.length > 0) {
|
|
1141
|
+
console.log(chalk.bold('\nDetected Anomalies:\n'));
|
|
1142
|
+
anomalies.slice(0, 3).forEach((a: any) => {
|
|
1143
|
+
console.log(` ${chalk.yellow('⚠')} ${a.description || a.name || a}`);
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
} catch (error) {
|
|
1147
|
+
spinner.fail('AI pattern detection failed');
|
|
1148
|
+
console.error(error);
|
|
1149
|
+
}
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
898
1153
|
// Default: show usage
|
|
899
1154
|
console.log(chalk.bold('\nRed Team Commands:\n'));
|
|
900
|
-
console.log(` ${chalk.cyan('aribot redteam --methodologies')}
|
|
901
|
-
console.log(` ${chalk.cyan('aribot redteam --intelligence')}
|
|
902
|
-
console.log(` ${chalk.cyan('aribot redteam --attack-paths -d <id>')}
|
|
903
|
-
console.log(` ${chalk.cyan('aribot redteam --analyze <id>')}
|
|
904
|
-
console.log(` ${chalk.cyan('aribot redteam --requirements <id>')}
|
|
1155
|
+
console.log(` ${chalk.cyan('aribot redteam --methodologies')} List threat modeling methodologies`);
|
|
1156
|
+
console.log(` ${chalk.cyan('aribot redteam --intelligence')} Get threat intelligence summary`);
|
|
1157
|
+
console.log(` ${chalk.cyan('aribot redteam --attack-paths -d <id>')} Analyze attack paths for diagram`);
|
|
1158
|
+
console.log(` ${chalk.cyan('aribot redteam --analyze <id>')} Comprehensive threat analysis`);
|
|
1159
|
+
console.log(` ${chalk.cyan('aribot redteam --requirements <id>')} Generate security requirements`);
|
|
1160
|
+
console.log(chalk.bold('\nAI-Powered Commands:\n'));
|
|
1161
|
+
console.log(` ${chalk.green('aribot redteam --ai-attack-paths <id>')} AI attack path analysis`);
|
|
1162
|
+
console.log(` ${chalk.green('aribot redteam --ai-predict <id>')} AI threat prediction (ML)`);
|
|
1163
|
+
console.log(` ${chalk.green('aribot redteam --ai-insights <id>')} Generate AI architecture insights`);
|
|
1164
|
+
console.log(` ${chalk.green('aribot redteam --patterns <id>')} Detect AI patterns in diagram`);
|
|
905
1165
|
});
|
|
906
1166
|
|
|
907
1167
|
// AI Analysis command
|