README.md

Fetch AWS MFA accounts and AWS keys, AWS CLI v2 automatic SSO login from Chrome using Selenium for Python.

Prerequisites

In order to build mfakeys you need to have Python 3.8+, GNU Make installed.

Build

Creates standalone executable without any dependencies

$ git clone https://github.com/ten0s/mfakeys.git
$ cd mfakeys
$ make

Usage

General help

$ dist/mfakeys -h

Print AWS accounts (no account privided)

$ dist/mfakeys -U USERNAME -P PASSWORD -C CODE --url URL

Print AWS account’s profiles (no profile privided)

$ dist/mfakeys -U USERNAME -P PASSWORD -C CODE -a ACCOUNT --url URL

Print AWS keys for an account and its profile

$ dist/mfakeys -U USERNAME -P PASSWORD -C CODE -a ACCOUNT -p PROFILE --url URL

Use AWS keys for an account and its profile

$ $(dist/mfakeys -U USERNAME -P PASSWORD -C CODE -a ACCOUNT -p PROFILE --url URL)
$ aws ec2 describe-instances

Automatic AWS CLI v2 SSO login

See https://github.com/aws/aws-cli/issues/5061 and https://docs.python.org/3/library/webbrowser.html for detail

$ BROWSER="bash -c 'dist/mfakeys --login %s || true'" aws sso login --profile PROFILE

Resource file

$ cat ~/.mfakeysrc
[default]
username=USERNAME
password=PASSWORD
code=CODE | PATH_TO_SCRIPT
url=URL
$ dist/mfakeys -a ACCOUNT -p PROFILE

Debugging

Print debug info

$ DEBUG=1 dist/mfakeys [-a ACCOUNT -p PROFILE]
$ DEBUG=1 BROWSER="dist/mfakeys --login %s" aws sso login --profile PROFILE

Print debug info and show browser

$ DEBUG=2 dist/mfakeys [-a ACCOUNT -p PROFILE]
$ DEBUG=2 BROWSER="dist/mfakeys --login %s" aws sso login --profile PROFILE

Print debug info, show browser and run under pdb

$ DEBUG=3 dist/mfakeys [-a ACCOUNT -p PROFILE]
(Pdb) break 130
(Pdb) continue
$ DEBUG=3 BROWSER="dist/mfakeys --login %s" aws sso login --profile PROFILE
(Pdb) break 130
(Pdb) continue
Описание

About AWS MFA Keys Fetcher

Конвейеры
0 успешных
0 с ошибкой