Skip to content
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

33 lines (24 sloc) 958 Bytes
from whatsapp import HKDF, AESUnpad;
import base64;
import urllib2;
from Crypto.Cipher import AES;
#Example of MP4 video
mediaurl = ""
mediakey = "TKgNZsaEAvtTzNEgfDqd5UAdmnBNUcJtN7mxMKunAPw="
salt = "WhatsApp Video Keys"
#Example grabbing JPEG instead of MP4
#mediaurl = ""
#salt = "WhatsApp Image Keys"
mediaKeyExpanded = HKDF(base64.b64decode(mediakey),112,salt)
iv = mediaKeyExpanded[:16]
cipherKey = mediaKeyExpanded[16:48]
macKey = mediaKeyExpanded[48:80]
mediaData = urllib2.urlopen(mediaurl).read()
file = mediaData[:-10]
mac = mediaData[-10:]
decryptor =, AES.MODE_CBC, iv)
with open('rob.mp4', 'wb') as f:
print("file written to rob.mp4")
You can’t perform that action at this time.