-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.py
37 lines (29 loc) · 1.26 KB
/
main.py
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
35
36
37
# CrowdStrike BSoD Remediation for AWS, GCP, Azure
# Copyright 2024 AccuKnox
# Copyright 2024 XCitium
# Note: Use it at your own risk
# License: Apache 2
import argparse
import logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger("main")
supported_csps=['aws', 'gcp', 'azure']
def main() -> None:
argp = argparse.ArgumentParser()
argp.add_argument("--csp", required=True, help="Cloud Service Provider name [aws/gcp/azure]")
argp.add_argument("--instances", required=True, help="Instance list separated by comma")
argp.add_argument("--dry-run", action="store_true")
# Azure specific args
argp.add_argument("--subscription-id", required=False, help="Azure Subscription ID")
argp.add_argument("--resource-group", required=False, help="Azure resource group")
args = argp.parse_args()
if args.csp not in ['aws', 'gcp', 'azure']:
log.error(f"unsupported cloud service provider [{args.csp}]. Supported {supported_csps}.")
exit(1)
log.info(f"using cloud service provider {args.csp}")
log.info(f"Instances {args.instances}")
module = __import__(f"csp_{args.csp}")
func = getattr(module, f"handle_{args.csp}")
func(args) # calls handle_aws, handle_gcp, handle_azure
if __name__ == "__main__":
main()