runbooks 0.7.7__py3-none-any.whl → 0.9.0__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 (157) hide show
  1. runbooks/__init__.py +1 -1
  2. runbooks/base.py +2 -2
  3. runbooks/cfat/README.md +12 -1
  4. runbooks/cfat/__init__.py +8 -4
  5. runbooks/cfat/assessment/collectors.py +171 -14
  6. runbooks/cfat/assessment/compliance.py +546 -522
  7. runbooks/cfat/assessment/runner.py +129 -10
  8. runbooks/cfat/models.py +6 -2
  9. runbooks/common/__init__.py +152 -0
  10. runbooks/common/accuracy_validator.py +1039 -0
  11. runbooks/common/context_logger.py +440 -0
  12. runbooks/common/cross_module_integration.py +594 -0
  13. runbooks/common/enhanced_exception_handler.py +1108 -0
  14. runbooks/common/enterprise_audit_integration.py +634 -0
  15. runbooks/common/logger.py +14 -0
  16. runbooks/common/mcp_integration.py +539 -0
  17. runbooks/common/performance_monitor.py +387 -0
  18. runbooks/common/profile_utils.py +216 -0
  19. runbooks/common/rich_utils.py +622 -0
  20. runbooks/enterprise/__init__.py +68 -0
  21. runbooks/enterprise/error_handling.py +411 -0
  22. runbooks/enterprise/logging.py +439 -0
  23. runbooks/enterprise/multi_tenant.py +583 -0
  24. runbooks/feedback/user_feedback_collector.py +440 -0
  25. runbooks/finops/README.md +129 -14
  26. runbooks/finops/__init__.py +22 -3
  27. runbooks/finops/account_resolver.py +279 -0
  28. runbooks/finops/accuracy_cross_validator.py +638 -0
  29. runbooks/finops/aws_client.py +721 -36
  30. runbooks/finops/budget_integration.py +313 -0
  31. runbooks/finops/cli.py +90 -33
  32. runbooks/finops/cost_processor.py +211 -37
  33. runbooks/finops/dashboard_router.py +900 -0
  34. runbooks/finops/dashboard_runner.py +1334 -399
  35. runbooks/finops/embedded_mcp_validator.py +288 -0
  36. runbooks/finops/enhanced_dashboard_runner.py +526 -0
  37. runbooks/finops/enhanced_progress.py +327 -0
  38. runbooks/finops/enhanced_trend_visualization.py +423 -0
  39. runbooks/finops/finops_dashboard.py +41 -0
  40. runbooks/finops/helpers.py +639 -323
  41. runbooks/finops/iam_guidance.py +400 -0
  42. runbooks/finops/markdown_exporter.py +466 -0
  43. runbooks/finops/multi_dashboard.py +1502 -0
  44. runbooks/finops/optimizer.py +396 -395
  45. runbooks/finops/profile_processor.py +2 -2
  46. runbooks/finops/runbooks.inventory.organizations_discovery.log +0 -0
  47. runbooks/finops/runbooks.security.report_generator.log +0 -0
  48. runbooks/finops/runbooks.security.run_script.log +0 -0
  49. runbooks/finops/runbooks.security.security_export.log +0 -0
  50. runbooks/finops/service_mapping.py +195 -0
  51. runbooks/finops/single_dashboard.py +710 -0
  52. runbooks/finops/tests/__init__.py +19 -0
  53. runbooks/finops/tests/results_test_finops_dashboard.xml +1 -0
  54. runbooks/finops/tests/run_comprehensive_tests.py +421 -0
  55. runbooks/finops/tests/run_tests.py +305 -0
  56. runbooks/finops/tests/test_finops_dashboard.py +705 -0
  57. runbooks/finops/tests/test_integration.py +477 -0
  58. runbooks/finops/tests/test_performance.py +380 -0
  59. runbooks/finops/tests/test_performance_benchmarks.py +500 -0
  60. runbooks/finops/tests/test_reference_images_validation.py +867 -0
  61. runbooks/finops/tests/test_single_account_features.py +715 -0
  62. runbooks/finops/tests/validate_test_suite.py +220 -0
  63. runbooks/finops/types.py +1 -1
  64. runbooks/hitl/enhanced_workflow_engine.py +725 -0
  65. runbooks/inventory/README.md +12 -1
  66. runbooks/inventory/artifacts/scale-optimize-status.txt +12 -0
  67. runbooks/inventory/collectors/aws_comprehensive.py +192 -185
  68. runbooks/inventory/collectors/enterprise_scale.py +281 -0
  69. runbooks/inventory/core/collector.py +299 -12
  70. runbooks/inventory/list_ec2_instances.py +21 -20
  71. runbooks/inventory/list_ssm_parameters.py +31 -3
  72. runbooks/inventory/organizations_discovery.py +1315 -0
  73. runbooks/inventory/rich_inventory_display.py +360 -0
  74. runbooks/inventory/run_on_multi_accounts.py +32 -16
  75. runbooks/inventory/runbooks.security.report_generator.log +0 -0
  76. runbooks/inventory/runbooks.security.run_script.log +0 -0
  77. runbooks/inventory/vpc_flow_analyzer.py +1030 -0
  78. runbooks/main.py +4171 -1615
  79. runbooks/metrics/dora_metrics_engine.py +1293 -0
  80. runbooks/monitoring/performance_monitor.py +433 -0
  81. runbooks/operate/README.md +394 -0
  82. runbooks/operate/__init__.py +2 -2
  83. runbooks/operate/base.py +291 -11
  84. runbooks/operate/deployment_framework.py +1032 -0
  85. runbooks/operate/deployment_validator.py +853 -0
  86. runbooks/operate/dynamodb_operations.py +10 -6
  87. runbooks/operate/ec2_operations.py +321 -11
  88. runbooks/operate/executive_dashboard.py +779 -0
  89. runbooks/operate/mcp_integration.py +750 -0
  90. runbooks/operate/nat_gateway_operations.py +1120 -0
  91. runbooks/operate/networking_cost_heatmap.py +685 -0
  92. runbooks/operate/privatelink_operations.py +940 -0
  93. runbooks/operate/s3_operations.py +10 -6
  94. runbooks/operate/vpc_endpoints.py +644 -0
  95. runbooks/operate/vpc_operations.py +1038 -0
  96. runbooks/remediation/README.md +489 -13
  97. runbooks/remediation/__init__.py +2 -2
  98. runbooks/remediation/acm_remediation.py +1 -1
  99. runbooks/remediation/base.py +1 -1
  100. runbooks/remediation/cloudtrail_remediation.py +1 -1
  101. runbooks/remediation/cognito_remediation.py +1 -1
  102. runbooks/remediation/commons.py +8 -4
  103. runbooks/remediation/dynamodb_remediation.py +1 -1
  104. runbooks/remediation/ec2_remediation.py +1 -1
  105. runbooks/remediation/ec2_unattached_ebs_volumes.py +1 -1
  106. runbooks/remediation/kms_enable_key_rotation.py +1 -1
  107. runbooks/remediation/kms_remediation.py +1 -1
  108. runbooks/remediation/lambda_remediation.py +1 -1
  109. runbooks/remediation/multi_account.py +1 -1
  110. runbooks/remediation/rds_remediation.py +1 -1
  111. runbooks/remediation/s3_block_public_access.py +1 -1
  112. runbooks/remediation/s3_enable_access_logging.py +1 -1
  113. runbooks/remediation/s3_encryption.py +1 -1
  114. runbooks/remediation/s3_remediation.py +1 -1
  115. runbooks/remediation/vpc_remediation.py +475 -0
  116. runbooks/security/ENTERPRISE_SECURITY_FRAMEWORK.md +506 -0
  117. runbooks/security/README.md +12 -1
  118. runbooks/security/__init__.py +166 -33
  119. runbooks/security/compliance_automation.py +634 -0
  120. runbooks/security/compliance_automation_engine.py +1021 -0
  121. runbooks/security/enterprise_security_framework.py +931 -0
  122. runbooks/security/enterprise_security_policies.json +293 -0
  123. runbooks/security/integration_test_enterprise_security.py +879 -0
  124. runbooks/security/module_security_integrator.py +641 -0
  125. runbooks/security/report_generator.py +10 -0
  126. runbooks/security/run_script.py +27 -5
  127. runbooks/security/security_baseline_tester.py +153 -27
  128. runbooks/security/security_export.py +456 -0
  129. runbooks/sre/README.md +472 -0
  130. runbooks/sre/__init__.py +33 -0
  131. runbooks/sre/mcp_reliability_engine.py +1049 -0
  132. runbooks/sre/performance_optimization_engine.py +1032 -0
  133. runbooks/sre/reliability_monitoring_framework.py +1011 -0
  134. runbooks/validation/__init__.py +10 -0
  135. runbooks/validation/benchmark.py +489 -0
  136. runbooks/validation/cli.py +368 -0
  137. runbooks/validation/mcp_validator.py +797 -0
  138. runbooks/vpc/README.md +478 -0
  139. runbooks/vpc/__init__.py +38 -0
  140. runbooks/vpc/config.py +212 -0
  141. runbooks/vpc/cost_engine.py +347 -0
  142. runbooks/vpc/heatmap_engine.py +605 -0
  143. runbooks/vpc/manager_interface.py +649 -0
  144. runbooks/vpc/networking_wrapper.py +1289 -0
  145. runbooks/vpc/rich_formatters.py +693 -0
  146. runbooks/vpc/tests/__init__.py +5 -0
  147. runbooks/vpc/tests/conftest.py +356 -0
  148. runbooks/vpc/tests/test_cli_integration.py +530 -0
  149. runbooks/vpc/tests/test_config.py +458 -0
  150. runbooks/vpc/tests/test_cost_engine.py +479 -0
  151. runbooks/vpc/tests/test_networking_wrapper.py +512 -0
  152. {runbooks-0.7.7.dist-info → runbooks-0.9.0.dist-info}/METADATA +175 -65
  153. {runbooks-0.7.7.dist-info → runbooks-0.9.0.dist-info}/RECORD +157 -60
  154. {runbooks-0.7.7.dist-info → runbooks-0.9.0.dist-info}/entry_points.txt +1 -1
  155. {runbooks-0.7.7.dist-info → runbooks-0.9.0.dist-info}/WHEEL +0 -0
  156. {runbooks-0.7.7.dist-info → runbooks-0.9.0.dist-info}/licenses/LICENSE +0 -0
  157. {runbooks-0.7.7.dist-info → runbooks-0.9.0.dist-info}/top_level.txt +0 -0
@@ -373,9 +373,17 @@ if __name__ == "__main__":
373
373
  logging.getLogger("s3transfer").setLevel(logging.CRITICAL)
374
374
  logging.getLogger("urllib3").setLevel(logging.CRITICAL)
375
375
 
376
- print()
377
- print(f"Checking for instances... ")
378
- print()
376
+ # Import Rich display utilities for professional output
377
+ from runbooks.inventory.rich_inventory_display import (
378
+ create_inventory_progress,
379
+ display_ec2_inventory_results,
380
+ display_inventory_header,
381
+ )
382
+
383
+ # Display professional inventory header
384
+ display_inventory_header(
385
+ "EC2", pProfiles, AccountNum if "AccountNum" in locals() else 0, RegionNum if "RegionNum" in locals() else 0
386
+ )
379
387
 
380
388
  # Find credentials for all Child Accounts
381
389
  # CredentialList = get_credentials(pProfiles, pRegionList, pSkipProfiles, pSkipAccounts, pRootOnly, pAccounts, pAccessRoles, pTiming)
@@ -384,16 +392,15 @@ if __name__ == "__main__":
384
392
  )
385
393
  AccountNum = len(set([acct["AccountId"] for acct in CredentialList]))
386
394
  RegionNum = len(set([acct["Region"] for acct in CredentialList]))
387
- print()
388
- print(f"Searching total of {AccountNum} accounts and {RegionNum} regions")
395
+
396
+ # Update header with actual counts
397
+ display_inventory_header("EC2", pProfiles, AccountNum, RegionNum)
398
+
389
399
  if pTiming:
390
- print()
391
400
  milestone_time1 = time()
392
- print(
393
- f"{Fore.GREEN}\t\tFiguring out what regions are available to your accounts, and capturing credentials for all accounts in those regions took: {(milestone_time1 - begin_time):.3f} seconds{Fore.RESET}"
394
- )
395
- print()
396
- print(f"Now running through all accounts and regions identified to find resources...")
401
+ from runbooks.common.rich_utils import print_info
402
+
403
+ print_info(f"⏱️ Credential discovery completed in {(milestone_time1 - begin_time):.3f} seconds")
397
404
  # Collect all the instances from the credentials found
398
405
  AllInstances = find_all_instances(CredentialList, pStatus)
399
406
  # Display the information we've found thus far
@@ -414,12 +421,6 @@ if __name__ == "__main__":
414
421
  )
415
422
  display_results(sorted_all_instances, display_dict, None, pFilename)
416
423
 
417
- if pTiming:
418
- print(ERASE_LINE)
419
- print(f"{Fore.GREEN}This script took {time() - begin_time:.2f} seconds{Fore.RESET}")
420
- print(ERASE_LINE)
421
-
422
- print(f"Found {len(AllInstances)} instances across {AccountNum} accounts across {RegionNum} regions")
423
- print()
424
- print("Thank you for using this script")
425
- print()
424
+ # Display results using Rich formatting
425
+ timing_info = {"total_time": time() - begin_time} if pTiming else None
426
+ display_ec2_inventory_results(AllInstances, AccountNum, RegionNum, timing_info)
@@ -212,8 +212,23 @@ def find_ssm_parameters(f_credentialList):
212
212
  - Logs authorization issues for security team follow-up
213
213
  """
214
214
  parameter_list = []
215
- print(f"Gathering parameters from {len(f_credentialList)} accounts and regions")
216
- for credential in tqdm(f_credentialList, desc="Gathering SSM Parameters", leave=True):
215
+ # Import Rich display utilities for professional output
216
+ from runbooks.common.rich_utils import console, print_info, print_success
217
+ from runbooks.inventory.rich_inventory_display import create_inventory_progress, display_inventory_header
218
+
219
+ # Calculate operation scope
220
+ account_count = len(set([cred["AccountId"] for cred in f_credentialList]))
221
+ region_count = len(set([cred["Region"] for cred in f_credentialList]))
222
+
223
+ # Display professional header
224
+ display_inventory_header("SSM Parameters", "multi-profile", account_count, region_count)
225
+
226
+ # Create Rich progress bar
227
+ progress = create_inventory_progress(len(f_credentialList), "🔑 Discovering SSM Parameters")
228
+ task = progress.add_task("Processing credentials", total=len(f_credentialList))
229
+ progress.start()
230
+
231
+ for credential in f_credentialList:
217
232
  try:
218
233
  # Call SSM API to discover all parameters in this account/region combination
219
234
  # Note: Parameter stores can contain 10,000+ parameters - this operation may take time
@@ -228,6 +243,15 @@ def find_ssm_parameters(f_credentialList):
228
243
  logging.error(
229
244
  f"Profile {credential['Profile']}: Authorization Failure for account {credential['AccountNumber']}"
230
245
  )
246
+ finally:
247
+ # Update progress
248
+ progress.update(task, advance=1)
249
+
250
+ progress.stop()
251
+
252
+ # Display completion summary
253
+ print_success(f"✅ SSM Parameter discovery completed! Found {len(parameter_list)} parameters total")
254
+
231
255
  return parameter_list
232
256
 
233
257
 
@@ -271,7 +295,11 @@ if __name__ == "__main__":
271
295
  # Define AWS Landing Zone (ALZ) parameter pattern for UUID-based identification
272
296
  # Pattern matches: /UUID/numeric-suffix (e.g., /2ac07efd-153d-4069-b7ad-0d18cc398b11/105)
273
297
  ALZRegex = r"/\w{8,8}-\w{4,4}-\w{4,4}-\w{4,4}-\w{12,12}/\w{3,3}"
274
- print()
298
+ # Import Rich utilities at module level
299
+ from runbooks.common.rich_utils import console, print_header
300
+
301
+ # Display module header
302
+ print_header("SSM Parameter Store Discovery", "0.7.8")
275
303
 
276
304
  # Execute enterprise credential discovery across organizational hierarchy
277
305
  CredentialList = get_all_credentials(