Skip to content

Instantly share code, notes, and snippets.

@mitchese
Created June 23, 2017 10:23
Show Gist options
  • Save mitchese/fde3e2db94b6230ad0ced8169b80f40c to your computer and use it in GitHub Desktop.
Save mitchese/fde3e2db94b6230ad0ced8169b80f40c to your computer and use it in GitHub Desktop.
Convert AWS credentials to SMTP password
import base64
import hmac
import hashlib
import sys
def generate_smtp_password(key):
message = "SendRawEmail"
version = '\x02'
h = hmac.new(key, message, digestmod=hashlib.sha256)
print base64.b64encode("{0}{1}".format(version, h.digest()))
generate_smtp_password(sys.argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment