superdup95
commited on
Commit
•
e6c8aa8
1
Parent(s):
8b7771c
Update api_usage.py
Browse files- api_usage.py +6 -4
api_usage.py
CHANGED
@@ -405,7 +405,7 @@ def check_key_aws_availability(key):
|
|
405 |
admin = False
|
406 |
billing = False
|
407 |
quarantine = False
|
408 |
-
|
409 |
iam_policies_perm = False
|
410 |
|
411 |
session = boto3.Session(
|
@@ -418,7 +418,7 @@ def check_key_aws_availability(key):
|
|
418 |
username = check_username(session)
|
419 |
#print(username)
|
420 |
if not username[0]:
|
421 |
-
return False, "", "", "", "", username[1], "", ""
|
422 |
|
423 |
if username[0] == 'root':
|
424 |
root = True
|
@@ -430,6 +430,8 @@ def check_key_aws_availability(key):
|
|
430 |
for policy in policies[1]:
|
431 |
if policy['PolicyName'] == 'AdministratorAccess':
|
432 |
admin = True
|
|
|
|
|
433 |
if policy['PolicyName'] == 'AWSCompromisedKeyQuarantineV2':
|
434 |
quarantine = True
|
435 |
|
@@ -441,8 +443,8 @@ def check_key_aws_availability(key):
|
|
441 |
enable_region_sonnet = enable_region[1]
|
442 |
cost = check_aws_billing(session)
|
443 |
if enable_region[0]:
|
444 |
-
return True, username[0], root, admin, quarantine, enable_region_v2, enable_region_sonnet, cost
|
445 |
-
return True, username[0], root, admin, quarantine, enable_region_v2, enable_region_sonnet, cost
|
446 |
|
447 |
def check_username(session):
|
448 |
try:
|
|
|
405 |
admin = False
|
406 |
billing = False
|
407 |
quarantine = False
|
408 |
+
iam_full_access = False
|
409 |
iam_policies_perm = False
|
410 |
|
411 |
session = boto3.Session(
|
|
|
418 |
username = check_username(session)
|
419 |
#print(username)
|
420 |
if not username[0]:
|
421 |
+
return False, "", "", "", "", "", username[1], "", ""
|
422 |
|
423 |
if username[0] == 'root':
|
424 |
root = True
|
|
|
430 |
for policy in policies[1]:
|
431 |
if policy['PolicyName'] == 'AdministratorAccess':
|
432 |
admin = True
|
433 |
+
if policy['PolicyName'] == 'IAMFullAccess':
|
434 |
+
iam_full_access = True
|
435 |
if policy['PolicyName'] == 'AWSCompromisedKeyQuarantineV2':
|
436 |
quarantine = True
|
437 |
|
|
|
443 |
enable_region_sonnet = enable_region[1]
|
444 |
cost = check_aws_billing(session)
|
445 |
if enable_region[0]:
|
446 |
+
return True, username[0], root, admin, iam_full_access, quarantine, enable_region_v2, enable_region_sonnet, cost
|
447 |
+
return True, username[0], root, admin, iam_full_access, quarantine, enable_region_v2, enable_region_sonnet, cost
|
448 |
|
449 |
def check_username(session):
|
450 |
try:
|