Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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