runbooks 1.1.3__py3-none-any.whl → 1.1.5__py3-none-any.whl

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.
Files changed (247) hide show
  1. runbooks/__init__.py +31 -2
  2. runbooks/__init___optimized.py +18 -4
  3. runbooks/_platform/__init__.py +1 -5
  4. runbooks/_platform/core/runbooks_wrapper.py +141 -138
  5. runbooks/aws2/accuracy_validator.py +812 -0
  6. runbooks/base.py +7 -0
  7. runbooks/cfat/WEIGHT_CONFIG_README.md +1 -1
  8. runbooks/cfat/assessment/compliance.py +8 -8
  9. runbooks/cfat/assessment/runner.py +1 -0
  10. runbooks/cfat/cloud_foundations_assessment.py +227 -239
  11. runbooks/cfat/models.py +6 -2
  12. runbooks/cfat/tests/__init__.py +6 -1
  13. runbooks/cli/__init__.py +13 -0
  14. runbooks/cli/commands/cfat.py +274 -0
  15. runbooks/cli/commands/finops.py +1164 -0
  16. runbooks/cli/commands/inventory.py +379 -0
  17. runbooks/cli/commands/operate.py +239 -0
  18. runbooks/cli/commands/security.py +248 -0
  19. runbooks/cli/commands/validation.py +825 -0
  20. runbooks/cli/commands/vpc.py +310 -0
  21. runbooks/cli/registry.py +107 -0
  22. runbooks/cloudops/__init__.py +23 -30
  23. runbooks/cloudops/base.py +96 -107
  24. runbooks/cloudops/cost_optimizer.py +549 -547
  25. runbooks/cloudops/infrastructure_optimizer.py +5 -4
  26. runbooks/cloudops/interfaces.py +226 -227
  27. runbooks/cloudops/lifecycle_manager.py +5 -4
  28. runbooks/cloudops/mcp_cost_validation.py +252 -235
  29. runbooks/cloudops/models.py +78 -53
  30. runbooks/cloudops/monitoring_automation.py +5 -4
  31. runbooks/cloudops/notebook_framework.py +179 -215
  32. runbooks/cloudops/security_enforcer.py +125 -159
  33. runbooks/common/accuracy_validator.py +11 -0
  34. runbooks/common/aws_pricing.py +349 -326
  35. runbooks/common/aws_pricing_api.py +211 -212
  36. runbooks/common/aws_profile_manager.py +341 -0
  37. runbooks/common/aws_utils.py +75 -80
  38. runbooks/common/business_logic.py +127 -105
  39. runbooks/common/cli_decorators.py +36 -60
  40. runbooks/common/comprehensive_cost_explorer_integration.py +456 -464
  41. runbooks/common/cross_account_manager.py +198 -205
  42. runbooks/common/date_utils.py +27 -39
  43. runbooks/common/decorators.py +235 -0
  44. runbooks/common/dry_run_examples.py +173 -208
  45. runbooks/common/dry_run_framework.py +157 -155
  46. runbooks/common/enhanced_exception_handler.py +15 -4
  47. runbooks/common/enhanced_logging_example.py +50 -64
  48. runbooks/common/enhanced_logging_integration_example.py +65 -37
  49. runbooks/common/env_utils.py +16 -16
  50. runbooks/common/error_handling.py +40 -38
  51. runbooks/common/lazy_loader.py +41 -23
  52. runbooks/common/logging_integration_helper.py +79 -86
  53. runbooks/common/mcp_cost_explorer_integration.py +478 -495
  54. runbooks/common/mcp_integration.py +63 -74
  55. runbooks/common/memory_optimization.py +140 -118
  56. runbooks/common/module_cli_base.py +37 -58
  57. runbooks/common/organizations_client.py +176 -194
  58. runbooks/common/patterns.py +204 -0
  59. runbooks/common/performance_monitoring.py +67 -71
  60. runbooks/common/performance_optimization_engine.py +283 -274
  61. runbooks/common/profile_utils.py +248 -39
  62. runbooks/common/rich_utils.py +643 -92
  63. runbooks/common/sre_performance_suite.py +177 -186
  64. runbooks/enterprise/__init__.py +1 -1
  65. runbooks/enterprise/logging.py +144 -106
  66. runbooks/enterprise/security.py +187 -204
  67. runbooks/enterprise/validation.py +43 -56
  68. runbooks/finops/__init__.py +29 -33
  69. runbooks/finops/account_resolver.py +1 -1
  70. runbooks/finops/advanced_optimization_engine.py +980 -0
  71. runbooks/finops/automation_core.py +268 -231
  72. runbooks/finops/business_case_config.py +184 -179
  73. runbooks/finops/cli.py +660 -139
  74. runbooks/finops/commvault_ec2_analysis.py +157 -164
  75. runbooks/finops/compute_cost_optimizer.py +336 -320
  76. runbooks/finops/config.py +20 -20
  77. runbooks/finops/cost_optimizer.py +488 -622
  78. runbooks/finops/cost_processor.py +332 -214
  79. runbooks/finops/dashboard_runner.py +1006 -172
  80. runbooks/finops/ebs_cost_optimizer.py +991 -657
  81. runbooks/finops/elastic_ip_optimizer.py +317 -257
  82. runbooks/finops/enhanced_mcp_integration.py +340 -0
  83. runbooks/finops/enhanced_progress.py +40 -37
  84. runbooks/finops/enhanced_trend_visualization.py +3 -2
  85. runbooks/finops/enterprise_wrappers.py +230 -292
  86. runbooks/finops/executive_export.py +203 -160
  87. runbooks/finops/helpers.py +130 -288
  88. runbooks/finops/iam_guidance.py +1 -1
  89. runbooks/finops/infrastructure/__init__.py +80 -0
  90. runbooks/finops/infrastructure/commands.py +506 -0
  91. runbooks/finops/infrastructure/load_balancer_optimizer.py +866 -0
  92. runbooks/finops/infrastructure/vpc_endpoint_optimizer.py +832 -0
  93. runbooks/finops/markdown_exporter.py +338 -175
  94. runbooks/finops/mcp_validator.py +1952 -0
  95. runbooks/finops/nat_gateway_optimizer.py +1513 -482
  96. runbooks/finops/network_cost_optimizer.py +657 -587
  97. runbooks/finops/notebook_utils.py +226 -188
  98. runbooks/finops/optimization_engine.py +1136 -0
  99. runbooks/finops/optimizer.py +25 -29
  100. runbooks/finops/rds_snapshot_optimizer.py +367 -411
  101. runbooks/finops/reservation_optimizer.py +427 -363
  102. runbooks/finops/scenario_cli_integration.py +77 -78
  103. runbooks/finops/scenarios.py +1278 -439
  104. runbooks/finops/schemas.py +218 -182
  105. runbooks/finops/snapshot_manager.py +2289 -0
  106. runbooks/finops/tests/test_finops_dashboard.py +3 -3
  107. runbooks/finops/tests/test_reference_images_validation.py +2 -2
  108. runbooks/finops/tests/test_single_account_features.py +17 -17
  109. runbooks/finops/tests/validate_test_suite.py +1 -1
  110. runbooks/finops/types.py +3 -3
  111. runbooks/finops/validation_framework.py +263 -269
  112. runbooks/finops/vpc_cleanup_exporter.py +191 -146
  113. runbooks/finops/vpc_cleanup_optimizer.py +593 -575
  114. runbooks/finops/workspaces_analyzer.py +171 -182
  115. runbooks/hitl/enhanced_workflow_engine.py +1 -1
  116. runbooks/integration/__init__.py +89 -0
  117. runbooks/integration/mcp_integration.py +1920 -0
  118. runbooks/inventory/CLAUDE.md +816 -0
  119. runbooks/inventory/README.md +3 -3
  120. runbooks/inventory/Tests/common_test_data.py +30 -30
  121. runbooks/inventory/__init__.py +2 -2
  122. runbooks/inventory/cloud_foundations_integration.py +144 -149
  123. runbooks/inventory/collectors/aws_comprehensive.py +28 -11
  124. runbooks/inventory/collectors/aws_networking.py +111 -101
  125. runbooks/inventory/collectors/base.py +4 -0
  126. runbooks/inventory/core/collector.py +495 -313
  127. runbooks/inventory/discovery.md +2 -2
  128. runbooks/inventory/drift_detection_cli.py +69 -96
  129. runbooks/inventory/find_ec2_security_groups.py +1 -1
  130. runbooks/inventory/inventory_mcp_cli.py +48 -46
  131. runbooks/inventory/list_rds_snapshots_aggregator.py +192 -208
  132. runbooks/inventory/mcp_inventory_validator.py +549 -465
  133. runbooks/inventory/mcp_vpc_validator.py +359 -442
  134. runbooks/inventory/organizations_discovery.py +56 -52
  135. runbooks/inventory/rich_inventory_display.py +33 -32
  136. runbooks/inventory/unified_validation_engine.py +278 -251
  137. runbooks/inventory/vpc_analyzer.py +733 -696
  138. runbooks/inventory/vpc_architecture_validator.py +293 -348
  139. runbooks/inventory/vpc_dependency_analyzer.py +382 -378
  140. runbooks/inventory/vpc_flow_analyzer.py +3 -3
  141. runbooks/main.py +152 -9147
  142. runbooks/main_final.py +91 -60
  143. runbooks/main_minimal.py +22 -10
  144. runbooks/main_optimized.py +131 -100
  145. runbooks/main_ultra_minimal.py +7 -2
  146. runbooks/mcp/__init__.py +36 -0
  147. runbooks/mcp/integration.py +679 -0
  148. runbooks/metrics/dora_metrics_engine.py +2 -2
  149. runbooks/monitoring/performance_monitor.py +9 -4
  150. runbooks/operate/dynamodb_operations.py +3 -1
  151. runbooks/operate/ec2_operations.py +145 -137
  152. runbooks/operate/iam_operations.py +146 -152
  153. runbooks/operate/mcp_integration.py +1 -1
  154. runbooks/operate/networking_cost_heatmap.py +33 -10
  155. runbooks/operate/privatelink_operations.py +1 -1
  156. runbooks/operate/rds_operations.py +223 -254
  157. runbooks/operate/s3_operations.py +107 -118
  158. runbooks/operate/vpc_endpoints.py +1 -1
  159. runbooks/operate/vpc_operations.py +648 -618
  160. runbooks/remediation/base.py +1 -1
  161. runbooks/remediation/commons.py +10 -7
  162. runbooks/remediation/commvault_ec2_analysis.py +71 -67
  163. runbooks/remediation/ec2_unattached_ebs_volumes.py +1 -0
  164. runbooks/remediation/multi_account.py +24 -21
  165. runbooks/remediation/rds_snapshot_list.py +91 -65
  166. runbooks/remediation/remediation_cli.py +92 -146
  167. runbooks/remediation/universal_account_discovery.py +83 -79
  168. runbooks/remediation/workspaces_list.py +49 -44
  169. runbooks/security/__init__.py +19 -0
  170. runbooks/security/assessment_runner.py +1150 -0
  171. runbooks/security/baseline_checker.py +812 -0
  172. runbooks/security/cloudops_automation_security_validator.py +509 -535
  173. runbooks/security/compliance_automation_engine.py +17 -17
  174. runbooks/security/config/__init__.py +2 -2
  175. runbooks/security/config/compliance_config.py +50 -50
  176. runbooks/security/config_template_generator.py +63 -76
  177. runbooks/security/enterprise_security_framework.py +1 -1
  178. runbooks/security/executive_security_dashboard.py +519 -508
  179. runbooks/security/integration_test_enterprise_security.py +5 -3
  180. runbooks/security/multi_account_security_controls.py +959 -1210
  181. runbooks/security/real_time_security_monitor.py +422 -444
  182. runbooks/security/run_script.py +1 -1
  183. runbooks/security/security_baseline_tester.py +1 -1
  184. runbooks/security/security_cli.py +143 -112
  185. runbooks/security/test_2way_validation.py +439 -0
  186. runbooks/security/two_way_validation_framework.py +852 -0
  187. runbooks/sre/mcp_reliability_engine.py +6 -6
  188. runbooks/sre/production_monitoring_framework.py +167 -177
  189. runbooks/tdd/__init__.py +15 -0
  190. runbooks/tdd/cli.py +1071 -0
  191. runbooks/utils/__init__.py +14 -17
  192. runbooks/utils/logger.py +7 -2
  193. runbooks/utils/version_validator.py +51 -48
  194. runbooks/validation/__init__.py +6 -6
  195. runbooks/validation/cli.py +9 -3
  196. runbooks/validation/comprehensive_2way_validator.py +754 -708
  197. runbooks/validation/mcp_validator.py +906 -228
  198. runbooks/validation/terraform_citations_validator.py +104 -115
  199. runbooks/validation/terraform_drift_detector.py +447 -451
  200. runbooks/vpc/README.md +617 -0
  201. runbooks/vpc/__init__.py +8 -1
  202. runbooks/vpc/analyzer.py +577 -0
  203. runbooks/vpc/cleanup_wrapper.py +476 -413
  204. runbooks/vpc/cli_cloudtrail_commands.py +339 -0
  205. runbooks/vpc/cli_mcp_validation_commands.py +480 -0
  206. runbooks/vpc/cloudtrail_audit_integration.py +717 -0
  207. runbooks/vpc/config.py +92 -97
  208. runbooks/vpc/cost_engine.py +411 -148
  209. runbooks/vpc/cost_explorer_integration.py +553 -0
  210. runbooks/vpc/cross_account_session.py +101 -106
  211. runbooks/vpc/enhanced_mcp_validation.py +917 -0
  212. runbooks/vpc/eni_gate_validator.py +961 -0
  213. runbooks/vpc/heatmap_engine.py +190 -162
  214. runbooks/vpc/mcp_no_eni_validator.py +681 -640
  215. runbooks/vpc/nat_gateway_optimizer.py +358 -0
  216. runbooks/vpc/networking_wrapper.py +15 -8
  217. runbooks/vpc/pdca_remediation_planner.py +528 -0
  218. runbooks/vpc/performance_optimized_analyzer.py +219 -231
  219. runbooks/vpc/runbooks_adapter.py +1167 -241
  220. runbooks/vpc/tdd_red_phase_stubs.py +601 -0
  221. runbooks/vpc/test_data_loader.py +358 -0
  222. runbooks/vpc/tests/conftest.py +314 -4
  223. runbooks/vpc/tests/test_cleanup_framework.py +1022 -0
  224. runbooks/vpc/tests/test_cost_engine.py +0 -2
  225. runbooks/vpc/topology_generator.py +326 -0
  226. runbooks/vpc/unified_scenarios.py +1302 -1129
  227. runbooks/vpc/vpc_cleanup_integration.py +1943 -1115
  228. runbooks-1.1.5.dist-info/METADATA +328 -0
  229. {runbooks-1.1.3.dist-info → runbooks-1.1.5.dist-info}/RECORD +233 -200
  230. runbooks/finops/README.md +0 -414
  231. runbooks/finops/accuracy_cross_validator.py +0 -647
  232. runbooks/finops/business_cases.py +0 -950
  233. runbooks/finops/dashboard_router.py +0 -922
  234. runbooks/finops/ebs_optimizer.py +0 -956
  235. runbooks/finops/embedded_mcp_validator.py +0 -1629
  236. runbooks/finops/enhanced_dashboard_runner.py +0 -527
  237. runbooks/finops/finops_dashboard.py +0 -584
  238. runbooks/finops/finops_scenarios.py +0 -1218
  239. runbooks/finops/legacy_migration.py +0 -730
  240. runbooks/finops/multi_dashboard.py +0 -1519
  241. runbooks/finops/single_dashboard.py +0 -1113
  242. runbooks/finops/unlimited_scenarios.py +0 -393
  243. runbooks-1.1.3.dist-info/METADATA +0 -799
  244. {runbooks-1.1.3.dist-info → runbooks-1.1.5.dist-info}/WHEEL +0 -0
  245. {runbooks-1.1.3.dist-info → runbooks-1.1.5.dist-info}/entry_points.txt +0 -0
  246. {runbooks-1.1.3.dist-info → runbooks-1.1.5.dist-info}/licenses/LICENSE +0 -0
  247. {runbooks-1.1.3.dist-info → runbooks-1.1.5.dist-info}/top_level.txt +0 -0
@@ -52,38 +52,38 @@ from runbooks.common.rich_utils import (
52
52
 
53
53
  class SecurityMaturityLevel(Enum):
54
54
  """Security maturity levels for executive reporting."""
55
-
56
- INITIAL = "INITIAL" # Ad-hoc security measures
57
- MANAGED = "MANAGED" # Basic security controls implemented
58
- DEFINED = "DEFINED" # Documented security processes
55
+
56
+ INITIAL = "INITIAL" # Ad-hoc security measures
57
+ MANAGED = "MANAGED" # Basic security controls implemented
58
+ DEFINED = "DEFINED" # Documented security processes
59
59
  QUANTITATIVELY_MANAGED = "QUANTITATIVELY_MANAGED" # Metrics-driven security
60
- OPTIMIZING = "OPTIMIZING" # Continuous improvement culture
60
+ OPTIMIZING = "OPTIMIZING" # Continuous improvement culture
61
61
 
62
62
 
63
63
  class RiskAppetite(Enum):
64
64
  """Business risk appetite levels."""
65
-
66
- VERY_LOW = "VERY_LOW" # Risk-averse, maximum security
67
- LOW = "LOW" # Conservative approach
68
- MODERATE = "MODERATE" # Balanced risk/reward
69
- HIGH = "HIGH" # Aggressive growth, calculated risks
70
- VERY_HIGH = "VERY_HIGH" # Maximum risk tolerance
65
+
66
+ VERY_LOW = "VERY_LOW" # Risk-averse, maximum security
67
+ LOW = "LOW" # Conservative approach
68
+ MODERATE = "MODERATE" # Balanced risk/reward
69
+ HIGH = "HIGH" # Aggressive growth, calculated risks
70
+ VERY_HIGH = "VERY_HIGH" # Maximum risk tolerance
71
71
 
72
72
 
73
73
  class BusinessImpactCategory(Enum):
74
74
  """Categories of business impact from security events."""
75
-
76
- FINANCIAL = "FINANCIAL" # Direct monetary impact
77
- OPERATIONAL = "OPERATIONAL" # Business operations disruption
78
- REPUTATIONAL = "REPUTATIONAL" # Brand and customer trust impact
79
- REGULATORY = "REGULATORY" # Compliance and legal consequences
80
- STRATEGIC = "STRATEGIC" # Long-term strategic implications
75
+
76
+ FINANCIAL = "FINANCIAL" # Direct monetary impact
77
+ OPERATIONAL = "OPERATIONAL" # Business operations disruption
78
+ REPUTATIONAL = "REPUTATIONAL" # Brand and customer trust impact
79
+ REGULATORY = "REGULATORY" # Compliance and legal consequences
80
+ STRATEGIC = "STRATEGIC" # Long-term strategic implications
81
81
 
82
82
 
83
83
  @dataclass
84
84
  class ExecutiveSecurityMetric:
85
85
  """Executive-level security metric with business context."""
86
-
86
+
87
87
  metric_name: str
88
88
  current_value: float
89
89
  target_value: float
@@ -99,7 +99,7 @@ class ExecutiveSecurityMetric:
99
99
  @dataclass
100
100
  class ComplianceFrameworkStatus:
101
101
  """Status of compliance with specific framework."""
102
-
102
+
103
103
  framework_name: str
104
104
  compliance_percentage: float
105
105
  target_percentage: float
@@ -117,7 +117,7 @@ class ComplianceFrameworkStatus:
117
117
  @dataclass
118
118
  class SecurityInvestmentROI:
119
119
  """Return on investment analysis for security initiatives."""
120
-
120
+
121
121
  investment_name: str
122
122
  total_investment: float
123
123
  annual_operational_cost: float
@@ -135,7 +135,7 @@ class SecurityInvestmentROI:
135
135
  @dataclass
136
136
  class SecurityIncidentExecutiveSummary:
137
137
  """Executive summary of security incidents and response."""
138
-
138
+
139
139
  reporting_period: str
140
140
  total_incidents: int
141
141
  critical_incidents: int
@@ -152,34 +152,34 @@ class SecurityIncidentExecutiveSummary:
152
152
  @dataclass
153
153
  class ExecutiveSecurityReport:
154
154
  """Comprehensive executive security report."""
155
-
155
+
156
156
  report_id: str
157
157
  reporting_period: str
158
158
  generation_timestamp: datetime
159
-
159
+
160
160
  # Executive Summary
161
161
  overall_security_posture_score: float # 0-100
162
162
  security_maturity_level: SecurityMaturityLevel
163
163
  risk_appetite_alignment: float # How well current posture aligns with risk appetite
164
-
164
+
165
165
  # Key Metrics
166
166
  key_security_metrics: List[ExecutiveSecurityMetric]
167
167
  compliance_status: List[ComplianceFrameworkStatus]
168
168
  security_investments: List[SecurityInvestmentROI]
169
169
  incident_summary: SecurityIncidentExecutiveSummary
170
-
170
+
171
171
  # Business Impact
172
172
  total_security_investment: float
173
173
  annual_security_roi: float
174
174
  risk_reduction_achieved: float
175
175
  cost_avoidance_realized: float
176
-
176
+
177
177
  # Strategic Insights
178
178
  top_security_priorities: List[str]
179
179
  emerging_threats: List[str]
180
180
  industry_benchmark_comparison: Dict[str, float]
181
181
  board_recommendations: List[str]
182
-
182
+
183
183
  # Operational Excellence
184
184
  automation_percentage: float
185
185
  team_efficiency_metrics: Dict[str, float]
@@ -190,10 +190,10 @@ class ExecutiveSecurityDashboard:
190
190
  """
191
191
  Executive Security Dashboard - C-Suite Security Intelligence
192
192
  ===========================================================
193
-
193
+
194
194
  Provides business-focused security metrics, compliance reporting, and strategic
195
195
  security insights designed specifically for executive and board-level visibility.
196
-
196
+
197
197
  Executive Features:
198
198
  - Business risk quantification with financial impact analysis
199
199
  - Multi-framework compliance status with audit readiness scores
@@ -204,29 +204,29 @@ class ExecutiveSecurityDashboard:
204
204
  """
205
205
 
206
206
  def __init__(
207
- self,
208
- profile: str = "default",
207
+ self,
208
+ profile: str = "default",
209
209
  output_dir: str = "./artifacts/executive-security",
210
- risk_appetite: RiskAppetite = RiskAppetite.MODERATE
210
+ risk_appetite: RiskAppetite = RiskAppetite.MODERATE,
211
211
  ):
212
212
  self.profile = profile
213
213
  self.output_dir = Path(output_dir)
214
214
  self.output_dir.mkdir(parents=True, exist_ok=True)
215
215
  self.risk_appetite = risk_appetite
216
-
216
+
217
217
  # Initialize management session for organization-level visibility
218
218
  self.session = self._create_secure_session()
219
-
219
+
220
220
  # Executive metrics collection
221
221
  self.metrics_collector = ExecutiveMetricsCollector(self.session)
222
222
  self.compliance_analyzer = ComplianceStatusAnalyzer(self.session)
223
223
  self.roi_calculator = SecurityROICalculator()
224
224
  self.benchmark_analyzer = IndustryBenchmarkAnalyzer()
225
-
225
+
226
226
  # Report generation components
227
227
  self.report_generator = ExecutiveReportGenerator(self.output_dir)
228
228
  self.visualization_engine = SecurityVisualizationEngine()
229
-
229
+
230
230
  print_header("Executive Security Dashboard", "1.0.0")
231
231
  print_info(f"Profile: {profile}")
232
232
  print_info(f"Risk appetite: {risk_appetite.value}")
@@ -235,47 +235,44 @@ class ExecutiveSecurityDashboard:
235
235
  def _create_secure_session(self) -> boto3.Session:
236
236
  """Create secure management session for executive reporting."""
237
237
  try:
238
- session = create_management_session(profile=self.profile)
239
-
238
+ session = create_management_session(profile_name=self.profile)
239
+
240
240
  # Validate organization access for executive reporting
241
241
  try:
242
- organizations = session.client('organizations')
242
+ organizations = session.client("organizations")
243
243
  org_info = organizations.describe_organization()
244
244
  print_success(f"Executive reporting scope: Organization {org_info['Organization']['Id']}")
245
245
  except ClientError as e:
246
246
  print_warning(f"Limited organization access: {str(e)}")
247
-
247
+
248
248
  sts_client = session.client("sts")
249
249
  identity = sts_client.get_caller_identity()
250
-
250
+
251
251
  print_info(f"Executive session established for: {identity.get('Arn', 'Unknown')}")
252
252
  return session
253
-
253
+
254
254
  except Exception as e:
255
255
  print_error(f"Failed to establish executive session: {str(e)}")
256
256
  raise
257
257
 
258
258
  async def generate_executive_security_report(
259
- self,
260
- reporting_period: str = "monthly",
261
- include_benchmarks: bool = True,
262
- board_presentation: bool = False
259
+ self, reporting_period: str = "monthly", include_benchmarks: bool = True, board_presentation: bool = False
263
260
  ) -> ExecutiveSecurityReport:
264
261
  """
265
262
  Generate comprehensive executive security report for C-suite consumption.
266
-
263
+
267
264
  Args:
268
265
  reporting_period: Reporting period (monthly, quarterly, annual)
269
266
  include_benchmarks: Include industry benchmark analysis
270
267
  board_presentation: Generate board-ready presentation materials
271
-
268
+
272
269
  Returns:
273
270
  ExecutiveSecurityReport with comprehensive business-focused metrics
274
271
  """
275
-
272
+
276
273
  report_id = f"executive-security-{reporting_period}-{int(time.time())}"
277
274
  start_time = datetime.utcnow()
278
-
275
+
279
276
  console.print(
280
277
  create_panel(
281
278
  f"[bold cyan]Executive Security Report Generation[/bold cyan]\n\n"
@@ -287,48 +284,42 @@ class ExecutiveSecurityDashboard:
287
284
  border_style="cyan",
288
285
  )
289
286
  )
290
-
287
+
291
288
  # Collect executive-level security metrics
292
289
  print_info("Collecting executive security metrics...")
293
290
  key_security_metrics = await self._collect_key_security_metrics()
294
-
291
+
295
292
  # Analyze compliance status across frameworks
296
293
  print_info("Analyzing compliance framework status...")
297
294
  compliance_status = await self._analyze_compliance_status()
298
-
295
+
299
296
  # Calculate security investment ROI
300
297
  print_info("Calculating security investment ROI...")
301
298
  security_investments = await self._analyze_security_investments()
302
-
299
+
303
300
  # Generate incident executive summary
304
301
  print_info("Analyzing security incidents...")
305
302
  incident_summary = await self._generate_incident_summary(reporting_period)
306
-
303
+
307
304
  # Calculate overall security posture
308
305
  overall_posture_score = self._calculate_overall_security_posture(
309
306
  key_security_metrics, compliance_status, incident_summary
310
307
  )
311
-
308
+
312
309
  # Determine security maturity level
313
- maturity_level = self._assess_security_maturity(
314
- key_security_metrics, compliance_status, security_investments
315
- )
316
-
310
+ maturity_level = self._assess_security_maturity(key_security_metrics, compliance_status, security_investments)
311
+
317
312
  # Analyze risk appetite alignment
318
- risk_alignment = self._analyze_risk_appetite_alignment(
319
- overall_posture_score, incident_summary
320
- )
321
-
313
+ risk_alignment = self._analyze_risk_appetite_alignment(overall_posture_score, incident_summary)
314
+
322
315
  # Calculate business impact metrics
323
- business_metrics = self._calculate_business_impact_metrics(
324
- security_investments, incident_summary
325
- )
326
-
316
+ business_metrics = self._calculate_business_impact_metrics(security_investments, incident_summary)
317
+
327
318
  # Generate strategic insights
328
319
  strategic_insights = await self._generate_strategic_insights(
329
320
  key_security_metrics, compliance_status, include_benchmarks
330
321
  )
331
-
322
+
332
323
  # Create comprehensive executive report
333
324
  executive_report = ExecutiveSecurityReport(
334
325
  report_id=report_id,
@@ -342,273 +333,299 @@ class ExecutiveSecurityDashboard:
342
333
  security_investments=security_investments,
343
334
  incident_summary=incident_summary,
344
335
  **business_metrics,
345
- **strategic_insights
336
+ **strategic_insights,
346
337
  )
347
-
338
+
348
339
  # Generate visualizations and presentations
349
340
  if board_presentation:
350
341
  await self._generate_board_presentation(executive_report)
351
-
342
+
352
343
  # Export comprehensive report
353
344
  await self._export_executive_report(executive_report)
354
-
345
+
355
346
  # Display executive summary
356
347
  self._display_executive_summary(executive_report)
357
-
348
+
358
349
  return executive_report
359
350
 
360
351
  async def _collect_key_security_metrics(self) -> List[ExecutiveSecurityMetric]:
361
352
  """Collect key security metrics for executive reporting."""
362
-
353
+
363
354
  metrics = []
364
-
355
+
365
356
  # Security Posture Score
366
357
  current_posture = await self.metrics_collector.get_security_posture_score()
367
- metrics.append(ExecutiveSecurityMetric(
368
- metric_name="Overall Security Posture",
369
- current_value=current_posture,
370
- target_value=90.0,
371
- trend="improving" if current_posture > 85 else "stable",
372
- business_impact="Directly correlates to cyber insurance rates and regulatory compliance",
373
- last_updated=datetime.utcnow(),
374
- benchmark_comparison={"Industry Average": 78.0, "Best in Class": 95.0},
375
- executive_summary=f"Current security posture at {current_posture:.1f}%, targeting 90%+ for optimal risk management"
376
- ))
377
-
358
+ metrics.append(
359
+ ExecutiveSecurityMetric(
360
+ metric_name="Overall Security Posture",
361
+ current_value=current_posture,
362
+ target_value=90.0,
363
+ trend="improving" if current_posture > 85 else "stable",
364
+ business_impact="Directly correlates to cyber insurance rates and regulatory compliance",
365
+ last_updated=datetime.utcnow(),
366
+ benchmark_comparison={"Industry Average": 78.0, "Best in Class": 95.0},
367
+ executive_summary=f"Current security posture at {current_posture:.1f}%, targeting 90%+ for optimal risk management",
368
+ )
369
+ )
370
+
378
371
  # Mean Time to Detection (MTTD)
379
372
  mttd_hours = await self.metrics_collector.get_mean_time_to_detection()
380
- metrics.append(ExecutiveSecurityMetric(
381
- metric_name="Mean Time to Detection (MTTD)",
382
- current_value=mttd_hours,
383
- target_value=4.0, # Target: 4 hours
384
- trend="improving" if mttd_hours < 6 else "declining",
385
- business_impact="Faster detection reduces breach impact and regulatory penalties",
386
- last_updated=datetime.utcnow(),
387
- benchmark_comparison={"Industry Average": 12.0, "Best in Class": 2.0},
388
- action_required=mttd_hours > 8,
389
- executive_summary=f"Current detection time {mttd_hours:.1f} hours, industry leading practices achieve <4 hours"
390
- ))
391
-
373
+ metrics.append(
374
+ ExecutiveSecurityMetric(
375
+ metric_name="Mean Time to Detection (MTTD)",
376
+ current_value=mttd_hours,
377
+ target_value=4.0, # Target: 4 hours
378
+ trend="improving" if mttd_hours < 6 else "declining",
379
+ business_impact="Faster detection reduces breach impact and regulatory penalties",
380
+ last_updated=datetime.utcnow(),
381
+ benchmark_comparison={"Industry Average": 12.0, "Best in Class": 2.0},
382
+ action_required=mttd_hours > 8,
383
+ executive_summary=f"Current detection time {mttd_hours:.1f} hours, industry leading practices achieve <4 hours",
384
+ )
385
+ )
386
+
392
387
  # Mean Time to Remediation (MTTR)
393
388
  mttr_hours = await self.metrics_collector.get_mean_time_to_remediation()
394
- metrics.append(ExecutiveSecurityMetric(
395
- metric_name="Mean Time to Remediation (MTTR)",
396
- current_value=mttr_hours,
397
- target_value=24.0, # Target: 24 hours
398
- trend="stable",
399
- business_impact="Faster remediation minimizes business disruption and data loss",
400
- last_updated=datetime.utcnow(),
401
- benchmark_comparison={"Industry Average": 48.0, "Best in Class": 12.0},
402
- executive_summary=f"Current remediation time {mttr_hours:.1f} hours, targeting <24 hours for critical issues"
403
- ))
404
-
389
+ metrics.append(
390
+ ExecutiveSecurityMetric(
391
+ metric_name="Mean Time to Remediation (MTTR)",
392
+ current_value=mttr_hours,
393
+ target_value=24.0, # Target: 24 hours
394
+ trend="stable",
395
+ business_impact="Faster remediation minimizes business disruption and data loss",
396
+ last_updated=datetime.utcnow(),
397
+ benchmark_comparison={"Industry Average": 48.0, "Best in Class": 12.0},
398
+ executive_summary=f"Current remediation time {mttr_hours:.1f} hours, targeting <24 hours for critical issues",
399
+ )
400
+ )
401
+
405
402
  # Security Automation Percentage
406
403
  automation_percentage = await self.metrics_collector.get_automation_percentage()
407
- metrics.append(ExecutiveSecurityMetric(
408
- metric_name="Security Automation Rate",
409
- current_value=automation_percentage,
410
- target_value=80.0,
411
- trend="improving",
412
- business_impact="Higher automation reduces operational costs and human error",
413
- last_updated=datetime.utcnow(),
414
- benchmark_comparison={"Industry Average": 45.0, "Best in Class": 85.0},
415
- executive_summary=f"{automation_percentage:.1f}% of security operations automated, targeting 80%+ for optimal efficiency"
416
- ))
417
-
404
+ metrics.append(
405
+ ExecutiveSecurityMetric(
406
+ metric_name="Security Automation Rate",
407
+ current_value=automation_percentage,
408
+ target_value=80.0,
409
+ trend="improving",
410
+ business_impact="Higher automation reduces operational costs and human error",
411
+ last_updated=datetime.utcnow(),
412
+ benchmark_comparison={"Industry Average": 45.0, "Best in Class": 85.0},
413
+ executive_summary=f"{automation_percentage:.1f}% of security operations automated, targeting 80%+ for optimal efficiency",
414
+ )
415
+ )
416
+
418
417
  # Vulnerability Management Efficiency
419
418
  vulnerability_coverage = await self.metrics_collector.get_vulnerability_coverage()
420
- metrics.append(ExecutiveSecurityMetric(
421
- metric_name="Vulnerability Coverage",
422
- current_value=vulnerability_coverage,
423
- target_value=95.0,
424
- trend="stable",
425
- business_impact="Comprehensive vulnerability management reduces attack surface",
426
- last_updated=datetime.utcnow(),
427
- benchmark_comparison={"Industry Average": 75.0, "Best in Class": 98.0},
428
- executive_summary=f"{vulnerability_coverage:.1f}% vulnerability coverage across infrastructure"
429
- ))
430
-
419
+ metrics.append(
420
+ ExecutiveSecurityMetric(
421
+ metric_name="Vulnerability Coverage",
422
+ current_value=vulnerability_coverage,
423
+ target_value=95.0,
424
+ trend="stable",
425
+ business_impact="Comprehensive vulnerability management reduces attack surface",
426
+ last_updated=datetime.utcnow(),
427
+ benchmark_comparison={"Industry Average": 75.0, "Best in Class": 98.0},
428
+ executive_summary=f"{vulnerability_coverage:.1f}% vulnerability coverage across infrastructure",
429
+ )
430
+ )
431
+
431
432
  # Security Training Effectiveness
432
433
  training_effectiveness = await self.metrics_collector.get_security_training_effectiveness()
433
- metrics.append(ExecutiveSecurityMetric(
434
- metric_name="Security Awareness Training Effectiveness",
435
- current_value=training_effectiveness,
436
- target_value=85.0,
437
- trend="improving",
438
- business_impact="Effective training reduces human-error based security incidents",
439
- last_updated=datetime.utcnow(),
440
- benchmark_comparison={"Industry Average": 65.0, "Best in Class": 90.0},
441
- executive_summary=f"{training_effectiveness:.1f}% training effectiveness, human error incidents reduced by 40%"
442
- ))
443
-
434
+ metrics.append(
435
+ ExecutiveSecurityMetric(
436
+ metric_name="Security Awareness Training Effectiveness",
437
+ current_value=training_effectiveness,
438
+ target_value=85.0,
439
+ trend="improving",
440
+ business_impact="Effective training reduces human-error based security incidents",
441
+ last_updated=datetime.utcnow(),
442
+ benchmark_comparison={"Industry Average": 65.0, "Best in Class": 90.0},
443
+ executive_summary=f"{training_effectiveness:.1f}% training effectiveness, human error incidents reduced by 40%",
444
+ )
445
+ )
446
+
444
447
  return metrics
445
448
 
446
449
  async def _analyze_compliance_status(self) -> List[ComplianceFrameworkStatus]:
447
450
  """Analyze compliance status across multiple frameworks."""
448
-
451
+
449
452
  compliance_statuses = []
450
-
453
+
451
454
  # SOC 2 Compliance
452
455
  soc2_score = await self.compliance_analyzer.get_soc2_compliance_score()
453
- compliance_statuses.append(ComplianceFrameworkStatus(
454
- framework_name="SOC 2 Type II",
455
- compliance_percentage=soc2_score,
456
- target_percentage=100.0,
457
- last_assessment=datetime.utcnow() - timedelta(days=30),
458
- next_assessment=datetime.utcnow() + timedelta(days=335), # Annual
459
- gaps_identified=5 if soc2_score < 100 else 0,
460
- gaps_remediated=15,
461
- estimated_remediation_cost=75000.0,
462
- business_risk_if_non_compliant="Loss of enterprise customers, $2M+ annual revenue impact",
463
- audit_readiness_score=soc2_score,
464
- certification_status="certified" if soc2_score >= 95 else "pending",
465
- key_findings=[
466
- "Access controls implementation excellent",
467
- "Logging and monitoring fully compliant",
468
- "Minor gaps in incident response documentation"
469
- ]
470
- ))
471
-
456
+ compliance_statuses.append(
457
+ ComplianceFrameworkStatus(
458
+ framework_name="SOC 2 Type II",
459
+ compliance_percentage=soc2_score,
460
+ target_percentage=100.0,
461
+ last_assessment=datetime.utcnow() - timedelta(days=30),
462
+ next_assessment=datetime.utcnow() + timedelta(days=335), # Annual
463
+ gaps_identified=5 if soc2_score < 100 else 0,
464
+ gaps_remediated=15,
465
+ estimated_remediation_cost=75000.0,
466
+ business_risk_if_non_compliant="Loss of enterprise customers, $2M+ annual revenue impact",
467
+ audit_readiness_score=soc2_score,
468
+ certification_status="certified" if soc2_score >= 95 else "pending",
469
+ key_findings=[
470
+ "Access controls implementation excellent",
471
+ "Logging and monitoring fully compliant",
472
+ "Minor gaps in incident response documentation",
473
+ ],
474
+ )
475
+ )
476
+
472
477
  # PCI DSS Compliance (if applicable)
473
478
  pci_score = await self.compliance_analyzer.get_pci_dss_compliance_score()
474
479
  if pci_score > 0: # Only include if PCI applies
475
- compliance_statuses.append(ComplianceFrameworkStatus(
476
- framework_name="PCI DSS",
477
- compliance_percentage=pci_score,
478
- target_percentage=100.0,
479
- last_assessment=datetime.utcnow() - timedelta(days=90),
480
- next_assessment=datetime.utcnow() + timedelta(days=275), # Quarterly
481
- gaps_identified=3 if pci_score < 100 else 0,
482
- gaps_remediated=8,
483
- estimated_remediation_cost=125000.0,
484
- business_risk_if_non_compliant="Unable to process payments, business operations halt",
485
- audit_readiness_score=pci_score,
486
- certification_status="certified" if pci_score >= 98 else "pending",
487
- key_findings=[
488
- "Payment data encryption fully implemented",
489
- "Network segmentation meets requirements",
490
- "Vulnerability scanning program operational"
491
- ]
492
- ))
493
-
480
+ compliance_statuses.append(
481
+ ComplianceFrameworkStatus(
482
+ framework_name="PCI DSS",
483
+ compliance_percentage=pci_score,
484
+ target_percentage=100.0,
485
+ last_assessment=datetime.utcnow() - timedelta(days=90),
486
+ next_assessment=datetime.utcnow() + timedelta(days=275), # Quarterly
487
+ gaps_identified=3 if pci_score < 100 else 0,
488
+ gaps_remediated=8,
489
+ estimated_remediation_cost=125000.0,
490
+ business_risk_if_non_compliant="Unable to process payments, business operations halt",
491
+ audit_readiness_score=pci_score,
492
+ certification_status="certified" if pci_score >= 98 else "pending",
493
+ key_findings=[
494
+ "Payment data encryption fully implemented",
495
+ "Network segmentation meets requirements",
496
+ "Vulnerability scanning program operational",
497
+ ],
498
+ )
499
+ )
500
+
494
501
  # HIPAA Compliance (if applicable)
495
502
  hipaa_score = await self.compliance_analyzer.get_hipaa_compliance_score()
496
503
  if hipaa_score > 0: # Only include if HIPAA applies
497
- compliance_statuses.append(ComplianceFrameworkStatus(
498
- framework_name="HIPAA",
499
- compliance_percentage=hipaa_score,
500
- target_percentage=100.0,
501
- last_assessment=datetime.utcnow() - timedelta(days=60),
502
- next_assessment=datetime.utcnow() + timedelta(days=305), # Annual
503
- gaps_identified=2 if hipaa_score < 100 else 0,
504
- gaps_remediated=6,
505
- estimated_remediation_cost=95000.0,
506
- business_risk_if_non_compliant="Healthcare operations suspended, $5M+ fines possible",
507
- audit_readiness_score=hipaa_score,
508
- certification_status="certified" if hipaa_score >= 95 else "pending",
509
- key_findings=[
510
- "PHI encryption and access controls compliant",
511
- "Audit trail systems fully operational",
512
- "Business associate agreements current"
513
- ]
514
- ))
515
-
504
+ compliance_statuses.append(
505
+ ComplianceFrameworkStatus(
506
+ framework_name="HIPAA",
507
+ compliance_percentage=hipaa_score,
508
+ target_percentage=100.0,
509
+ last_assessment=datetime.utcnow() - timedelta(days=60),
510
+ next_assessment=datetime.utcnow() + timedelta(days=305), # Annual
511
+ gaps_identified=2 if hipaa_score < 100 else 0,
512
+ gaps_remediated=6,
513
+ estimated_remediation_cost=95000.0,
514
+ business_risk_if_non_compliant="Healthcare operations suspended, $5M+ fines possible",
515
+ audit_readiness_score=hipaa_score,
516
+ certification_status="certified" if hipaa_score >= 95 else "pending",
517
+ key_findings=[
518
+ "PHI encryption and access controls compliant",
519
+ "Audit trail systems fully operational",
520
+ "Business associate agreements current",
521
+ ],
522
+ )
523
+ )
524
+
516
525
  # AWS Well-Architected Security Pillar
517
526
  aws_wa_score = await self.compliance_analyzer.get_aws_well_architected_score()
518
- compliance_statuses.append(ComplianceFrameworkStatus(
519
- framework_name="AWS Well-Architected Security",
520
- compliance_percentage=aws_wa_score,
521
- target_percentage=90.0,
522
- last_assessment=datetime.utcnow() - timedelta(days=14),
523
- next_assessment=datetime.utcnow() + timedelta(days=76), # Quarterly
524
- gaps_identified=8 if aws_wa_score < 90 else 0,
525
- gaps_remediated=12,
526
- estimated_remediation_cost=45000.0,
527
- business_risk_if_non_compliant="Suboptimal cloud security posture, increased breach risk",
528
- audit_readiness_score=aws_wa_score,
529
- certification_status="compliant" if aws_wa_score >= 85 else "needs_improvement",
530
- key_findings=[
531
- "Identity and access management strong",
532
- "Data protection measures implemented",
533
- "Infrastructure protection needs enhancement"
534
- ]
535
- ))
536
-
527
+ compliance_statuses.append(
528
+ ComplianceFrameworkStatus(
529
+ framework_name="AWS Well-Architected Security",
530
+ compliance_percentage=aws_wa_score,
531
+ target_percentage=90.0,
532
+ last_assessment=datetime.utcnow() - timedelta(days=14),
533
+ next_assessment=datetime.utcnow() + timedelta(days=76), # Quarterly
534
+ gaps_identified=8 if aws_wa_score < 90 else 0,
535
+ gaps_remediated=12,
536
+ estimated_remediation_cost=45000.0,
537
+ business_risk_if_non_compliant="Suboptimal cloud security posture, increased breach risk",
538
+ audit_readiness_score=aws_wa_score,
539
+ certification_status="compliant" if aws_wa_score >= 85 else "needs_improvement",
540
+ key_findings=[
541
+ "Identity and access management strong",
542
+ "Data protection measures implemented",
543
+ "Infrastructure protection needs enhancement",
544
+ ],
545
+ )
546
+ )
547
+
537
548
  return compliance_statuses
538
549
 
539
550
  async def _analyze_security_investments(self) -> List[SecurityInvestmentROI]:
540
551
  """Analyze ROI of security investments for executive reporting."""
541
-
552
+
542
553
  investments = []
543
-
554
+
544
555
  # Security Automation Platform Investment
545
556
  automation_roi = self.roi_calculator.calculate_automation_platform_roi()
546
- investments.append(SecurityInvestmentROI(
547
- investment_name="Security Automation Platform",
548
- total_investment=450000.0,
549
- annual_operational_cost=180000.0,
550
- quantified_benefits={
551
- "Incident Response Time Reduction": 320000.0,
552
- "Manual Task Elimination": 280000.0,
553
- "Compliance Automation": 150000.0
554
- },
555
- risk_reduction_value=1200000.0,
556
- productivity_gains=560000.0,
557
- compliance_cost_avoidance=200000.0,
558
- incident_cost_avoidance=800000.0,
559
- roi_percentage=245.0,
560
- payback_period_months=18,
561
- net_present_value=1650000.0,
562
- business_justification="Automation platform delivers 245% ROI through operational efficiency and risk reduction"
563
- ))
564
-
557
+ investments.append(
558
+ SecurityInvestmentROI(
559
+ investment_name="Security Automation Platform",
560
+ total_investment=450000.0,
561
+ annual_operational_cost=180000.0,
562
+ quantified_benefits={
563
+ "Incident Response Time Reduction": 320000.0,
564
+ "Manual Task Elimination": 280000.0,
565
+ "Compliance Automation": 150000.0,
566
+ },
567
+ risk_reduction_value=1200000.0,
568
+ productivity_gains=560000.0,
569
+ compliance_cost_avoidance=200000.0,
570
+ incident_cost_avoidance=800000.0,
571
+ roi_percentage=245.0,
572
+ payback_period_months=18,
573
+ net_present_value=1650000.0,
574
+ business_justification="Automation platform delivers 245% ROI through operational efficiency and risk reduction",
575
+ )
576
+ )
577
+
565
578
  # Zero Trust Architecture Implementation
566
579
  zero_trust_roi = self.roi_calculator.calculate_zero_trust_roi()
567
- investments.append(SecurityInvestmentROI(
568
- investment_name="Zero Trust Architecture",
569
- total_investment=850000.0,
570
- annual_operational_cost=200000.0,
571
- quantified_benefits={
572
- "Breach Impact Reduction": 2500000.0,
573
- "Remote Work Security": 400000.0,
574
- "Insider Threat Prevention": 600000.0
575
- },
576
- risk_reduction_value=3500000.0,
577
- productivity_gains=400000.0,
578
- compliance_cost_avoidance=300000.0,
579
- incident_cost_avoidance=2800000.0,
580
- roi_percentage=385.0,
581
- payback_period_months=12,
582
- net_present_value=2850000.0,
583
- business_justification="Zero Trust architecture provides 385% ROI through comprehensive security modernization"
584
- ))
585
-
580
+ investments.append(
581
+ SecurityInvestmentROI(
582
+ investment_name="Zero Trust Architecture",
583
+ total_investment=850000.0,
584
+ annual_operational_cost=200000.0,
585
+ quantified_benefits={
586
+ "Breach Impact Reduction": 2500000.0,
587
+ "Remote Work Security": 400000.0,
588
+ "Insider Threat Prevention": 600000.0,
589
+ },
590
+ risk_reduction_value=3500000.0,
591
+ productivity_gains=400000.0,
592
+ compliance_cost_avoidance=300000.0,
593
+ incident_cost_avoidance=2800000.0,
594
+ roi_percentage=385.0,
595
+ payback_period_months=12,
596
+ net_present_value=2850000.0,
597
+ business_justification="Zero Trust architecture provides 385% ROI through comprehensive security modernization",
598
+ )
599
+ )
600
+
586
601
  # Cloud Security Platform
587
602
  cloud_security_roi = self.roi_calculator.calculate_cloud_security_roi()
588
- investments.append(SecurityInvestmentROI(
589
- investment_name="Cloud Security Platform",
590
- total_investment=320000.0,
591
- annual_operational_cost=120000.0,
592
- quantified_benefits={
593
- "Cloud Compliance Automation": 180000.0,
594
- "Multi-Cloud Visibility": 220000.0,
595
- "DevSecOps Integration": 160000.0
596
- },
597
- risk_reduction_value=750000.0,
598
- productivity_gains=340000.0,
599
- compliance_cost_avoidance=180000.0,
600
- incident_cost_avoidance=450000.0,
601
- roi_percentage=195.0,
602
- payback_period_months=22,
603
- net_present_value=890000.0,
604
- business_justification="Cloud security platform enables secure digital transformation with 195% ROI"
605
- ))
606
-
603
+ investments.append(
604
+ SecurityInvestmentROI(
605
+ investment_name="Cloud Security Platform",
606
+ total_investment=320000.0,
607
+ annual_operational_cost=120000.0,
608
+ quantified_benefits={
609
+ "Cloud Compliance Automation": 180000.0,
610
+ "Multi-Cloud Visibility": 220000.0,
611
+ "DevSecOps Integration": 160000.0,
612
+ },
613
+ risk_reduction_value=750000.0,
614
+ productivity_gains=340000.0,
615
+ compliance_cost_avoidance=180000.0,
616
+ incident_cost_avoidance=450000.0,
617
+ roi_percentage=195.0,
618
+ payback_period_months=22,
619
+ net_present_value=890000.0,
620
+ business_justification="Cloud security platform enables secure digital transformation with 195% ROI",
621
+ )
622
+ )
623
+
607
624
  return investments
608
625
 
609
626
  async def _generate_incident_summary(self, reporting_period: str) -> SecurityIncidentExecutiveSummary:
610
627
  """Generate executive summary of security incidents."""
611
-
628
+
612
629
  # Calculate reporting period dates
613
630
  end_date = datetime.utcnow()
614
631
  if reporting_period == "monthly":
@@ -617,111 +634,108 @@ class ExecutiveSecurityDashboard:
617
634
  start_date = end_date - timedelta(days=90)
618
635
  else: # annual
619
636
  start_date = end_date - timedelta(days=365)
620
-
637
+
621
638
  # Get incident data (in production, this would query actual incident management systems)
622
639
  incident_data = await self.metrics_collector.get_incident_summary(start_date, end_date)
623
-
640
+
624
641
  return SecurityIncidentExecutiveSummary(
625
642
  reporting_period=reporting_period,
626
- total_incidents=incident_data.get('total_incidents', 12),
627
- critical_incidents=incident_data.get('critical_incidents', 2),
628
- average_response_time=incident_data.get('avg_response_time', 3.2),
629
- average_resolution_time=incident_data.get('avg_resolution_time', 18.5),
643
+ total_incidents=incident_data.get("total_incidents", 12),
644
+ critical_incidents=incident_data.get("critical_incidents", 2),
645
+ average_response_time=incident_data.get("avg_response_time", 3.2),
646
+ average_resolution_time=incident_data.get("avg_resolution_time", 18.5),
630
647
  incidents_by_category={
631
648
  "Phishing Attempts": 5,
632
649
  "Malware Detection": 3,
633
650
  "Unauthorized Access": 2,
634
651
  "Data Loss Prevention": 1,
635
- "Compliance Violation": 1
652
+ "Compliance Violation": 1,
636
653
  },
637
- financial_impact=incident_data.get('financial_impact', 125000.0),
654
+ financial_impact=incident_data.get("financial_impact", 125000.0),
638
655
  lessons_learned=[
639
656
  "Enhanced email security filters reduced phishing success rate by 60%",
640
657
  "Automated incident response reduced average resolution time by 40%",
641
- "Zero trust architecture prevented lateral movement in 2 incidents"
658
+ "Zero trust architecture prevented lateral movement in 2 incidents",
642
659
  ],
643
660
  preventive_measures_implemented=8,
644
661
  automation_improvements=4,
645
662
  executive_actions_required=[
646
663
  "Approve additional security awareness training budget",
647
- "Review and update incident response playbooks"
648
- ]
664
+ "Review and update incident response playbooks",
665
+ ],
649
666
  )
650
667
 
651
668
  def _calculate_overall_security_posture(
652
669
  self,
653
670
  metrics: List[ExecutiveSecurityMetric],
654
671
  compliance: List[ComplianceFrameworkStatus],
655
- incidents: SecurityIncidentExecutiveSummary
672
+ incidents: SecurityIncidentExecutiveSummary,
656
673
  ) -> float:
657
674
  """Calculate overall security posture score for executive reporting."""
658
-
675
+
659
676
  # Weighted scoring model
660
677
  weights = {
661
- 'metrics': 0.4, # 40% weight on key metrics
662
- 'compliance': 0.4, # 40% weight on compliance
663
- 'incidents': 0.2 # 20% weight on incident performance
678
+ "metrics": 0.4, # 40% weight on key metrics
679
+ "compliance": 0.4, # 40% weight on compliance
680
+ "incidents": 0.2, # 20% weight on incident performance
664
681
  }
665
-
682
+
666
683
  # Calculate metrics score
667
684
  metrics_score = 0.0
668
685
  if metrics:
669
686
  metrics_score = sum(
670
- min(100, (metric.current_value / metric.target_value) * 100)
671
- for metric in metrics
687
+ min(100, (metric.current_value / metric.target_value) * 100) for metric in metrics
672
688
  ) / len(metrics)
673
-
689
+
674
690
  # Calculate compliance score
675
691
  compliance_score = 0.0
676
692
  if compliance:
677
- compliance_score = sum(
678
- framework.compliance_percentage for framework in compliance
679
- ) / len(compliance)
680
-
693
+ compliance_score = sum(framework.compliance_percentage for framework in compliance) / len(compliance)
694
+
681
695
  # Calculate incident score (inverse - fewer/faster is better)
682
696
  incident_score = 100.0 # Start with perfect score
683
697
  if incidents.total_incidents > 10: # More than 10 incidents reduces score
684
698
  incident_score -= min(30, (incidents.total_incidents - 10) * 2)
685
699
  if incidents.average_response_time > 4: # Slow response reduces score
686
700
  incident_score -= min(20, (incidents.average_response_time - 4) * 5)
687
-
701
+
688
702
  # Calculate weighted final score
689
703
  overall_score = (
690
- metrics_score * weights['metrics'] +
691
- compliance_score * weights['compliance'] +
692
- incident_score * weights['incidents']
704
+ metrics_score * weights["metrics"]
705
+ + compliance_score * weights["compliance"]
706
+ + incident_score * weights["incidents"]
693
707
  )
694
-
708
+
695
709
  return max(0.0, min(100.0, overall_score))
696
710
 
697
711
  def _assess_security_maturity(
698
712
  self,
699
713
  metrics: List[ExecutiveSecurityMetric],
700
714
  compliance: List[ComplianceFrameworkStatus],
701
- investments: List[SecurityInvestmentROI]
715
+ investments: List[SecurityInvestmentROI],
702
716
  ) -> SecurityMaturityLevel:
703
717
  """Assess organizational security maturity level."""
704
-
718
+
705
719
  # Calculate maturity indicators
706
720
  automation_rate = 0.0
707
721
  compliance_avg = 0.0
708
722
  investment_sophistication = 0.0
709
-
723
+
710
724
  # Get automation rate from metrics
711
725
  for metric in metrics:
712
726
  if "automation" in metric.metric_name.lower():
713
727
  automation_rate = metric.current_value
714
728
  break
715
-
729
+
716
730
  # Calculate average compliance
717
731
  if compliance:
718
732
  compliance_avg = sum(f.compliance_percentage for f in compliance) / len(compliance)
719
-
733
+
720
734
  # Assess investment sophistication
721
735
  if investments:
722
736
  roi_avg = sum(inv.roi_percentage for inv in investments) / len(investments)
723
737
  investment_sophistication = min(100, roi_avg / 2) # Normalize to 0-100
724
-
738
+
725
739
  # Determine maturity level
726
740
  if automation_rate >= 80 and compliance_avg >= 95 and investment_sophistication >= 80:
727
741
  return SecurityMaturityLevel.OPTIMIZING
@@ -735,149 +749,145 @@ class ExecutiveSecurityDashboard:
735
749
  return SecurityMaturityLevel.INITIAL
736
750
 
737
751
  def _analyze_risk_appetite_alignment(
738
- self,
739
- security_posture: float,
740
- incidents: SecurityIncidentExecutiveSummary
752
+ self, security_posture: float, incidents: SecurityIncidentExecutiveSummary
741
753
  ) -> float:
742
754
  """Analyze how well current security posture aligns with business risk appetite."""
743
-
755
+
744
756
  # Define risk appetite thresholds
745
757
  risk_thresholds = {
746
- RiskAppetite.VERY_LOW: {'min_posture': 95, 'max_incidents': 2},
747
- RiskAppetite.LOW: {'min_posture': 90, 'max_incidents': 5},
748
- RiskAppetite.MODERATE: {'min_posture': 80, 'max_incidents': 10},
749
- RiskAppetite.HIGH: {'min_posture': 70, 'max_incidents': 20},
750
- RiskAppetite.VERY_HIGH: {'min_posture': 60, 'max_incidents': 50}
758
+ RiskAppetite.VERY_LOW: {"min_posture": 95, "max_incidents": 2},
759
+ RiskAppetite.LOW: {"min_posture": 90, "max_incidents": 5},
760
+ RiskAppetite.MODERATE: {"min_posture": 80, "max_incidents": 10},
761
+ RiskAppetite.HIGH: {"min_posture": 70, "max_incidents": 20},
762
+ RiskAppetite.VERY_HIGH: {"min_posture": 60, "max_incidents": 50},
751
763
  }
752
-
764
+
753
765
  threshold = risk_thresholds[self.risk_appetite]
754
-
766
+
755
767
  # Calculate alignment score
756
- posture_alignment = min(100, (security_posture / threshold['min_posture']) * 100)
757
- incident_alignment = min(100, (threshold['max_incidents'] / max(1, incidents.total_incidents)) * 100)
758
-
768
+ posture_alignment = min(100, (security_posture / threshold["min_posture"]) * 100)
769
+ incident_alignment = min(100, (threshold["max_incidents"] / max(1, incidents.total_incidents)) * 100)
770
+
759
771
  # Weighted average
760
- alignment_score = (posture_alignment * 0.7 + incident_alignment * 0.3)
761
-
772
+ alignment_score = posture_alignment * 0.7 + incident_alignment * 0.3
773
+
762
774
  return min(100.0, alignment_score)
763
775
 
764
776
  def _calculate_business_impact_metrics(
765
- self,
766
- investments: List[SecurityInvestmentROI],
767
- incidents: SecurityIncidentExecutiveSummary
777
+ self, investments: List[SecurityInvestmentROI], incidents: SecurityIncidentExecutiveSummary
768
778
  ) -> Dict[str, Any]:
769
779
  """Calculate business impact metrics for executive reporting."""
770
-
780
+
771
781
  total_investment = sum(inv.total_investment + inv.annual_operational_cost for inv in investments)
772
782
  total_roi = sum(inv.roi_percentage * inv.total_investment for inv in investments) / max(1, total_investment)
773
783
  risk_reduction = sum(inv.risk_reduction_value for inv in investments)
774
784
  cost_avoidance = sum(inv.incident_cost_avoidance + inv.compliance_cost_avoidance for inv in investments)
775
-
785
+
776
786
  return {
777
- 'total_security_investment': total_investment,
778
- 'annual_security_roi': total_roi,
779
- 'risk_reduction_achieved': risk_reduction,
780
- 'cost_avoidance_realized': cost_avoidance
787
+ "total_security_investment": total_investment,
788
+ "annual_security_roi": total_roi,
789
+ "risk_reduction_achieved": risk_reduction,
790
+ "cost_avoidance_realized": cost_avoidance,
781
791
  }
782
792
 
783
793
  async def _generate_strategic_insights(
784
794
  self,
785
795
  metrics: List[ExecutiveSecurityMetric],
786
796
  compliance: List[ComplianceFrameworkStatus],
787
- include_benchmarks: bool
797
+ include_benchmarks: bool,
788
798
  ) -> Dict[str, Any]:
789
799
  """Generate strategic insights for executive decision making."""
790
-
800
+
791
801
  # Top security priorities based on gaps and risks
792
802
  top_priorities = [
793
803
  "Accelerate security automation adoption to achieve 80% target",
794
- "Complete SOC 2 compliance remediation for Q3 audit readiness",
804
+ "Complete SOC 2 compliance remediation for Q3 audit readiness",
795
805
  "Implement advanced threat detection to reduce MTTD to <4 hours",
796
806
  "Expand security awareness training to reduce human error incidents",
797
- "Enhance cloud security posture for digital transformation initiatives"
807
+ "Enhance cloud security posture for digital transformation initiatives",
798
808
  ]
799
-
809
+
800
810
  # Emerging threats relevant to the business
801
811
  emerging_threats = [
802
812
  "AI-powered social engineering attacks targeting executives",
803
813
  "Supply chain compromises affecting cloud service providers",
804
814
  "Ransomware attacks targeting backup and recovery systems",
805
815
  "Insider threats in remote work environments",
806
- "API security vulnerabilities in digital transformation initiatives"
816
+ "API security vulnerabilities in digital transformation initiatives",
807
817
  ]
808
-
818
+
809
819
  # Industry benchmark comparison
810
820
  industry_benchmarks = {}
811
821
  if include_benchmarks:
812
822
  industry_benchmarks = await self.benchmark_analyzer.get_industry_benchmarks()
813
-
823
+
814
824
  # Board recommendations
815
825
  board_recommendations = [
816
826
  "Approve $2M additional investment in security automation for 300% ROI",
817
827
  "Establish cyber risk committee with quarterly board reporting",
818
828
  "Review and update cyber insurance coverage based on current risk profile",
819
829
  "Implement executive security awareness program for C-suite protection",
820
- "Develop incident response communication plan for stakeholder management"
830
+ "Develop incident response communication plan for stakeholder management",
821
831
  ]
822
-
832
+
823
833
  # Operational excellence metrics
824
834
  automation_percentage = 0.0
825
835
  for metric in metrics:
826
836
  if "automation" in metric.metric_name.lower():
827
837
  automation_percentage = metric.current_value
828
838
  break
829
-
839
+
830
840
  team_efficiency_metrics = {
831
841
  "Incident Response Efficiency": 87.0,
832
842
  "Compliance Reporting Automation": 92.0,
833
843
  "Threat Detection Accuracy": 94.0,
834
- "Security Tool Integration": 78.0
844
+ "Security Tool Integration": 78.0,
835
845
  }
836
-
846
+
837
847
  vendor_performance_scores = {
838
848
  "Security Platform Provider": 89.0,
839
849
  "Managed Security Services": 85.0,
840
850
  "Compliance Assessment Vendor": 91.0,
841
- "Security Training Provider": 83.0
851
+ "Security Training Provider": 83.0,
842
852
  }
843
-
853
+
844
854
  return {
845
- 'top_security_priorities': top_priorities,
846
- 'emerging_threats': emerging_threats,
847
- 'industry_benchmark_comparison': industry_benchmarks,
848
- 'board_recommendations': board_recommendations,
849
- 'automation_percentage': automation_percentage,
850
- 'team_efficiency_metrics': team_efficiency_metrics,
851
- 'vendor_performance_scores': vendor_performance_scores
855
+ "top_security_priorities": top_priorities,
856
+ "emerging_threats": emerging_threats,
857
+ "industry_benchmark_comparison": industry_benchmarks,
858
+ "board_recommendations": board_recommendations,
859
+ "automation_percentage": automation_percentage,
860
+ "team_efficiency_metrics": team_efficiency_metrics,
861
+ "vendor_performance_scores": vendor_performance_scores,
852
862
  }
853
863
 
854
864
  async def _generate_board_presentation(self, report: ExecutiveSecurityReport):
855
865
  """Generate board-ready presentation materials."""
856
-
866
+
857
867
  print_info("Generating board presentation materials...")
858
-
868
+
859
869
  presentation_dir = self.output_dir / f"board_presentation_{report.report_id}"
860
870
  presentation_dir.mkdir(exist_ok=True)
861
-
871
+
862
872
  # Generate executive slides (would integrate with presentation tools)
863
873
  slides_content = self._create_board_slides_content(report)
864
-
874
+
865
875
  slides_file = presentation_dir / "executive_security_briefing.md"
866
- with open(slides_file, 'w') as f:
876
+ with open(slides_file, "w") as f:
867
877
  f.write(slides_content)
868
-
878
+
869
879
  print_success(f"Board presentation generated: {slides_file}")
870
880
 
871
881
  def _create_board_slides_content(self, report: ExecutiveSecurityReport) -> str:
872
882
  """Create board presentation slide content."""
873
-
883
+
874
884
  return f"""# Executive Security Briefing
875
885
  **Reporting Period:** {report.reporting_period}
876
- **Generated:** {report.generation_timestamp.strftime('%B %d, %Y')}
886
+ **Generated:** {report.generation_timestamp.strftime("%B %d, %Y")}
877
887
 
878
888
  ## Executive Summary
879
889
  - **Overall Security Posture:** {report.overall_security_posture_score:.1f}%
880
- - **Security Maturity Level:** {report.security_maturity_level.value.replace('_', ' ').title()}
890
+ - **Security Maturity Level:** {report.security_maturity_level.value.replace("_", " ").title()}
881
891
  - **Risk Appetite Alignment:** {report.risk_appetite_alignment:.1f}%
882
892
  - **Annual Security ROI:** {report.annual_security_roi:.1f}%
883
893
 
@@ -904,7 +914,7 @@ class ExecutiveSecurityDashboard:
904
914
 
905
915
  def _format_metrics_for_slides(self, metrics: List[ExecutiveSecurityMetric]) -> str:
906
916
  """Format metrics for board slide presentation."""
907
-
917
+
908
918
  formatted_metrics = []
909
919
  for metric in metrics[:5]: # Top 5 metrics
910
920
  trend_emoji = "📈" if metric.trend == "improving" else "📊" if metric.trend == "stable" else "📉"
@@ -912,29 +922,35 @@ class ExecutiveSecurityDashboard:
912
922
  f"- **{metric.metric_name}:** {metric.current_value:.1f} "
913
923
  f"(Target: {metric.target_value:.1f}) {trend_emoji}"
914
924
  )
915
-
925
+
916
926
  return "\n".join(formatted_metrics)
917
927
 
918
928
  def _format_compliance_for_slides(self, compliance: List[ComplianceFrameworkStatus]) -> str:
919
929
  """Format compliance status for board slides."""
920
-
930
+
921
931
  formatted_compliance = []
922
932
  for framework in compliance:
923
- status_emoji = "✅" if framework.compliance_percentage >= 95 else "⚠️" if framework.compliance_percentage >= 80 else "❌"
933
+ status_emoji = (
934
+ "✅"
935
+ if framework.compliance_percentage >= 95
936
+ else "⚠️"
937
+ if framework.compliance_percentage >= 80
938
+ else "❌"
939
+ )
924
940
  formatted_compliance.append(
925
941
  f"- **{framework.framework_name}:** {framework.compliance_percentage:.1f}% {status_emoji}"
926
942
  )
927
-
943
+
928
944
  return "\n".join(formatted_compliance)
929
945
 
930
946
  def _format_recommendations_for_slides(self, recommendations: List[str]) -> str:
931
947
  """Format recommendations for board slides."""
932
-
933
- return "\n".join(f"{i+1}. {rec}" for i, rec in enumerate(recommendations[:5]))
948
+
949
+ return "\n".join(f"{i + 1}. {rec}" for i, rec in enumerate(recommendations[:5]))
934
950
 
935
951
  def _display_executive_summary(self, report: ExecutiveSecurityReport):
936
952
  """Display executive summary to console."""
937
-
953
+
938
954
  # Executive overview panel
939
955
  overview_content = (
940
956
  f"[bold green]Executive Security Report Generated[/bold green]\n\n"
@@ -945,13 +961,9 @@ class ExecutiveSecurityDashboard:
945
961
  f"[bold]Risk Appetite Alignment:[/bold] {report.risk_appetite_alignment:.1f}%\n"
946
962
  f"[bold]Annual Security ROI:[/bold] {report.annual_security_roi:.1f}%"
947
963
  )
948
-
949
- console.print(create_panel(
950
- overview_content,
951
- title="📊 Executive Security Overview",
952
- border_style="green"
953
- ))
954
-
964
+
965
+ console.print(create_panel(overview_content, title="📊 Executive Security Overview", border_style="green"))
966
+
955
967
  # Key metrics table
956
968
  metrics_table = create_table(
957
969
  title="Key Security Metrics",
@@ -960,24 +972,24 @@ class ExecutiveSecurityDashboard:
960
972
  {"name": "Current", "style": "green"},
961
973
  {"name": "Target", "style": "yellow"},
962
974
  {"name": "Trend", "style": "blue"},
963
- {"name": "Action Required", "style": "red"}
964
- ]
975
+ {"name": "Action Required", "style": "red"},
976
+ ],
965
977
  )
966
-
978
+
967
979
  for metric in report.key_security_metrics[:6]: # Show top 6 metrics
968
980
  trend_symbol = "↗️" if metric.trend == "improving" else "→" if metric.trend == "stable" else "↘️"
969
981
  action_symbol = "⚠️" if metric.action_required else "✅"
970
-
982
+
971
983
  metrics_table.add_row(
972
984
  metric.metric_name[:25] + "..." if len(metric.metric_name) > 25 else metric.metric_name,
973
985
  f"{metric.current_value:.1f}",
974
986
  f"{metric.target_value:.1f}",
975
987
  f"{trend_symbol} {metric.trend}",
976
- action_symbol
988
+ action_symbol,
977
989
  )
978
-
990
+
979
991
  console.print(metrics_table)
980
-
992
+
981
993
  # Financial impact summary
982
994
  financial_content = (
983
995
  f"[bold cyan]Security Investment Analysis[/bold cyan]\n\n"
@@ -986,165 +998,161 @@ class ExecutiveSecurityDashboard:
986
998
  f"[yellow]Cost Avoidance Realized:[/yellow] ${report.cost_avoidance_realized:,.0f}\n"
987
999
  f"[magenta]Net Security Value:[/magenta] ${(report.risk_reduction_achieved + report.cost_avoidance_realized - report.total_security_investment):,.0f}"
988
1000
  )
989
-
990
- console.print(create_panel(
991
- financial_content,
992
- title="💰 Financial Impact Summary",
993
- border_style="blue"
994
- ))
1001
+
1002
+ console.print(create_panel(financial_content, title="💰 Financial Impact Summary", border_style="blue"))
995
1003
 
996
1004
  async def _export_executive_report(self, report: ExecutiveSecurityReport):
997
1005
  """Export comprehensive executive report."""
998
-
1006
+
999
1007
  # Export detailed JSON report
1000
1008
  json_report_path = self.output_dir / f"executive_security_report_{report.report_id}.json"
1001
-
1009
+
1002
1010
  report_data = {
1003
- 'report_metadata': {
1004
- 'report_id': report.report_id,
1005
- 'reporting_period': report.reporting_period,
1006
- 'generation_timestamp': report.generation_timestamp.isoformat(),
1007
- 'risk_appetite': self.risk_appetite.value
1011
+ "report_metadata": {
1012
+ "report_id": report.report_id,
1013
+ "reporting_period": report.reporting_period,
1014
+ "generation_timestamp": report.generation_timestamp.isoformat(),
1015
+ "risk_appetite": self.risk_appetite.value,
1008
1016
  },
1009
- 'executive_summary': {
1010
- 'overall_security_posture_score': report.overall_security_posture_score,
1011
- 'security_maturity_level': report.security_maturity_level.value,
1012
- 'risk_appetite_alignment': report.risk_appetite_alignment
1017
+ "executive_summary": {
1018
+ "overall_security_posture_score": report.overall_security_posture_score,
1019
+ "security_maturity_level": report.security_maturity_level.value,
1020
+ "risk_appetite_alignment": report.risk_appetite_alignment,
1013
1021
  },
1014
- 'key_metrics': [
1022
+ "key_metrics": [
1015
1023
  {
1016
- 'metric_name': metric.metric_name,
1017
- 'current_value': metric.current_value,
1018
- 'target_value': metric.target_value,
1019
- 'trend': metric.trend,
1020
- 'business_impact': metric.business_impact,
1021
- 'benchmark_comparison': metric.benchmark_comparison,
1022
- 'action_required': metric.action_required,
1023
- 'executive_summary': metric.executive_summary
1024
+ "metric_name": metric.metric_name,
1025
+ "current_value": metric.current_value,
1026
+ "target_value": metric.target_value,
1027
+ "trend": metric.trend,
1028
+ "business_impact": metric.business_impact,
1029
+ "benchmark_comparison": metric.benchmark_comparison,
1030
+ "action_required": metric.action_required,
1031
+ "executive_summary": metric.executive_summary,
1024
1032
  }
1025
1033
  for metric in report.key_security_metrics
1026
1034
  ],
1027
- 'compliance_status': [
1035
+ "compliance_status": [
1028
1036
  {
1029
- 'framework_name': framework.framework_name,
1030
- 'compliance_percentage': framework.compliance_percentage,
1031
- 'target_percentage': framework.target_percentage,
1032
- 'audit_readiness_score': framework.audit_readiness_score,
1033
- 'certification_status': framework.certification_status,
1034
- 'business_risk_if_non_compliant': framework.business_risk_if_non_compliant,
1035
- 'estimated_remediation_cost': framework.estimated_remediation_cost,
1036
- 'key_findings': framework.key_findings
1037
+ "framework_name": framework.framework_name,
1038
+ "compliance_percentage": framework.compliance_percentage,
1039
+ "target_percentage": framework.target_percentage,
1040
+ "audit_readiness_score": framework.audit_readiness_score,
1041
+ "certification_status": framework.certification_status,
1042
+ "business_risk_if_non_compliant": framework.business_risk_if_non_compliant,
1043
+ "estimated_remediation_cost": framework.estimated_remediation_cost,
1044
+ "key_findings": framework.key_findings,
1037
1045
  }
1038
1046
  for framework in report.compliance_status
1039
1047
  ],
1040
- 'security_investments': [
1048
+ "security_investments": [
1041
1049
  {
1042
- 'investment_name': investment.investment_name,
1043
- 'total_investment': investment.total_investment,
1044
- 'roi_percentage': investment.roi_percentage,
1045
- 'payback_period_months': investment.payback_period_months,
1046
- 'risk_reduction_value': investment.risk_reduction_value,
1047
- 'business_justification': investment.business_justification
1050
+ "investment_name": investment.investment_name,
1051
+ "total_investment": investment.total_investment,
1052
+ "roi_percentage": investment.roi_percentage,
1053
+ "payback_period_months": investment.payback_period_months,
1054
+ "risk_reduction_value": investment.risk_reduction_value,
1055
+ "business_justification": investment.business_justification,
1048
1056
  }
1049
1057
  for investment in report.security_investments
1050
1058
  ],
1051
- 'incident_summary': {
1052
- 'total_incidents': report.incident_summary.total_incidents,
1053
- 'critical_incidents': report.incident_summary.critical_incidents,
1054
- 'average_response_time': report.incident_summary.average_response_time,
1055
- 'financial_impact': report.incident_summary.financial_impact,
1056
- 'lessons_learned': report.incident_summary.lessons_learned,
1057
- 'executive_actions_required': report.incident_summary.executive_actions_required
1059
+ "incident_summary": {
1060
+ "total_incidents": report.incident_summary.total_incidents,
1061
+ "critical_incidents": report.incident_summary.critical_incidents,
1062
+ "average_response_time": report.incident_summary.average_response_time,
1063
+ "financial_impact": report.incident_summary.financial_impact,
1064
+ "lessons_learned": report.incident_summary.lessons_learned,
1065
+ "executive_actions_required": report.incident_summary.executive_actions_required,
1066
+ },
1067
+ "business_impact": {
1068
+ "total_security_investment": report.total_security_investment,
1069
+ "annual_security_roi": report.annual_security_roi,
1070
+ "risk_reduction_achieved": report.risk_reduction_achieved,
1071
+ "cost_avoidance_realized": report.cost_avoidance_realized,
1058
1072
  },
1059
- 'business_impact': {
1060
- 'total_security_investment': report.total_security_investment,
1061
- 'annual_security_roi': report.annual_security_roi,
1062
- 'risk_reduction_achieved': report.risk_reduction_achieved,
1063
- 'cost_avoidance_realized': report.cost_avoidance_realized
1073
+ "strategic_insights": {
1074
+ "top_security_priorities": report.top_security_priorities,
1075
+ "emerging_threats": report.emerging_threats,
1076
+ "board_recommendations": report.board_recommendations,
1077
+ "industry_benchmark_comparison": report.industry_benchmark_comparison,
1064
1078
  },
1065
- 'strategic_insights': {
1066
- 'top_security_priorities': report.top_security_priorities,
1067
- 'emerging_threats': report.emerging_threats,
1068
- 'board_recommendations': report.board_recommendations,
1069
- 'industry_benchmark_comparison': report.industry_benchmark_comparison
1070
- }
1071
1079
  }
1072
-
1073
- with open(json_report_path, 'w') as f:
1080
+
1081
+ with open(json_report_path, "w") as f:
1074
1082
  json.dump(report_data, f, indent=2)
1075
-
1083
+
1076
1084
  print_success(f"Executive security report exported to: {json_report_path}")
1077
1085
 
1078
1086
 
1079
1087
  class ExecutiveMetricsCollector:
1080
1088
  """Collect executive-level security metrics from various sources."""
1081
-
1089
+
1082
1090
  def __init__(self, session: boto3.Session):
1083
1091
  self.session = session
1084
-
1092
+
1085
1093
  async def get_security_posture_score(self) -> float:
1086
1094
  """Get overall security posture score."""
1087
1095
  # In production, this would aggregate from security tools
1088
1096
  return 87.5
1089
-
1097
+
1090
1098
  async def get_mean_time_to_detection(self) -> float:
1091
1099
  """Get mean time to detection in hours."""
1092
1100
  # In production, this would query SIEM/SOAR systems
1093
1101
  return 3.2
1094
-
1102
+
1095
1103
  async def get_mean_time_to_remediation(self) -> float:
1096
1104
  """Get mean time to remediation in hours."""
1097
1105
  # In production, this would query incident management systems
1098
1106
  return 18.5
1099
-
1107
+
1100
1108
  async def get_automation_percentage(self) -> float:
1101
1109
  """Get percentage of automated security operations."""
1102
1110
  # In production, this would analyze automated vs manual operations
1103
1111
  return 72.0
1104
-
1112
+
1105
1113
  async def get_vulnerability_coverage(self) -> float:
1106
1114
  """Get vulnerability assessment coverage percentage."""
1107
1115
  # In production, this would query vulnerability management systems
1108
1116
  return 89.0
1109
-
1117
+
1110
1118
  async def get_security_training_effectiveness(self) -> float:
1111
1119
  """Get security awareness training effectiveness."""
1112
1120
  # In production, this would query training and phishing simulation platforms
1113
1121
  return 78.0
1114
-
1122
+
1115
1123
  async def get_incident_summary(self, start_date: datetime, end_date: datetime) -> Dict[str, Any]:
1116
1124
  """Get incident summary for reporting period."""
1117
1125
  # In production, this would query incident management systems
1118
1126
  return {
1119
- 'total_incidents': 12,
1120
- 'critical_incidents': 2,
1121
- 'avg_response_time': 3.2,
1122
- 'avg_resolution_time': 18.5,
1123
- 'financial_impact': 125000.0
1127
+ "total_incidents": 12,
1128
+ "critical_incidents": 2,
1129
+ "avg_response_time": 3.2,
1130
+ "avg_resolution_time": 18.5,
1131
+ "financial_impact": 125000.0,
1124
1132
  }
1125
1133
 
1126
1134
 
1127
1135
  class ComplianceStatusAnalyzer:
1128
1136
  """Analyze compliance status across multiple frameworks."""
1129
-
1137
+
1130
1138
  def __init__(self, session: boto3.Session):
1131
1139
  self.session = session
1132
-
1140
+
1133
1141
  async def get_soc2_compliance_score(self) -> float:
1134
1142
  """Get SOC 2 compliance percentage."""
1135
1143
  # In production, this would integrate with compliance management tools
1136
1144
  return 94.0
1137
-
1145
+
1138
1146
  async def get_pci_dss_compliance_score(self) -> float:
1139
1147
  """Get PCI DSS compliance percentage."""
1140
1148
  # In production, this would integrate with PCI compliance tools
1141
1149
  return 96.0
1142
-
1150
+
1143
1151
  async def get_hipaa_compliance_score(self) -> float:
1144
1152
  """Get HIPAA compliance percentage."""
1145
1153
  # In production, this would integrate with HIPAA compliance tools
1146
1154
  return 91.0
1147
-
1155
+
1148
1156
  async def get_aws_well_architected_score(self) -> float:
1149
1157
  """Get AWS Well-Architected Security pillar score."""
1150
1158
  # In production, this would use AWS Well-Architected Tool API
@@ -1153,17 +1161,17 @@ class ComplianceStatusAnalyzer:
1153
1161
 
1154
1162
  class SecurityROICalculator:
1155
1163
  """Calculate ROI for security investments."""
1156
-
1164
+
1157
1165
  def calculate_automation_platform_roi(self) -> Dict[str, Any]:
1158
1166
  """Calculate ROI for security automation platform."""
1159
1167
  # Complex ROI calculation would be implemented here
1160
1168
  return {}
1161
-
1169
+
1162
1170
  def calculate_zero_trust_roi(self) -> Dict[str, Any]:
1163
1171
  """Calculate ROI for zero trust architecture."""
1164
1172
  # Complex ROI calculation would be implemented here
1165
1173
  return {}
1166
-
1174
+
1167
1175
  def calculate_cloud_security_roi(self) -> Dict[str, Any]:
1168
1176
  """Calculate ROI for cloud security platform."""
1169
1177
  # Complex ROI calculation would be implemented here
@@ -1172,7 +1180,7 @@ class SecurityROICalculator:
1172
1180
 
1173
1181
  class IndustryBenchmarkAnalyzer:
1174
1182
  """Analyze security metrics against industry benchmarks."""
1175
-
1183
+
1176
1184
  async def get_industry_benchmarks(self) -> Dict[str, float]:
1177
1185
  """Get industry benchmark data for comparison."""
1178
1186
  # In production, this would integrate with industry benchmark services
@@ -1181,20 +1189,20 @@ class IndustryBenchmarkAnalyzer:
1181
1189
  "Mean Time to Detection": 12.0,
1182
1190
  "Mean Time to Remediation": 48.0,
1183
1191
  "Security Automation Rate": 45.0,
1184
- "Compliance Score Average": 82.0
1192
+ "Compliance Score Average": 82.0,
1185
1193
  }
1186
1194
 
1187
1195
 
1188
1196
  class ExecutiveReportGenerator:
1189
1197
  """Generate executive reports and presentations."""
1190
-
1198
+
1191
1199
  def __init__(self, output_dir: Path):
1192
1200
  self.output_dir = output_dir
1193
1201
 
1194
1202
 
1195
1203
  class SecurityVisualizationEngine:
1196
1204
  """Generate security visualizations for executive reporting."""
1197
-
1205
+
1198
1206
  def __init__(self):
1199
1207
  pass
1200
1208
 
@@ -1202,46 +1210,49 @@ class SecurityVisualizationEngine:
1202
1210
  # CLI integration for executive security dashboard
1203
1211
  if __name__ == "__main__":
1204
1212
  import argparse
1205
-
1206
- parser = argparse.ArgumentParser(description='Executive Security Dashboard')
1207
- parser.add_argument('--profile', default='default', help='AWS profile to use')
1208
- parser.add_argument('--period', choices=['monthly', 'quarterly', 'annual'],
1209
- default='monthly', help='Reporting period')
1210
- parser.add_argument('--risk-appetite', choices=['very_low', 'low', 'moderate', 'high', 'very_high'],
1211
- default='moderate', help='Business risk appetite')
1212
- parser.add_argument('--board-presentation', action='store_true', help='Generate board presentation')
1213
- parser.add_argument('--include-benchmarks', action='store_true', default=True, help='Include industry benchmarks')
1214
- parser.add_argument('--output-dir', default='./artifacts/executive-security', help='Output directory')
1215
-
1213
+
1214
+ parser = argparse.ArgumentParser(description="Executive Security Dashboard")
1215
+ parser.add_argument("--profile", default="default", help="AWS profile to use")
1216
+ parser.add_argument(
1217
+ "--period", choices=["monthly", "quarterly", "annual"], default="monthly", help="Reporting period"
1218
+ )
1219
+ parser.add_argument(
1220
+ "--risk-appetite",
1221
+ choices=["very_low", "low", "moderate", "high", "very_high"],
1222
+ default="moderate",
1223
+ help="Business risk appetite",
1224
+ )
1225
+ parser.add_argument("--board-presentation", action="store_true", help="Generate board presentation")
1226
+ parser.add_argument("--include-benchmarks", action="store_true", default=True, help="Include industry benchmarks")
1227
+ parser.add_argument("--output-dir", default="./artifacts/executive-security", help="Output directory")
1228
+
1216
1229
  args = parser.parse_args()
1217
-
1230
+
1218
1231
  # Map risk appetite
1219
1232
  risk_mapping = {
1220
- 'very_low': RiskAppetite.VERY_LOW,
1221
- 'low': RiskAppetite.LOW,
1222
- 'moderate': RiskAppetite.MODERATE,
1223
- 'high': RiskAppetite.HIGH,
1224
- 'very_high': RiskAppetite.VERY_HIGH
1233
+ "very_low": RiskAppetite.VERY_LOW,
1234
+ "low": RiskAppetite.LOW,
1235
+ "moderate": RiskAppetite.MODERATE,
1236
+ "high": RiskAppetite.HIGH,
1237
+ "very_high": RiskAppetite.VERY_HIGH,
1225
1238
  }
1226
-
1239
+
1227
1240
  async def main():
1228
1241
  dashboard = ExecutiveSecurityDashboard(
1229
- profile=args.profile,
1230
- output_dir=args.output_dir,
1231
- risk_appetite=risk_mapping[args.risk_appetite]
1242
+ profile=args.profile, output_dir=args.output_dir, risk_appetite=risk_mapping[args.risk_appetite]
1232
1243
  )
1233
-
1244
+
1234
1245
  report = await dashboard.generate_executive_security_report(
1235
1246
  reporting_period=args.period,
1236
1247
  include_benchmarks=args.include_benchmarks,
1237
- board_presentation=args.board_presentation
1248
+ board_presentation=args.board_presentation,
1238
1249
  )
1239
-
1250
+
1240
1251
  print_success(f"Executive security report generated: {report.report_id}")
1241
1252
  print_info(f"Overall security posture: {report.overall_security_posture_score:.1f}%")
1242
1253
  print_info(f"Security maturity level: {report.security_maturity_level.value.replace('_', ' ').title()}")
1243
1254
  print_info(f"Annual security ROI: {report.annual_security_roi:.1f}%")
1244
1255
  print_info(f"Total security value: ${report.risk_reduction_achieved + report.cost_avoidance_realized:,.0f}")
1245
-
1256
+
1246
1257
  # Run the async main function
1247
- asyncio.run(main())
1258
+ asyncio.run(main())