Skip to content

Instantly share code, notes, and snippets.

@therealklanni
Created September 14, 2014 20:30
Show Gist options
  • Save therealklanni/8be0e1c7431ef298beb7 to your computer and use it in GitHub Desktop.
Save therealklanni/8be0e1c7431ef298beb7 to your computer and use it in GitHub Desktop.
from Crypto.Cipher import AES
from Crypto import Random
from libmproxy.flow import decoded
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-ord(s[-1])]
def decrypt( enc, key ):
iv = enc[:16]
enc = enc[16:]
cipher = AES.new(key, AES.MODE_CBC, iv)
return cipher.decrypt(enc)
# return unpad(cipher.decrypt(enc))
def response(context, flow):
with decoded(flow.response): # automatically decode gzipped responses.
print(flow.response.content.encode("base64"))
flow.response.content = decrypt(flow.response.content, "dd4763541be100910b568ca6d48268e3")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment