-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAWeSomeUserFinder.py
64 lines (60 loc) · 2.61 KB
/
AWeSomeUserFinder.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
import argparse
import textwrap
import sys
from functions.assumerole import user_enum
from functions.banner import *
from functions.s3 import bucket_enum
from functions.spray import spray
def options():
opt_parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=textwrap.dedent(
"""Example: python3 AWeSomeConsoleUserFinder.py -a 1234567890 -f -ak <accesskey> -sk <secretkey> -r users.txt\n python3 AWeSomeConsoleUserFinder.py -a 1234567890 -s -p Password -r users.txt
"""
),
)
requiredArgs = opt_parser.add_argument_group('Required Arguments')
requiredArgs.add_argument(
"-a", "--account", help="AWS account to check for IAM users")
requiredArgs.add_argument(
"-r", "--read", help="Reads usernames from a file to test")
opt_parser.add_argument(
"-i", "--iam", help="Uses IAM policy modification for enumeration", action="store_true")
opt_parser.add_argument(
"-s3", "--s3enum", help="Uses s3 bucket policy modification for enumeration", action="store_true")
opt_parser.add_argument(
"-b", "--bucket", help="Bucket name to use for s3 policy")
opt_parser.add_argument("-ak", "--accesskey",
help="Access key for enumerating users")
opt_parser.add_argument("-sk", "--secretkey",
help="Secret key for enumerating users")
opt_parser.add_argument(
"-s", "--spray", help="Password spray a list of account names", action="store_true")
opt_parser.add_argument("-p", "--password", help="Password to spray")
opt_parser.add_argument(
"-f", "--find", help="Find valid AWS IAM account names", action="store_true")
opt_parser.add_argument(
"-rn", "--rolename", help="Role name to add to the assume policy document")
opt_parser.add_argument(
"-t", "--timeout", help="Set pause time between password spraying attempts. Default - 2 seconds")
opt_parser.add_argument(
"-v", "--verbose", help="Prints output verbosely", action="store_true"
)
global args
args = opt_parser.parse_args()
if len(sys.argv) == 1:
opt_parser.print_help()
opt_parser.exit()
if __name__ == "__main__":
try:
banner()
options()
if args.find:
user_enum(args)
elif args.s3enum:
bucket_enum(args)
elif args.spray:
spray(args)
except KeyboardInterrupt:
print('You either fat fingered this, or something else. Otherwise, quitting!')
quit()