diff --git a/local-app/python-tools/cross-organization/assess_check_config.py b/local-app/python-tools/cross-organization/assess_check_config.py new file mode 100644 index 00000000..327e864e --- /dev/null +++ b/local-app/python-tools/cross-organization/assess_check_config.py @@ -0,0 +1,26 @@ +import json +import argparse +import re + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--input", required=True, help="The JSON audit file") + parser.add_argument("--central-bucket-regex", required=True, help="Regex for central bucket") + args = parser.parse_args() + + with open(args.input, 'r') as f: + data = json.load(f) + + print(f"{'Account ID':<15} | {'Region':<15} | {'Match':<6} | {'Bucket Name'}") + print("-" * 70) + + for acc in data: + for reg, checks in acc["checks"].items(): + bucket = checks.get("s3_bucket", "N/A") + if bucket != "N/A": + match = bool(re.match(args.central_bucket_regex, bucket)) + if not match: + print(f"{acc['account_id']:<15} | {reg:<15} | {str(match):<6} | {bucket}") + +if __name__ == "__main__": + main()