-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathransomwhen.py
60 lines (46 loc) · 2 KB
/
ransomwhen.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
import os, json
from core.Other.Arguments.ArgParse import parseArgs
from core.Other.PrintOutput.PrintOutput import printOutput
from core.Authentication.Authentication import authenticate
from core.Resources.MainActivity.MainActivity import IdentitiesEnumeration, ListEvents
args = parseArgs()
if not os.path.exists("./output"):
os.mkdir("./output")
profile = args.profile
accountid = None
try:
client = authenticate(
Profile=profile,
AccessKey=None,
SecretKey=None,
SessionToken=None,
Service="sts",
UserAgent=None
)
accountid = client.get_caller_identity()['Account']
printOutput(f"---------------------------------------------------------", "loading", verbose=True)
printOutput(f" Testing Account {accountid}", "loading", verbose=True)
printOutput(f"---------------------------------------------------------", "loading", verbose=True)
except Exception as e:
printOutput(f"Error with credentials provided: {str(e)}", "error")
exit()
if accountid is None:
printOutput(f"Error with credentials provided", "error")
exit()
if not os.path.exists(f'./output/{accountid}'):
os.mkdir(f"./output/{accountid}")
if args.provider == "IDENTITIES":
if args.identity_name is not None:
if args.identity_type is None:
printOutput(
"You need to also provide the identity type using -it if you provide the identity name using -i",
"failure")
exit()
mainactivity = IdentitiesEnumeration(profile=profile, accountID=accountid, args=args)
mainactivity.identities_enumeration()
elif args.provider == "EVENTS":
mainactivity = ListEvents(profile=profile, accountID=accountid, verbose=args.verbose, identity_name=args.identity_name)
mainactivity.list_events()
#print(json.dumps(mainactivity.list_events(), indent=4, default=str))
else:
printOutput("Provider should either be IDENTITIES or EVENTS", "failure")