Skip to content

Instantly share code, notes, and snippets.

body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
def get_session(target_profile, mfa_arn, token_code=None, region='us-east-1'):
import re, sys
from os.path import expanduser
temp_profile = 'tmp_{}_boto3'.format(target_profile)
creds = {}
resp_key_map = {
'AccessKeyId' : 'aws_access_key_id',
'SecretAccessKey' : 'aws_secret_access_key',
# https://developers.google.com/gmail/api/quickstart/python
# pip3 install --upgrade google-api-python-client
from __future__ import print_function
from apiclient.discovery import build
from httplib2 import Http
from oauth2client import file, client, tools
from base64 import urlsafe_b64decode as b64d
# update this to a filter which pulls all the target emails
import sys
import rsa
import gzip
import json
import boto3
import queue
import logging
import hashlib
import binascii