iam/sts updates

This commit is contained in:
carnal0wnage
2017-06-30 17:24:32 -04:00
parent d7ae9e8c1a
commit e7e779e2a8
3 changed files with 13 additions and 11 deletions

View File

@@ -14,14 +14,15 @@ import pprint
pp = pprint.PrettyPrinter(indent=5, width=80) pp = pprint.PrettyPrinter(indent=5, width=80)
from libs.iam import * from libs.iam import *
from libs.sts import *
#insert AWS key, will figure out how to pull this in from a single file for all scripts #insert AWS key, will figure out how to pull this in from a single file for all scripts
#AWS_ACCESS_KEY_ID = '' AWS_ACCESS_KEY_ID = ''
#AWS_SECRET_ACCESS_KEY ='' AWS_SECRET_ACCESS_KEY =''
get_accountid(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
check_root_account(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) check_root_account(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
get_password_policy(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) get_password_policy(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
#create_access_key(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,'pythons3') #create_access_key(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,'pythons3')

View File

@@ -11,7 +11,8 @@ def get_accountid(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
try: try:
client = boto3.client("sts", aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY) client = boto3.client("sts", aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY)
account_id = client.get_caller_identity()["Account"] account_id = client.get_caller_identity()["Account"]
print account_id print("Account Id: {}" .format(account_id))
except KeyboardInterrupt: except KeyboardInterrupt:
print("CTRL-C received, exiting...") print("CTRL-C received, exiting...")
return account_id return account_id