Created
January 29, 2019 04:13
-
-
Save M00nF1sh/38ef7c3a4dd2eb05ffcf3e4b742e9614 to your computer and use it in GitHub Desktop.
aws_console from access_key & access_secret
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib, json | |
import requests | |
from boto.sts import STSConnection | |
sts_connection = STSConnection() | |
federation_token = sts_connection.get_federation_token(name="M00nF1sh") | |
session_token = { | |
"sessionId": federation_token.credentials.access_key, | |
"sessionKey": federation_token.credentials.secret_key, | |
"sessionToken": federation_token.credentials.session_token | |
} | |
resp = requests.get("https://signin.aws.amazon.com/federation", params={ | |
"Action": "getSigninToken", | |
"Session": json.dumps(session_token) | |
}) | |
signin_token = resp.json()["SigninToken"] | |
p = requests.Request('GET', "https://signin.aws.amazon.com/federation", params={ | |
"Action": "login", | |
"Issuer": "M00nF1sh", | |
"Destination": "https://console.aws.amazon.com/", | |
"SigninToken": signin_token | |
}).prepare() | |
print(p.url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice Yang!