-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverifier.py
More file actions
34 lines (24 loc) · 871 Bytes
/
verifier.py
File metadata and controls
34 lines (24 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import argparse
from src.verify_policy import RolePolicyParser
parser = argparse.ArgumentParser(
description="Script for verification JSON files in AWS::IAM::Role Policy format. To perform verification, input the JSON file location."
)
parser.add_argument("-d", "--directory", help="Path to JSON file (REQUIRED)")
args = parser.parse_args()
def main() -> bool:
"""
Main function for executing role policy verification.
"""
if not args.directory:
parser.print_help()
exit(0)
policy_parser = RolePolicyParser(args.directory)
try:
result = policy_parser.verify()
print(result)
except (FileNotFoundError, ValueError, KeyError, TypeError) as e:
print(type(e).__name__, e)
except Exception as e:
print(f"Unhandled exception:{type(e).__name__}")
if __name__ == "__main__":
main()