-
Notifications
You must be signed in to change notification settings - Fork 6
/
full_scan.py
executable file
·84 lines (63 loc) · 1.83 KB
/
full_scan.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#! /usr/bin/env python3
from sys import exit
try:
import config
except ModuleNotFoundError:
print("Please create a 'config.py' before running this tool")
exit(1)
import crayons
import helper
import timeit
from datetime import datetime
from modules import (
ami,
ec2_snapshots,
ec2,
eip,
rds_snapshots,
securitygroups,
volumes,
lambdafunctions,
cloudwatch,
cloudformation,
s3,
)
all_regions = helper.get_all_regions()
if len(config.REGIONS) == 0:
print(crayons.red("REGIONS must contain at least one region".format(r)))
exit(1)
for r in config.REGIONS:
if r not in all_regions:
print(crayons.red("{} is not a valid region".format(r)))
exit(1)
print("Starting full account scan for these Regions: {}".format(",".join(config.REGIONS)))
account_id = helper.get_account_id()
print("Account: {}".format(account_id))
start_date = datetime.now().strftime("%Y-%m-%d_%H:%M")
print("Start date: {}".format(start_date))
start = timeit.default_timer()
print(crayons.yellow("Scanning AMIs"))
ami.scan()
print(crayons.yellow("Scanning EC2 instances"))
ec2.scan()
print(crayons.yellow("Scanning EC2 volumes"))
volumes.scan()
print(crayons.yellow("Scanning EC2 snapshots"))
ec2_snapshots.scan()
print(crayons.yellow("Scanning RDS snapshots"))
rds_snapshots.scan()
print(crayons.yellow("Scanning security groups"))
securitygroups.scan()
print(crayons.yellow("Scanning CloudWatch loggroups"))
cloudwatch.scan()
print(crayons.yellow("Scanning Lambda functions"))
lambdafunctions.scan()
print(crayons.yellow("Scanning CloudFormation"))
cloudformation.scan()
print(crayons.yellow("Scanning S3"))
s3.scan()
print(crayons.yellow("Scanning elastic IPs"))
eip.scan()
stop = timeit.default_timer()
runtime = int(stop - start)
print("Scan finished after {} seconds".format(crayons.yellow(runtime)))