Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import hashlib, json, os, sys
# requires packages requests and pycryptodome
# run with
# python [GUID] password
import requests
from Crypto.Cipher import AES
guid = sys.argv[1]
password = sys.argv[2]
cachename = guid + ".json"
if not os.path.isfile(cachename):
res = requests.get("" % guid)
open(cachename, "wb").write(res.content)
content = open(cachename, "rb").read()
j = json.loads(content)
j = json.loads(j["payload"])
if j["version"] != 3:
raise Exception("Unsupported version %d" % j["version"])
pbkdf2_iterations = j["pbkdf2_iterations"]
payload = j["payload"].decode("base64")
key = hashlib.pbkdf2_hmac("sha1", password, payload[0:16], iterations=pbkdf2_iterations, dklen=256 / 8)
res =, AES.MODE_CBC, payload[0:16]).decrypt(payload[16:])
pad = ord(res[-1])
res = res[:-pad]
j = json.loads(res)
print json.dumps(j, indent=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment