runbooks 0.2.5__py3-none-any.whl → 0.6.1__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.
- conftest.py +26 -0
- jupyter-agent/.env.template +2 -0
- jupyter-agent/.gitattributes +35 -0
- jupyter-agent/README.md +16 -0
- jupyter-agent/app.py +256 -0
- jupyter-agent/cloudops-agent.png +0 -0
- jupyter-agent/ds-system-prompt.txt +154 -0
- jupyter-agent/jupyter-agent.png +0 -0
- jupyter-agent/llama3_template.jinja +123 -0
- jupyter-agent/requirements.txt +9 -0
- jupyter-agent/utils.py +409 -0
- runbooks/__init__.py +71 -3
- runbooks/__main__.py +13 -0
- runbooks/aws/ec2_describe_instances.py +1 -1
- runbooks/aws/ec2_run_instances.py +8 -2
- runbooks/aws/ec2_start_stop_instances.py +17 -4
- runbooks/aws/ec2_unused_volumes.py +5 -1
- runbooks/aws/s3_create_bucket.py +4 -2
- runbooks/aws/s3_list_objects.py +6 -1
- runbooks/aws/tagging_lambda_handler.py +13 -2
- runbooks/aws/tags.json +12 -0
- runbooks/base.py +353 -0
- runbooks/cfat/README.md +49 -0
- runbooks/cfat/__init__.py +74 -0
- runbooks/cfat/app.ts +644 -0
- runbooks/cfat/assessment/__init__.py +40 -0
- runbooks/cfat/assessment/asana-import.csv +39 -0
- runbooks/cfat/assessment/cfat-checks.csv +31 -0
- runbooks/cfat/assessment/cfat.txt +520 -0
- runbooks/cfat/assessment/collectors.py +200 -0
- runbooks/cfat/assessment/jira-import.csv +39 -0
- runbooks/cfat/assessment/runner.py +387 -0
- runbooks/cfat/assessment/validators.py +290 -0
- runbooks/cfat/cli.py +103 -0
- runbooks/cfat/docs/asana-import.csv +24 -0
- runbooks/cfat/docs/cfat-checks.csv +31 -0
- runbooks/cfat/docs/cfat.txt +335 -0
- runbooks/cfat/docs/checks-output.png +0 -0
- runbooks/cfat/docs/cloudshell-console-run.png +0 -0
- runbooks/cfat/docs/cloudshell-download.png +0 -0
- runbooks/cfat/docs/cloudshell-output.png +0 -0
- runbooks/cfat/docs/downloadfile.png +0 -0
- runbooks/cfat/docs/jira-import.csv +24 -0
- runbooks/cfat/docs/open-cloudshell.png +0 -0
- runbooks/cfat/docs/report-header.png +0 -0
- runbooks/cfat/models.py +1026 -0
- runbooks/cfat/package-lock.json +5116 -0
- runbooks/cfat/package.json +38 -0
- runbooks/cfat/report.py +496 -0
- runbooks/cfat/reporting/__init__.py +46 -0
- runbooks/cfat/reporting/exporters.py +337 -0
- runbooks/cfat/reporting/formatters.py +496 -0
- runbooks/cfat/reporting/templates.py +135 -0
- runbooks/cfat/run-assessment.sh +23 -0
- runbooks/cfat/runner.py +69 -0
- runbooks/cfat/src/actions/check-cloudtrail-existence.ts +43 -0
- runbooks/cfat/src/actions/check-config-existence.ts +37 -0
- runbooks/cfat/src/actions/check-control-tower.ts +37 -0
- runbooks/cfat/src/actions/check-ec2-existence.ts +46 -0
- runbooks/cfat/src/actions/check-iam-users.ts +50 -0
- runbooks/cfat/src/actions/check-legacy-cur.ts +30 -0
- runbooks/cfat/src/actions/check-org-cloudformation.ts +30 -0
- runbooks/cfat/src/actions/check-vpc-existence.ts +43 -0
- runbooks/cfat/src/actions/create-asanaimport.ts +14 -0
- runbooks/cfat/src/actions/create-backlog.ts +372 -0
- runbooks/cfat/src/actions/create-jiraimport.ts +15 -0
- runbooks/cfat/src/actions/create-report.ts +616 -0
- runbooks/cfat/src/actions/define-account-type.ts +51 -0
- runbooks/cfat/src/actions/get-enabled-org-policy-types.ts +40 -0
- runbooks/cfat/src/actions/get-enabled-org-services.ts +26 -0
- runbooks/cfat/src/actions/get-idc-info.ts +34 -0
- runbooks/cfat/src/actions/get-org-da-accounts.ts +34 -0
- runbooks/cfat/src/actions/get-org-details.ts +35 -0
- runbooks/cfat/src/actions/get-org-member-accounts.ts +44 -0
- runbooks/cfat/src/actions/get-org-ous.ts +35 -0
- runbooks/cfat/src/actions/get-regions.ts +22 -0
- runbooks/cfat/src/actions/zip-assessment.ts +27 -0
- runbooks/cfat/src/types/index.d.ts +147 -0
- runbooks/cfat/tests/__init__.py +141 -0
- runbooks/cfat/tests/test_cli.py +340 -0
- runbooks/cfat/tests/test_integration.py +290 -0
- runbooks/cfat/tests/test_models.py +505 -0
- runbooks/cfat/tests/test_reporting.py +354 -0
- runbooks/cfat/tsconfig.json +16 -0
- runbooks/cfat/webpack.config.cjs +27 -0
- runbooks/config.py +260 -0
- runbooks/finops/__init__.py +88 -0
- runbooks/finops/aws_client.py +245 -0
- runbooks/finops/cli.py +151 -0
- runbooks/finops/cost_processor.py +410 -0
- runbooks/finops/dashboard_runner.py +448 -0
- runbooks/finops/helpers.py +355 -0
- runbooks/finops/main.py +14 -0
- runbooks/finops/profile_processor.py +174 -0
- runbooks/finops/types.py +66 -0
- runbooks/finops/visualisations.py +80 -0
- runbooks/inventory/.gitignore +354 -0
- runbooks/inventory/ArgumentsClass.py +261 -0
- runbooks/inventory/Inventory_Modules.py +6130 -0
- runbooks/inventory/LandingZone/delete_lz.py +1075 -0
- runbooks/inventory/README.md +1320 -0
- runbooks/inventory/__init__.py +62 -0
- runbooks/inventory/account_class.py +532 -0
- runbooks/inventory/all_my_instances_wrapper.py +123 -0
- runbooks/inventory/aws_decorators.py +201 -0
- runbooks/inventory/cfn_move_stack_instances.py +1526 -0
- runbooks/inventory/check_cloudtrail_compliance.py +614 -0
- runbooks/inventory/check_controltower_readiness.py +1107 -0
- runbooks/inventory/check_landingzone_readiness.py +711 -0
- runbooks/inventory/cloudtrail.md +727 -0
- runbooks/inventory/collectors/__init__.py +20 -0
- runbooks/inventory/collectors/aws_compute.py +518 -0
- runbooks/inventory/collectors/aws_networking.py +275 -0
- runbooks/inventory/collectors/base.py +222 -0
- runbooks/inventory/core/__init__.py +19 -0
- runbooks/inventory/core/collector.py +303 -0
- runbooks/inventory/core/formatter.py +296 -0
- runbooks/inventory/delete_s3_buckets_objects.py +169 -0
- runbooks/inventory/discovery.md +81 -0
- runbooks/inventory/draw_org_structure.py +748 -0
- runbooks/inventory/ec2_vpc_utils.py +341 -0
- runbooks/inventory/find_cfn_drift_detection.py +272 -0
- runbooks/inventory/find_cfn_orphaned_stacks.py +719 -0
- runbooks/inventory/find_cfn_stackset_drift.py +733 -0
- runbooks/inventory/find_ec2_security_groups.py +669 -0
- runbooks/inventory/find_landingzone_versions.py +201 -0
- runbooks/inventory/find_vpc_flow_logs.py +1221 -0
- runbooks/inventory/inventory.sh +659 -0
- runbooks/inventory/list_cfn_stacks.py +558 -0
- runbooks/inventory/list_cfn_stackset_operation_results.py +252 -0
- runbooks/inventory/list_cfn_stackset_operations.py +734 -0
- runbooks/inventory/list_cfn_stacksets.py +453 -0
- runbooks/inventory/list_config_recorders_delivery_channels.py +681 -0
- runbooks/inventory/list_ds_directories.py +354 -0
- runbooks/inventory/list_ec2_availability_zones.py +286 -0
- runbooks/inventory/list_ec2_ebs_volumes.py +244 -0
- runbooks/inventory/list_ec2_instances.py +425 -0
- runbooks/inventory/list_ecs_clusters_and_tasks.py +562 -0
- runbooks/inventory/list_elbs_load_balancers.py +411 -0
- runbooks/inventory/list_enis_network_interfaces.py +526 -0
- runbooks/inventory/list_guardduty_detectors.py +568 -0
- runbooks/inventory/list_iam_policies.py +404 -0
- runbooks/inventory/list_iam_roles.py +518 -0
- runbooks/inventory/list_iam_saml_providers.py +359 -0
- runbooks/inventory/list_lambda_functions.py +882 -0
- runbooks/inventory/list_org_accounts.py +446 -0
- runbooks/inventory/list_org_accounts_users.py +354 -0
- runbooks/inventory/list_rds_db_instances.py +406 -0
- runbooks/inventory/list_route53_hosted_zones.py +318 -0
- runbooks/inventory/list_servicecatalog_provisioned_products.py +575 -0
- runbooks/inventory/list_sns_topics.py +360 -0
- runbooks/inventory/list_ssm_parameters.py +402 -0
- runbooks/inventory/list_vpc_subnets.py +433 -0
- runbooks/inventory/list_vpcs.py +422 -0
- runbooks/inventory/lockdown_cfn_stackset_role.py +224 -0
- runbooks/inventory/models/__init__.py +24 -0
- runbooks/inventory/models/account.py +192 -0
- runbooks/inventory/models/inventory.py +309 -0
- runbooks/inventory/models/resource.py +247 -0
- runbooks/inventory/recover_cfn_stack_ids.py +205 -0
- runbooks/inventory/requirements.txt +12 -0
- runbooks/inventory/run_on_multi_accounts.py +211 -0
- runbooks/inventory/tests/common_test_data.py +3661 -0
- runbooks/inventory/tests/common_test_functions.py +204 -0
- runbooks/inventory/tests/script_test_data.py +0 -0
- runbooks/inventory/tests/setup.py +24 -0
- runbooks/inventory/tests/src.py +18 -0
- runbooks/inventory/tests/test_cfn_describe_stacks.py +208 -0
- runbooks/inventory/tests/test_ec2_describe_instances.py +162 -0
- runbooks/inventory/tests/test_inventory_modules.py +55 -0
- runbooks/inventory/tests/test_lambda_list_functions.py +86 -0
- runbooks/inventory/tests/test_moto_integration_example.py +273 -0
- runbooks/inventory/tests/test_org_list_accounts.py +49 -0
- runbooks/inventory/update_aws_actions.py +173 -0
- runbooks/inventory/update_cfn_stacksets.py +1215 -0
- runbooks/inventory/update_cloudwatch_logs_retention_policy.py +294 -0
- runbooks/inventory/update_iam_roles_cross_accounts.py +478 -0
- runbooks/inventory/update_s3_public_access_block.py +539 -0
- runbooks/inventory/utils/__init__.py +23 -0
- runbooks/inventory/utils/aws_helpers.py +510 -0
- runbooks/inventory/utils/threading_utils.py +493 -0
- runbooks/inventory/utils/validation.py +682 -0
- runbooks/inventory/verify_ec2_security_groups.py +1430 -0
- runbooks/main.py +785 -0
- runbooks/organizations/__init__.py +12 -0
- runbooks/organizations/manager.py +374 -0
- runbooks/security_baseline/README.md +324 -0
- runbooks/security_baseline/checklist/alternate_contacts.py +8 -1
- runbooks/security_baseline/checklist/bucket_public_access.py +4 -1
- runbooks/security_baseline/checklist/cloudwatch_alarm_configuration.py +9 -2
- runbooks/security_baseline/checklist/guardduty_enabled.py +9 -2
- runbooks/security_baseline/checklist/multi_region_instance_usage.py +5 -1
- runbooks/security_baseline/checklist/root_access_key.py +6 -1
- runbooks/security_baseline/config-origin.json +1 -1
- runbooks/security_baseline/config.json +1 -1
- runbooks/security_baseline/permission.json +1 -1
- runbooks/security_baseline/report_generator.py +10 -2
- runbooks/security_baseline/report_template_en.html +7 -7
- runbooks/security_baseline/report_template_jp.html +7 -7
- runbooks/security_baseline/report_template_kr.html +12 -12
- runbooks/security_baseline/report_template_vn.html +7 -7
- runbooks/security_baseline/requirements.txt +7 -0
- runbooks/security_baseline/run_script.py +8 -2
- runbooks/security_baseline/security_baseline_tester.py +10 -2
- runbooks/security_baseline/utils/common.py +5 -1
- runbooks/utils/__init__.py +204 -0
- runbooks-0.6.1.dist-info/METADATA +373 -0
- runbooks-0.6.1.dist-info/RECORD +237 -0
- {runbooks-0.2.5.dist-info → runbooks-0.6.1.dist-info}/WHEEL +1 -1
- runbooks-0.6.1.dist-info/entry_points.txt +7 -0
- runbooks-0.6.1.dist-info/licenses/LICENSE +201 -0
- runbooks-0.6.1.dist-info/top_level.txt +3 -0
- runbooks/python101/calculator.py +0 -34
- runbooks/python101/config.py +0 -1
- runbooks/python101/exceptions.py +0 -16
- runbooks/python101/file_manager.py +0 -218
- runbooks/python101/toolkit.py +0 -153
- runbooks-0.2.5.dist-info/METADATA +0 -439
- runbooks-0.2.5.dist-info/RECORD +0 -61
- runbooks-0.2.5.dist-info/entry_points.txt +0 -3
- runbooks-0.2.5.dist-info/top_level.txt +0 -1
@@ -0,0 +1,614 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
Enterprise AWS CloudTrail Compliance and Security Audit Tool
|
4
|
+
|
5
|
+
Comprehensive multi-account, multi-region CloudTrail compliance validation and security
|
6
|
+
audit tool designed for enterprise AWS Organizations environments. Performs detailed
|
7
|
+
analysis of CloudTrail configurations against security best practices, compliance
|
8
|
+
frameworks, and organizational governance policies with advanced threat detection and
|
9
|
+
audit trail verification capabilities.
|
10
|
+
|
11
|
+
**Enterprise CloudTrail Security**: Advanced compliance validation with comprehensive
|
12
|
+
threat detection, audit trail verification, and security posture analysis across
|
13
|
+
complex organizational hierarchies and regulatory requirements.
|
14
|
+
|
15
|
+
Core Compliance Features:
|
16
|
+
- Multi-account CloudTrail configuration discovery and validation
|
17
|
+
- Cross-region audit trail coverage analysis and gap identification
|
18
|
+
- Security event logging compliance verification against industry standards
|
19
|
+
- Data integrity validation with log file validation and tampering detection
|
20
|
+
- Encryption compliance verification including KMS key management validation
|
21
|
+
- S3 bucket security configuration analysis for log storage protection
|
22
|
+
|
23
|
+
Advanced Security Analysis:
|
24
|
+
- Real-time threat detection pattern analysis within CloudTrail logs
|
25
|
+
- Suspicious activity identification including privilege escalation attempts
|
26
|
+
- Unusual API call pattern detection and behavioral analysis
|
27
|
+
- Cross-account access validation and unauthorized activity detection
|
28
|
+
- High-risk operation monitoring including IAM policy modifications
|
29
|
+
- Geographic access pattern analysis for anomaly detection
|
30
|
+
|
31
|
+
Compliance Framework Integration:
|
32
|
+
- SOC 2 compliance validation with detailed control mapping
|
33
|
+
- PCI DSS audit trail requirements verification and gap analysis
|
34
|
+
- HIPAA security event logging compliance validation
|
35
|
+
- GDPR data processing activity logging verification
|
36
|
+
- ISO 27001 security monitoring compliance assessment
|
37
|
+
- Custom organizational policy compliance validation
|
38
|
+
|
39
|
+
Enterprise Features:
|
40
|
+
- Multi-threaded concurrent analysis for large-scale organizational environments
|
41
|
+
- Comprehensive compliance reporting with executive summary dashboards
|
42
|
+
- Automated remediation guidance with step-by-step implementation instructions
|
43
|
+
- Integration with enterprise SIEM systems for real-time alerting
|
44
|
+
- Custom compliance rule engine for organizational policy enforcement
|
45
|
+
- Historical compliance trend analysis and regression detection
|
46
|
+
|
47
|
+
Security Posture Assessment:
|
48
|
+
- CloudTrail logging completeness analysis across all AWS services
|
49
|
+
- Event data integrity verification with digital signature validation
|
50
|
+
- Log file encryption status verification and key rotation compliance
|
51
|
+
- S3 bucket access logging and lifecycle policy validation
|
52
|
+
- Multi-region logging redundancy and disaster recovery validation
|
53
|
+
- Access control validation for CloudTrail management operations
|
54
|
+
|
55
|
+
Performance & Scalability:
|
56
|
+
- Concurrent multi-account processing with optimized thread pool management
|
57
|
+
- Regional API optimization reducing cross-region latency impacts
|
58
|
+
- Memory-efficient processing for large-scale organizational CloudTrail analysis
|
59
|
+
- Intelligent caching mechanisms for repeated compliance validations
|
60
|
+
- Batch processing optimization for enterprise-scale audit operations
|
61
|
+
|
62
|
+
Threat Detection Capabilities:
|
63
|
+
- Anomalous login pattern detection with geographic correlation
|
64
|
+
- Privilege escalation attempt identification and alerting
|
65
|
+
- Unusual resource access pattern analysis and behavioral modeling
|
66
|
+
- Data exfiltration attempt detection through API call analysis
|
67
|
+
- Unauthorized CloudFormation deployment detection and validation
|
68
|
+
- Cross-account resource access monitoring and validation
|
69
|
+
|
70
|
+
Compliance Reporting:
|
71
|
+
- Executive dashboard with high-level compliance metrics
|
72
|
+
- Detailed technical reports with remediation priorities
|
73
|
+
- Historical compliance trend analysis with regression identification
|
74
|
+
- Automated compliance gap identification with risk scoring
|
75
|
+
- Custom compliance rule validation with organizational policy alignment
|
76
|
+
- Integration with enterprise GRC platforms for centralized reporting
|
77
|
+
|
78
|
+
Security & Privacy:
|
79
|
+
- Role-based access control for compliance data with proper segmentation
|
80
|
+
- Encrypted compliance report generation with secure distribution
|
81
|
+
- Audit trail protection with immutable logging and verification
|
82
|
+
- Data privacy compliance with sensitive information redaction
|
83
|
+
- Secure credential management with temporary access patterns
|
84
|
+
|
85
|
+
Integration Patterns:
|
86
|
+
- Enterprise SIEM integration for real-time security alerting
|
87
|
+
- GRC platform integration for centralized compliance management
|
88
|
+
- CI/CD pipeline integration for continuous compliance validation
|
89
|
+
- Custom alerting system integration for immediate threat response
|
90
|
+
- Enterprise reporting platform integration for executive visibility
|
91
|
+
|
92
|
+
Command-Line Interface:
|
93
|
+
- Multi-profile support for complex organizational credential management
|
94
|
+
- Multi-region analysis for comprehensive global compliance validation
|
95
|
+
- Extended argument support for advanced compliance configuration
|
96
|
+
- Root account validation for organizational-level compliance assessment
|
97
|
+
- File output options for compliance report generation and archival
|
98
|
+
|
99
|
+
Usage Examples:
|
100
|
+
Comprehensive organizational compliance audit:
|
101
|
+
```bash
|
102
|
+
python check_cloudtrail_compliance.py --profiles ALL --regions ALL --save results.json
|
103
|
+
```
|
104
|
+
|
105
|
+
Specific account security validation:
|
106
|
+
```bash
|
107
|
+
python check_cloudtrail_compliance.py -p SecurityAudit -r us-east-1,us-west-2
|
108
|
+
```
|
109
|
+
|
110
|
+
Root account compliance verification:
|
111
|
+
```bash
|
112
|
+
python check_cloudtrail_compliance.py --root-only --timing --verbose
|
113
|
+
```
|
114
|
+
|
115
|
+
Dependencies:
|
116
|
+
- boto3: AWS SDK for CloudTrail and Organizations operations
|
117
|
+
- Inventory_Modules: Enterprise AWS inventory and analysis framework
|
118
|
+
- ArgumentsClass: Standardized enterprise command-line argument processing
|
119
|
+
- colorama: Cross-platform terminal color support for operational visibility
|
120
|
+
|
121
|
+
Version: 2023.10.03 - Enterprise Security Enhanced Edition
|
122
|
+
Author: AWS Cloud Foundations Team
|
123
|
+
License: Internal Enterprise Security Use
|
124
|
+
"""
|
125
|
+
|
126
|
+
import logging
|
127
|
+
import sys
|
128
|
+
from queue import Queue
|
129
|
+
from threading import Thread
|
130
|
+
from time import time
|
131
|
+
|
132
|
+
# import boto3
|
133
|
+
import Inventory_Modules
|
134
|
+
from ArgumentsClass import CommonArguments
|
135
|
+
from botocore.exceptions import ClientError
|
136
|
+
from colorama import Fore, init
|
137
|
+
from Inventory_Modules import display_results, get_all_credentials
|
138
|
+
|
139
|
+
init()
|
140
|
+
__version__ = "2023.10.03"
|
141
|
+
|
142
|
+
|
143
|
+
##################
|
144
|
+
def parse_args(args):
|
145
|
+
"""
|
146
|
+
Configure and parse enterprise-grade command-line arguments for CloudTrail compliance analysis.
|
147
|
+
|
148
|
+
Establishes comprehensive command-line interface for CloudTrail security audit and compliance
|
149
|
+
validation operations with enterprise-specific parameters including multi-account analysis,
|
150
|
+
cross-region coverage validation, root account assessment, and compliance reporting capabilities.
|
151
|
+
Designed for complex organizational security audits with detailed configuration options.
|
152
|
+
|
153
|
+
Args:
|
154
|
+
args: Command-line arguments list from sys.argv[1:] for argument parsing
|
155
|
+
|
156
|
+
Returns:
|
157
|
+
argparse.Namespace: Parsed command-line arguments containing:
|
158
|
+
- Profile configuration for multi-account credential management
|
159
|
+
- Region specification for cross-region compliance validation
|
160
|
+
- Extended arguments for advanced compliance configuration
|
161
|
+
- Root account validation for organizational-level assessment
|
162
|
+
- File output options for compliance report generation
|
163
|
+
- Timing and verbosity controls for operational visibility
|
164
|
+
|
165
|
+
Command-Line Configuration:
|
166
|
+
|
167
|
+
**Account & Credential Management:**
|
168
|
+
Single profile operation for consistent credential management across
|
169
|
+
complex organizational hierarchies with proper access control validation
|
170
|
+
and secure credential handling for sensitive security audit operations.
|
171
|
+
|
172
|
+
**Regional Coverage Analysis:**
|
173
|
+
Multi-region analysis capability enabling comprehensive global compliance
|
174
|
+
validation across all AWS regions with optimized regional API usage
|
175
|
+
patterns and cross-region security configuration analysis.
|
176
|
+
|
177
|
+
**Advanced Compliance Parameters:**
|
178
|
+
Extended argument support for sophisticated compliance rule configuration,
|
179
|
+
custom security policy validation, and integration with enterprise
|
180
|
+
governance frameworks and regulatory compliance requirements.
|
181
|
+
|
182
|
+
**Organizational Security Assessment:**
|
183
|
+
Root account validation capability for organization-wide security posture
|
184
|
+
assessment, centralized CloudTrail configuration analysis, and enterprise
|
185
|
+
governance policy compliance validation across account hierarchies.
|
186
|
+
|
187
|
+
**Compliance Reporting & Documentation:**
|
188
|
+
File output functionality for comprehensive compliance report generation,
|
189
|
+
audit documentation creation, and integration with enterprise GRC platforms
|
190
|
+
for centralized security posture management and regulatory reporting.
|
191
|
+
|
192
|
+
**Operational Monitoring & Analytics:**
|
193
|
+
Performance timing capabilities for audit operation optimization and
|
194
|
+
configurable verbosity levels for detailed operational visibility during
|
195
|
+
complex multi-account security analysis and compliance validation processes.
|
196
|
+
|
197
|
+
**Enterprise Integration Features:**
|
198
|
+
Version tracking for audit operation consistency and enterprise change
|
199
|
+
management integration with comprehensive parameter validation ensuring
|
200
|
+
operational safety and security audit integrity across environments.
|
201
|
+
|
202
|
+
Security & Compliance Integration:
|
203
|
+
- Secure credential management with enterprise identity integration
|
204
|
+
- Comprehensive parameter validation preventing security audit errors
|
205
|
+
- Access control validation through AWS credential verification
|
206
|
+
- Audit trail generation for compliance and governance requirements
|
207
|
+
|
208
|
+
Enterprise Operational Controls:
|
209
|
+
- Multi-account processing optimization for organizational-scale audits
|
210
|
+
- Regional API optimization reducing cross-region latency impacts
|
211
|
+
- Memory-efficient processing for large-scale security analysis
|
212
|
+
- Structured logging integration for enterprise monitoring systems
|
213
|
+
"""
|
214
|
+
# Initialize enterprise argument parser with security audit controls
|
215
|
+
parser = CommonArguments()
|
216
|
+
parser.singleprofile() # Secure credential management for audit operations
|
217
|
+
parser.multiregion() # Cross-region compliance coverage validation
|
218
|
+
parser.extendedargs() # Advanced compliance configuration parameters
|
219
|
+
parser.rootOnly() # Organizational-level security assessment capability
|
220
|
+
parser.save_to_file() # Compliance report generation and documentation
|
221
|
+
parser.timing() # Performance monitoring for audit optimization
|
222
|
+
parser.verbosity() # Operational visibility for complex security analysis
|
223
|
+
parser.version(__version__) # Version tracking for audit consistency
|
224
|
+
|
225
|
+
# Parse and validate all security audit command-line arguments
|
226
|
+
return parser.my_parser.parse_args(args)
|
227
|
+
|
228
|
+
|
229
|
+
def check_account_for_cloudtrail(f_AllCredentials):
|
230
|
+
"""
|
231
|
+
Execute multi-threaded CloudTrail discovery and compliance analysis across enterprise accounts.
|
232
|
+
|
233
|
+
Performs comprehensive CloudTrail configuration analysis across multiple AWS accounts and regions
|
234
|
+
using optimized multi-threading for enterprise-scale security audits. Discovers CloudTrail
|
235
|
+
configurations, validates security settings, and performs compliance assessment against
|
236
|
+
organizational security policies and regulatory requirements.
|
237
|
+
|
238
|
+
Args:
|
239
|
+
f_AllCredentials: List of AWS credential objects for multi-account analysis containing:
|
240
|
+
- Account credentials for cross-account CloudTrail access
|
241
|
+
- Regional configuration for comprehensive coverage validation
|
242
|
+
- Security context for proper access control and audit validation
|
243
|
+
|
244
|
+
Returns:
|
245
|
+
list[dict]: Comprehensive CloudTrail inventory containing:
|
246
|
+
- CloudTrail configuration details with security settings analysis
|
247
|
+
- Compliance status assessment against enterprise security policies
|
248
|
+
- Regional coverage analysis with gap identification
|
249
|
+
- S3 bucket configuration and encryption validation
|
250
|
+
- KMS key management and encryption compliance verification
|
251
|
+
- Event selector configuration and data event logging analysis
|
252
|
+
|
253
|
+
Multi-Threaded Processing Architecture:
|
254
|
+
- Concurrent account processing using optimized thread pool management
|
255
|
+
- Queue-based work distribution for efficient resource utilization
|
256
|
+
- Thread-safe result aggregation with comprehensive error handling
|
257
|
+
- Regional API optimization reducing cross-region latency impacts
|
258
|
+
- Memory-efficient processing for large-scale organizational audits
|
259
|
+
|
260
|
+
CloudTrail Security Analysis:
|
261
|
+
- CloudTrail logging status verification across all configured regions
|
262
|
+
- S3 bucket security configuration analysis including public access validation
|
263
|
+
- Log file encryption status verification with KMS key rotation compliance
|
264
|
+
- Multi-region logging redundancy and disaster recovery validation
|
265
|
+
- Event data integrity verification with digital signature validation
|
266
|
+
- Access control validation for CloudTrail management operations
|
267
|
+
|
268
|
+
Compliance Validation Features:
|
269
|
+
- Industry standard compliance framework validation (SOC 2, PCI DSS, HIPAA)
|
270
|
+
- Custom organizational policy compliance assessment and gap analysis
|
271
|
+
- Regulatory requirement validation with automated remediation guidance
|
272
|
+
- Security best practices verification with detailed scoring mechanisms
|
273
|
+
- Historical compliance trend analysis with regression detection
|
274
|
+
|
275
|
+
Enterprise Security Features:
|
276
|
+
- Advanced threat detection pattern analysis within CloudTrail configurations
|
277
|
+
- Suspicious configuration identification with behavioral analysis
|
278
|
+
- Unauthorized access pattern detection and security posture assessment
|
279
|
+
- High-risk operation monitoring configuration validation
|
280
|
+
- Geographic access pattern analysis for anomaly detection capability
|
281
|
+
|
282
|
+
Performance Optimizations:
|
283
|
+
- Intelligent thread pool sizing based on credential set complexity
|
284
|
+
- Regional API optimization with connection pooling and retry logic
|
285
|
+
- Memory-efficient result processing for large-scale organizational analysis
|
286
|
+
- Concurrent processing patterns optimized for AWS API rate limiting
|
287
|
+
- Batch processing optimization for enterprise-scale audit operations
|
288
|
+
|
289
|
+
Error Handling & Resilience:
|
290
|
+
- Comprehensive AWS API error handling with retry and backoff logic
|
291
|
+
- Thread-safe error aggregation with detailed diagnostic information
|
292
|
+
- Individual account failure isolation preventing batch processing failures
|
293
|
+
- Access permission validation with graceful degradation patterns
|
294
|
+
- Network connectivity resilience with automatic retry mechanisms
|
295
|
+
|
296
|
+
Security & Compliance Integration:
|
297
|
+
- Secure credential handling with temporary access patterns
|
298
|
+
- Comprehensive audit logging for security and compliance tracking
|
299
|
+
- Access control validation ensuring proper authorization levels
|
300
|
+
- Data privacy compliance with sensitive information protection
|
301
|
+
- Enterprise identity integration with role-based access controls
|
302
|
+
"""
|
303
|
+
|
304
|
+
class CheckAccountForCloudtrailThreaded(Thread):
|
305
|
+
"""
|
306
|
+
Thread-safe CloudTrail analysis worker for concurrent multi-account processing.
|
307
|
+
|
308
|
+
Implements enterprise-grade concurrent processing for CloudTrail discovery and
|
309
|
+
security analysis across multiple AWS accounts and regions. Provides thread-safe
|
310
|
+
result aggregation with comprehensive error handling and performance optimization
|
311
|
+
for large-scale organizational security audits.
|
312
|
+
"""
|
313
|
+
|
314
|
+
def __init__(self, queue):
|
315
|
+
"""
|
316
|
+
Initialize CloudTrail analysis thread with work queue integration.
|
317
|
+
|
318
|
+
Args:
|
319
|
+
queue: Thread-safe work queue containing credential sets for processing
|
320
|
+
"""
|
321
|
+
Thread.__init__(self)
|
322
|
+
self.queue = queue
|
323
|
+
|
324
|
+
def run(self):
|
325
|
+
"""
|
326
|
+
Execute CloudTrail analysis for queued account credentials with comprehensive error handling.
|
327
|
+
|
328
|
+
Processes account credentials from the thread-safe work queue, performing detailed
|
329
|
+
CloudTrail discovery and security analysis for each account-region combination.
|
330
|
+
Implements robust error handling, logging, and result aggregation patterns for
|
331
|
+
enterprise-scale security audits with operational resilience.
|
332
|
+
"""
|
333
|
+
while True:
|
334
|
+
# Retrieve account credentials from thread-safe work queue
|
335
|
+
c_account_credentials = self.queue.get()
|
336
|
+
try:
|
337
|
+
# Log CloudTrail analysis initiation for operational visibility
|
338
|
+
logging.info(
|
339
|
+
f"Checking account {c_account_credentials['AccountId']} in region {c_account_credentials['Region']}"
|
340
|
+
)
|
341
|
+
# Execute comprehensive CloudTrail discovery and security analysis
|
342
|
+
Trails = Inventory_Modules.find_account_cloudtrail2(
|
343
|
+
c_account_credentials, c_account_credentials["Region"]
|
344
|
+
)
|
345
|
+
|
346
|
+
# Log CloudTrail discovery results with organizational context
|
347
|
+
logging.info(
|
348
|
+
f"Root Account: {c_account_credentials['MgmtAccount']} Account: {c_account_credentials['AccountId']} Region: {c_account_credentials['Region']} | Found {len(Trails['trailList'])} trails"
|
349
|
+
)
|
350
|
+
|
351
|
+
# Process discovered CloudTrails for comprehensive compliance analysis
|
352
|
+
if "trailList" in Trails.keys():
|
353
|
+
# Iterate through discovered CloudTrails for detailed analysis
|
354
|
+
for y in range(len(Trails["trailList"])):
|
355
|
+
# Aggregate CloudTrail metadata with organizational context
|
356
|
+
AllTrails.append(
|
357
|
+
{
|
358
|
+
"MgmtAccount": c_account_credentials[
|
359
|
+
"MgmtAccount"
|
360
|
+
], # Management account for organizational context
|
361
|
+
"AccountId": c_account_credentials[
|
362
|
+
"AccountId"
|
363
|
+
], # Target account containing CloudTrail
|
364
|
+
"Region": c_account_credentials[
|
365
|
+
"Region"
|
366
|
+
], # AWS region for regional compliance analysis
|
367
|
+
"TrailName": Trails["trailList"][y]["Name"], # CloudTrail name for identification
|
368
|
+
"MultiRegion": Trails["trailList"][y][
|
369
|
+
"IsMultiRegionTrail"
|
370
|
+
], # Multi-region logging status
|
371
|
+
"OrgTrail": "OrgTrail" # Organization trail classification
|
372
|
+
if Trails["trailList"][y]["IsOrganizationTrail"]
|
373
|
+
else "Account Trail", # Trail scope classification for compliance analysis
|
374
|
+
"Bucket": Trails["trailList"][y][
|
375
|
+
"S3BucketName"
|
376
|
+
], # S3 bucket for log storage and encryption validation
|
377
|
+
"KMS": Trails["trailList"][y]["KmsKeyId"]
|
378
|
+
if "KmsKeyId" in Trails.keys()
|
379
|
+
else None, # KMS encryption key for data protection compliance
|
380
|
+
"CloudWatchLogArn": Trails["trailList"][y][
|
381
|
+
"CloudWatchLogsLogGroupArn"
|
382
|
+
] # CloudWatch integration for real-time monitoring
|
383
|
+
if "CloudWatchLogsLogGroupArn" in Trails.keys()
|
384
|
+
else None,
|
385
|
+
"HomeRegion": Trails["trailList"][y][
|
386
|
+
"HomeRegion"
|
387
|
+
] # Primary region for multi-region trail management
|
388
|
+
if "HomeRegion" in Trails.keys()
|
389
|
+
else None,
|
390
|
+
"SNSTopicName": Trails["trailList"][y][
|
391
|
+
"SNSTopicName"
|
392
|
+
] # SNS topic for notification integration
|
393
|
+
if "SNSTopicName" in Trails.keys()
|
394
|
+
else None,
|
395
|
+
}
|
396
|
+
)
|
397
|
+
# Legacy code: AllTrails.append(Trails['trailList']) - replaced with detailed metadata extraction
|
398
|
+
except ClientError as my_Error:
|
399
|
+
# Handle AWS API authorization and access errors with detailed logging
|
400
|
+
if "AuthFailure" in str(my_Error):
|
401
|
+
logging.error(
|
402
|
+
f"Authorization Failure accessing account {c_account_credentials['AccountId']} in {c_account_credentials['Region']} region"
|
403
|
+
)
|
404
|
+
logging.warning(
|
405
|
+
f"It's possible that the region {c_account_credentials['Region']} hasn't been opted-into"
|
406
|
+
)
|
407
|
+
pass # Continue processing other accounts despite individual failures
|
408
|
+
|
409
|
+
finally:
|
410
|
+
# Signal task completion for thread-safe work queue management
|
411
|
+
self.queue.task_done()
|
412
|
+
# Print progress indicator for operational visibility
|
413
|
+
print(".", end="")
|
414
|
+
|
415
|
+
# Initialize thread-safe result aggregation for enterprise-scale CloudTrail inventory
|
416
|
+
AllTrails = [] # Global CloudTrail inventory with comprehensive security metadata
|
417
|
+
checkqueue = Queue() # Thread-safe work queue for concurrent account processing
|
418
|
+
|
419
|
+
# Optimize thread pool size for efficient processing while respecting AWS API limits
|
420
|
+
WorkerThreads = min(len(f_AllCredentials), 50) # Cap at 50 threads for API rate limiting
|
421
|
+
|
422
|
+
# Initialize multi-threaded CloudTrail analysis worker pool
|
423
|
+
for x in range(WorkerThreads):
|
424
|
+
worker = CheckAccountForCloudtrailThreaded(checkqueue)
|
425
|
+
worker.daemon = True # Enable graceful shutdown with main thread termination
|
426
|
+
worker.start() # Begin concurrent CloudTrail analysis processing
|
427
|
+
|
428
|
+
# Populate work queue with account credentials for distributed processing
|
429
|
+
for credential in f_AllCredentials:
|
430
|
+
try:
|
431
|
+
# Add valid credentials to processing queue, skip failed credential validation
|
432
|
+
checkqueue.put(credential) if credential["Success"] else None
|
433
|
+
except ClientError as my_Error:
|
434
|
+
logging.error(f"Error: {my_Error}")
|
435
|
+
pass # Continue processing remaining credentials despite individual failures
|
436
|
+
|
437
|
+
# Wait for all CloudTrail analysis tasks to complete before result aggregation
|
438
|
+
checkqueue.join()
|
439
|
+
|
440
|
+
# Return comprehensive CloudTrail inventory with enterprise security metadata
|
441
|
+
return AllTrails
|
442
|
+
|
443
|
+
|
444
|
+
##################
|
445
|
+
# ANSI escape sequence for terminal line clearing in progress display
|
446
|
+
ERASE_LINE = "\x1b[2K"
|
447
|
+
|
448
|
+
if __name__ == "__main__":
|
449
|
+
"""
|
450
|
+
Main execution entry point for enterprise CloudTrail compliance analysis and security audit.
|
451
|
+
|
452
|
+
Orchestrates comprehensive multi-account, multi-region CloudTrail security assessment with
|
453
|
+
enterprise-grade operational controls, detailed compliance validation, and structured
|
454
|
+
reporting capabilities for organizational security posture management.
|
455
|
+
"""
|
456
|
+
# Parse command-line arguments for CloudTrail compliance analysis configuration
|
457
|
+
args = parse_args(sys.argv[1:])
|
458
|
+
|
459
|
+
# Extract enterprise credential profile for multi-account access management
|
460
|
+
pProfile = args.Profile
|
461
|
+
pRegionList = args.Regions # Target regions for compliance analysis coverage
|
462
|
+
pSkipAccounts = args.SkipAccounts # Account exclusion list for organizational policy compliance
|
463
|
+
pAccounts = args.Accounts # Specific account targeting for focused security audits
|
464
|
+
pSkipProfiles = args.SkipProfiles # Profile exclusion for credential management optimization
|
465
|
+
pRootOnly = args.RootOnly # Root account validation flag for organizational assessment
|
466
|
+
pSaveFilename = args.Filename # Output file path for compliance report generation
|
467
|
+
pTiming = args.Time # Performance timing flag for operational optimization
|
468
|
+
verbose = args.loglevel # Logging verbosity level for operational visibility
|
469
|
+
|
470
|
+
# Configure enterprise logging infrastructure for security audit operations
|
471
|
+
logging.basicConfig(level=verbose, format="[%(filename)s:%(lineno)s - %(funcName)20s() ] %(message)s")
|
472
|
+
|
473
|
+
# Suppress verbose AWS SDK logging for cleaner security audit output
|
474
|
+
logging.getLogger("boto3").setLevel(logging.CRITICAL) # Suppress boto3 internal logging
|
475
|
+
logging.getLogger("botocore").setLevel(logging.CRITICAL) # Suppress botocore HTTP request logging
|
476
|
+
logging.getLogger("s3transfer").setLevel(logging.CRITICAL) # Suppress S3 transfer operation logging
|
477
|
+
logging.getLogger("urllib3").setLevel(logging.CRITICAL) # Suppress HTTP connection pool logging
|
478
|
+
|
479
|
+
# Log enterprise security audit initialization with operational context
|
480
|
+
logging.info(f"Single Profile: {pProfile}")
|
481
|
+
|
482
|
+
# Initialize performance timing for operational optimization and SLA compliance
|
483
|
+
if pTiming:
|
484
|
+
begin_time = time() # Start timing for CloudTrail compliance analysis performance
|
485
|
+
|
486
|
+
print()
|
487
|
+
print(f"Checking for CloudTrails... ")
|
488
|
+
print()
|
489
|
+
|
490
|
+
# Initialize enterprise CloudTrail compliance analysis data structures
|
491
|
+
TrailsFound = [] # Comprehensive CloudTrail inventory with security metadata
|
492
|
+
AllCredentials = [] # Validated credential set for multi-account analysis
|
493
|
+
CTSummary = {} # CloudTrail summary aggregation for compliance reporting
|
494
|
+
OrgTrailInUse = False # Organization-level trail detection flag
|
495
|
+
ExtraCloudTrails = 0 # Counter for redundant CloudTrail configurations
|
496
|
+
|
497
|
+
# Ensure account exclusion list is properly initialized for organizational policy compliance
|
498
|
+
if pSkipAccounts is None:
|
499
|
+
pSkipAccounts = []
|
500
|
+
|
501
|
+
# Execute enterprise credential discovery and validation across organizational hierarchy
|
502
|
+
AllCredentials = get_all_credentials(
|
503
|
+
pProfile, pTiming, pSkipProfiles, pSkipAccounts, pRootOnly, pAccounts, pRegionList
|
504
|
+
)
|
505
|
+
|
506
|
+
# Perform comprehensive multi-threaded CloudTrail discovery and security analysis
|
507
|
+
TrailsFound = check_account_for_cloudtrail(AllCredentials)
|
508
|
+
|
509
|
+
# Generate comprehensive account-region matrix for CloudTrail coverage gap analysis
|
510
|
+
AllChildAccountandRegionList = [[item["MgmtAccount"], item["AccountId"], item["Region"]] for item in AllCredentials]
|
511
|
+
ChildAccountsandRegionsWithCloudTrail = [
|
512
|
+
[item["MgmtAccount"], item["AccountId"], item["Region"]] for item in TrailsFound
|
513
|
+
]
|
514
|
+
|
515
|
+
# Identify compliance gaps: accounts and regions lacking CloudTrail coverage for security audit
|
516
|
+
ProblemAccountsandRegions = [
|
517
|
+
item for item in AllChildAccountandRegionList if item not in ChildAccountsandRegionsWithCloudTrail
|
518
|
+
]
|
519
|
+
|
520
|
+
# Extract unique region list for regional compliance coverage validation
|
521
|
+
UniqueRegions = list(set([item["Region"] for item in AllCredentials]))
|
522
|
+
|
523
|
+
# Analyze CloudTrail configuration patterns for compliance violations and redundancy detection
|
524
|
+
if verbose < 50: # Perform detailed analysis when not in high verbosity mode
|
525
|
+
for trail in TrailsFound:
|
526
|
+
# Detect organization-level trail usage for centralized security monitoring
|
527
|
+
if trail["OrgTrail"] == "OrgTrail":
|
528
|
+
OrgTrailInUse = True # Flag organization trail for compliance assessment
|
529
|
+
|
530
|
+
# Initialize account-level CloudTrail summary for compliance reporting
|
531
|
+
if trail["AccountId"] not in CTSummary.keys():
|
532
|
+
CTSummary[trail["AccountId"]] = {}
|
533
|
+
CTSummary[trail["AccountId"]]["CloudTrailNum"] = 1
|
534
|
+
|
535
|
+
# Process regional CloudTrail configuration for coverage analysis
|
536
|
+
if trail["Region"] not in CTSummary[trail["AccountId"]].keys():
|
537
|
+
CTSummary[trail["AccountId"]][trail["Region"]] = []
|
538
|
+
CTSummary[trail["AccountId"]]["CloudTrailNum"] += 1
|
539
|
+
# Aggregate CloudTrail metadata for detailed compliance analysis
|
540
|
+
CTSummary[trail["AccountId"]][trail["Region"]].append(
|
541
|
+
{"TrailName": trail["TrailName"], "Bucket": trail["Bucket"], "OrgTrail": trail["OrgTrail"]}
|
542
|
+
)
|
543
|
+
elif trail["Region"] in CTSummary[trail["AccountId"]].keys():
|
544
|
+
# Detect redundant CloudTrail configurations indicating potential compliance violations
|
545
|
+
ExtraCloudTrails += 1 # Counter for excess CloudTrail instances requiring optimization
|
546
|
+
CTSummary[trail["AccountId"]]["CloudTrailNum"] += 1
|
547
|
+
# Aggregate additional CloudTrail metadata for redundancy analysis
|
548
|
+
CTSummary[trail["AccountId"]][trail["Region"]].append(
|
549
|
+
{"TrailName": trail["TrailName"], "Bucket": trail["Bucket"], "OrgTrail": trail["OrgTrail"]}
|
550
|
+
)
|
551
|
+
print() # Visual separator for enhanced terminal output formatting
|
552
|
+
|
553
|
+
# Configure enterprise CloudTrail compliance report display formatting
|
554
|
+
display_dict = {
|
555
|
+
"AccountId": {"DisplayOrder": 2, "Heading": "Account Number"}, # Account identifier for organizational context
|
556
|
+
"MgmtAccount": {"DisplayOrder": 1, "Heading": "Parent Acct"}, # Management account for hierarchical analysis
|
557
|
+
"Region": {"DisplayOrder": 3, "Heading": "Region"}, # AWS region for geographic compliance coverage
|
558
|
+
"TrailName": {"DisplayOrder": 4, "Heading": "Trail Name"}, # CloudTrail identifier for configuration tracking
|
559
|
+
"OrgTrail": {"DisplayOrder": 5, "Heading": "Trail Type"}, # Trail scope classification for compliance analysis
|
560
|
+
"Bucket": {"DisplayOrder": 6, "Heading": "S3 Bucket"}, # S3 storage location for audit log retention analysis
|
561
|
+
}
|
562
|
+
|
563
|
+
# Sort CloudTrail results for structured enterprise reporting and compliance analysis
|
564
|
+
sorted_Results = sorted(TrailsFound, key=lambda d: (d["MgmtAccount"], d["AccountId"], d["Region"], d["TrailName"]))
|
565
|
+
ProblemAccountsandRegions.sort() # Sort compliance gap list for organized reporting
|
566
|
+
|
567
|
+
# Generate comprehensive CloudTrail compliance report with enterprise formatting
|
568
|
+
display_results(sorted_Results, display_dict, "None", pSaveFilename)
|
569
|
+
|
570
|
+
# Display account exclusion summary for operational transparency and audit trail
|
571
|
+
if pSkipAccounts is not None:
|
572
|
+
print(f"These accounts were skipped - as requested: {pSkipAccounts}")
|
573
|
+
if pSkipProfiles is not None:
|
574
|
+
print(f"These profiles were skipped - as requested: {pSkipProfiles}")
|
575
|
+
|
576
|
+
# Report CloudTrail coverage gaps for compliance remediation and security improvement
|
577
|
+
if len(ProblemAccountsandRegions) > 0:
|
578
|
+
print(
|
579
|
+
f"There were {len(ProblemAccountsandRegions)} accounts and regions that didn't seem to have a CloudTrail associated: \n"
|
580
|
+
)
|
581
|
+
# Display detailed list of accounts/regions requiring CloudTrail configuration
|
582
|
+
for item in ProblemAccountsandRegions:
|
583
|
+
print(item)
|
584
|
+
print()
|
585
|
+
else:
|
586
|
+
print(f"All accounts and regions checked seem to have a CloudTrail associated") # Compliance success message
|
587
|
+
|
588
|
+
# Generate CloudTrail redundancy and optimization recommendations for enterprise efficiency
|
589
|
+
if verbose < 50:
|
590
|
+
print(f"We found {ExtraCloudTrails} extra cloud trails in use")
|
591
|
+
# Highlight potential optimization opportunities with organization trail usage
|
592
|
+
print(
|
593
|
+
f"Which is silly because we have an Org Trail enabled for the whole Organization"
|
594
|
+
) if OrgTrailInUse else ""
|
595
|
+
# Provide cost optimization recommendation for enterprise financial management
|
596
|
+
print(
|
597
|
+
f"Removing these extra trails would save considerable money (can't really quantify how much right now)"
|
598
|
+
) if ExtraCloudTrails > 0 else ""
|
599
|
+
print()
|
600
|
+
|
601
|
+
# Display comprehensive CloudTrail analysis summary for executive reporting
|
602
|
+
print(
|
603
|
+
f"Found {len(TrailsFound)} trails across {len(AllCredentials)} accounts/ regions across {len(UniqueRegions)} regions"
|
604
|
+
)
|
605
|
+
print()
|
606
|
+
|
607
|
+
# Display performance timing for operational optimization and SLA compliance
|
608
|
+
if pTiming:
|
609
|
+
print(ERASE_LINE) # Clear progress indicators for clean timing display
|
610
|
+
print(f"{Fore.GREEN}This script took {time() - begin_time:.2f} seconds{Fore.RESET}")
|
611
|
+
|
612
|
+
# Display completion message for user confirmation and operational closure
|
613
|
+
print("Thank you for using this script")
|
614
|
+
print()
|